branch: Fix bug #4473: Incorrect LaTeX output for inter-word spaces.

This is a hack necessary because \\textcolor is a bit buggy.

see r30773.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30774 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-07-25 10:55:35 +00:00
parent 64a7513231
commit ea16d18b54
4 changed files with 20 additions and 1 deletions

View File

@ -2092,9 +2092,14 @@ bool Paragraph::latex(BufferParams const & bparams,
running_font = font;
open_font = true;
docstring fontchange = ods.str();
docstring const last_modifier = rsplit(fontchange, '\\');
// check whether the fontchange ends with a \\textcolor
// modifier and the text starts with a space (bug 4473)
if (prefixIs(last_modifier, from_ascii("textcolor")) && c == ' ')
os << fontchange << from_ascii("{}");
// check if the fontchange ends with a trailing blank
// (like "\small " (see bug 3382)
if (suffixIs(fontchange, ' ') && c == ' ')
else if (suffixIs(fontchange, ' ') && c == ' ')
os << fontchange.substr(0, fontchange.size() - 1)
<< from_ascii("{}");
else

View File

@ -899,6 +899,16 @@ string const rsplit(string const & a, string & piece, char delim)
}
docstring const rsplit(docstring const & a, char_type delim)
{
docstring tmp;
size_t i = a.rfind(delim);
if (i != string::npos)
tmp = a.substr(i + 1);
return tmp;
}
docstring const escape(docstring const & lab)
{
char_type hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',

View File

@ -221,6 +221,7 @@ std::string const split(std::string const & a, char delim);
/// Same as split but uses the last delim.
std::string const rsplit(std::string const & a, std::string & piece, char delim);
docstring const rsplit(docstring const & a, char_type delim);
/// Escapes non ASCII chars and other problematic characters that cause
/// problems in latex labels.

View File

@ -125,6 +125,9 @@ What's new
* DOCUMENT INPUT/OUTPUT
- Fix the output of spaces that are at the beginning of a block with
a new textcolor (bug 4473).
- Fix conversion documents from LyX 1.4 which have multicolumn cells in
tabulars with expert border settings (bug 6018).