commit 299574c185d698d90548eb72118346a6d6ad1db1 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sat Mar 22 12:25:25 2014 +0100
ulem commands can be nested. diff --git a/src/Font.cpp b/src/Font.cpp index a155ec5..7e8b3f4 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -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 diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index df58ff4..e74eaa3 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -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), diff --git a/src/OutputParams.h b/src/OutputParams.h index f220b5e..598b575 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -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 */ diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index c0e6179..96620c1 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -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; diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index a3f0596..464a3dd 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -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 << "}"; }