ulem commands can be nested.

This commit is contained in:
Juergen Spitzmueller 2014-03-22 12:25:25 +01:00 committed by Richard Heck
parent dfa07c1424
commit 045dee3755
5 changed files with 14 additions and 14 deletions

View File

@ -418,22 +418,22 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
if (f.underbar() == FONT_ON) {
os << "\\uline{";
count += 10;
runparams.inulemcmd = true;
++runparams.inulemcmd;
}
if (f.strikeout() == FONT_ON) {
os << "\\sout{";
count += 9;
runparams.inulemcmd = true;
++runparams.inulemcmd;
}
if (f.uuline() == FONT_ON) {
os << "\\uuline{";
count += 11;
runparams.inulemcmd = true;
++runparams.inulemcmd;
}
if (f.uwave() == FONT_ON) {
os << "\\uwave{";
count += 10;
runparams.inulemcmd = true;
++runparams.inulemcmd;
}
return count;
}
@ -497,22 +497,22 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
if (f.underbar() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
--runparams.inulemcmd;
}
if (f.strikeout() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
--runparams.inulemcmd;
}
if (f.uuline() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
--runparams.inulemcmd;
}
if (f.uwave() == FONT_ON) {
os << '}';
++count;
runparams.inulemcmd = false;
--runparams.inulemcmd;
}
// If the current language is Hebrew, Arabic, or Farsi

View File

@ -20,7 +20,7 @@ namespace lyx {
OutputParams::OutputParams(Encoding const * enc)
: flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false),
moving_arg(false), inulemcmd(false), local_font(0), master_language(0),
moving_arg(false), inulemcmd(0), local_font(0), master_language(0),
encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false),
use_indices(false), use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData),

View File

@ -99,13 +99,13 @@ public:
*/
bool intitle;
/** inulemcmd == true means that the environment in which the
/** inulemcmd > 0 means that the environment in which the
inset is typeset is part of a ulem command (\uline, \uuline,
\uwave, or \sout). Insets that output latex commands relying
on local assignments (such as \cite) should enclose such
commands in \mbox{} in order to avoid breakage.
*/
mutable bool inulemcmd;
mutable int inulemcmd;
/** the font at the point where the inset is
*/

View File

@ -422,7 +422,7 @@ void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const
// FIXME UNICODE
docstring const cite_str = from_utf8(citationStyleToString(cs));
if (runparams.inulemcmd)
if (runparams.inulemcmd > 0)
os << "\\mbox{";
os << "\\" << cite_str;

View File

@ -143,7 +143,7 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
string const cmd = getCmdName();
docstring const data = getEscapedLabel(rp);
if (rp.inulemcmd)
if (rp.inulemcmd > 0)
os << "\\mbox{";
if (cmd == "eqref" && buffer().params().use_refstyle) {
@ -168,7 +168,7 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
os << p.getCommand(rp);
}
if (rp.inulemcmd)
if (rp.inulemcmd > 0)
os << "}";
}