From de3c8e5b80effa940c92980032389c868f377d6b Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 22 Apr 2004 13:59:39 +0000 Subject: [PATCH] fix arabtex-related problems (bug 1225 and bug 1404) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8692 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_latex.C | 47 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/output_latex.C b/src/output_latex.C index 7b645ce9a0..2a8b460249 100644 --- a/src/output_latex.C +++ b/src/output_latex.C @@ -145,7 +145,13 @@ TeXEnvironment(Buffer const & buf, do { par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams); - if (par != const_cast(paragraphs).end() && par->params().depth() > pit->params().depth()) { + if (par == const_cast(paragraphs).end()) { + // Make sure that the last paragraph is + // correctly terminated (because TeXOnePar does + // not add a \n in this case) + os << '\n'; + texrow.newline(); + } else if (par->params().depth() > pit->params().depth()) { if (par->layout()->isParagraph()) { // Thinko! @@ -381,6 +387,25 @@ paragraphs); } } + if (boost::next(pit) == const_cast(paragraphs).end() + && language->babel() != doc_language->babel()) { + // Since \selectlanguage write the language to the aux file, + // we need to reset the language at the end of footnote or + // float. + + if (lyxrc.language_command_end.empty()) + os << subst(lyxrc.language_command_begin, + "$$lang", + doc_language->babel()) + << endl; + else + os << subst(lyxrc.language_command_end, + "$$lang", + language->babel()) + << endl; + texrow.newline(); + } + if (!pit->forceDefaultParagraphs()) { further_blank_line = false; @@ -399,27 +424,11 @@ paragraphs); } // we don't need it for the last paragraph!!! + // Note from JMarc: we will re-add a \n explicitely in + // TeXEnvironment, because it is needed in this case if (boost::next(pit) != const_cast(paragraphs).end()) { os << '\n'; texrow.newline(); - } else { - // Since \selectlanguage write the language to the aux file, - // we need to reset the language at the end of footnote or - // float. - - if (language->babel() != doc_language->babel()) { - if (lyxrc.language_command_end.empty()) - os << subst(lyxrc.language_command_begin, - "$$lang", - doc_language->babel()) - << endl; - else - os << subst(lyxrc.language_command_end, - "$$lang", - language->babel()) - << endl; - texrow.newline(); - } } lyxerr[Debug::LATEX] << "TeXOnePar...done " << &*boost::next(pit) << endl;