X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_latex.cpp;h=2f919f4fec998973bbf7375dd1d94d1aae2d6b5c;hb=1797f5218b8819874f9dbe97b44445b3b5d598a0;hp=cc93a1709cb5b414077f24af4965d853191f34d7;hpb=8c99d7227e43e3cd6cc74a4ebb69c18c6b729691;p=lyx.git diff --git a/src/output_latex.cpp b/src/output_latex.cpp index cc93a1709c..2f919f4fec 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -30,7 +30,7 @@ #include "insets/InsetBibitem.h" #include "insets/InsetOptArg.h" -#include "support/assert.h" +#include "support/lassert.h" #include "support/debug.h" #include "support/lstrings.h" @@ -778,53 +778,53 @@ void latexParagraphs(Buffer const & buf, // if only_body while (par != endpar) { lastpar = par; - Layout const & layout = par->forceEmptyLayout() ? - tclass.emptyLayout() : - par->layout(); - - if (layout.intitle) { - if (already_title) { - lyxerr << "Error in latexParagraphs: You" - " should not mix title layouts" - " with normal ones." << endl; - } else if (!was_title) { - was_title = true; - if (tclass.titletype() == TITLE_ENVIRONMENT) { - os << "\\begin{" - << from_ascii(tclass.titlename()) - << "}\n"; - texrow.newline(); - } - } - } else if (was_title && !already_title) { + Layout const & layout = par->forceEmptyLayout() ? + tclass.emptyLayout() : + par->layout(); + + if (layout.intitle) { + if (already_title) { + lyxerr << "Error in latexParagraphs: You" + " should not mix title layouts" + " with normal ones." << endl; + } else if (!was_title) { + was_title = true; if (tclass.titletype() == TITLE_ENVIRONMENT) { - os << "\\end{" << from_ascii(tclass.titlename()) - << "}\n"; - } - else { - os << "\\" << from_ascii(tclass.titlename()) - << "\n"; + os << "\\begin{" + << from_ascii(tclass.titlename()) + << "}\n"; + texrow.newline(); } - texrow.newline(); - already_title = true; - was_title = false; } - - if (layout.is_environment) { - par = TeXOnePar(buf, text, par, os, texrow, - runparams, everypar); - } else if (layout.isEnvironment() || - !par->params().leftIndent().zero()) { - par = TeXEnvironment(buf, text, par, os, - texrow, runparams); - } else { - par = TeXOnePar(buf, text, par, os, texrow, - runparams, everypar); + } else if (was_title && !already_title) { + if (tclass.titletype() == TITLE_ENVIRONMENT) { + os << "\\end{" << from_ascii(tclass.titlename()) + << "}\n"; + } + else { + os << "\\" << from_ascii(tclass.titlename()) + << "\n"; } + texrow.newline(); + already_title = true; + was_title = false; + } + + if (layout.is_environment) { + par = TeXOnePar(buf, text, par, os, texrow, + runparams, everypar); + } else if (layout.isEnvironment() || + !par->params().leftIndent().zero()) { + par = TeXEnvironment(buf, text, par, os, + texrow, runparams); + } else { + par = TeXOnePar(buf, text, par, os, texrow, + runparams, everypar); } if (distance(lastpar, par) >= distance(lastpar, endpar)) break; } + // It might be that we only have a title in this document if (was_title && !already_title) { if (tclass.titletype() == TITLE_ENVIRONMENT) { @@ -837,6 +837,7 @@ void latexParagraphs(Buffer const & buf, } texrow.newline(); } + // if "auto end" is switched off, explicitely close the language at the end // but only if the last par is in a babel language if (maintext && !lyxrc.language_auto_end && !bparams.language->babel().empty() && @@ -847,6 +848,7 @@ void latexParagraphs(Buffer const & buf, << '\n'; texrow.newline(); } + // If the last paragraph is an environment, we'll have to close // CJK at the very end to do proper nesting. if (maintext && open_encoding_ == CJK) { @@ -854,6 +856,7 @@ void latexParagraphs(Buffer const & buf, texrow.newline(); open_encoding_ = none; } + // reset inherited encoding if (cjk_inherited_) { open_encoding_ = CJK;