From 4a66e4e538c0fd7f5c620355c6bd0082b8a65702 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 27 Sep 2004 10:55:57 +0000 Subject: [PATCH] fix bug 1404 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9015 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 +++ src/paragraph.C | 123 ++++++++++++++++++++++++------------------------ status.13x | 2 +- 3 files changed, 69 insertions(+), 62 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 158d3d8764..d5536ff44e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2004-09-22 Jean-Marc Lasgouttes + + * paragraph.C (TeXOnePar): Make sure font setting is the first + thing that gets output (and the last at the end). Should fix bug + 1404. + 2004-07-15 Georg Baum * buffer.C (parseSingleLyXformat2Token): fix the off-by-one-error diff --git a/src/paragraph.C b/src/paragraph.C index ce559db2aa..bdd7581306 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -970,51 +970,10 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, bool further_blank_line = false; LyXLayout_ptr style; - // well we have to check if we are in an inset with unlimited - // lenght (all in one row) if that is true then we don't allow - // any special options in the paragraph and also we don't allow - // any environment other then "Standard" to be valid! - if ((in == 0) || !in->forceDefaultParagraphs(in)) { + if ((in == 0) || !in->forceDefaultParagraphs(in)) style = layout(); - - if (params().startOfAppendix()) { - os << "\\appendix\n"; - texrow.newline(); - } - - if (!params().spacing().isDefault() - && (!previous() || !previous()->hasSameLayout(this))) { - os << params().spacing().writeEnvirBegin() << '\n'; - texrow.newline(); - } - - if (style->isCommand()) { - os << '\n'; - texrow.newline(); - } - - if (params().pagebreakTop()) { - os << "\\newpage"; - further_blank_line = true; - } - if (params().spaceTop().kind() != VSpace::NONE) { - os << params().spaceTop().asLatexCommand(bparams); - further_blank_line = true; - } - - if (params().lineTop()) { - os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}' - << "\\vspace{-1\\parskip}"; - further_blank_line = true; - } - - if (further_blank_line) { - os << '\n'; - texrow.newline(); - } - } else { + else style = bparams.getLyXTextClass().defaultLayout(); - } Language const * language = getParLanguage(bparams); Language const * doc_language = bparams.language; @@ -1056,6 +1015,48 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, texrow.newline(); } + // well we have to check if we are in an inset with unlimited + // length (all in one row) if that is true then we don't allow + // any special options in the paragraph and also we don't allow + // any environment other then "Standard" to be valid! + if ((in == 0) || !in->forceDefaultParagraphs(in)) { + if (params().startOfAppendix()) { + os << "\\appendix\n"; + texrow.newline(); + } + + if (!params().spacing().isDefault() + && (!previous() || !previous()->hasSameLayout(this))) { + os << params().spacing().writeEnvirBegin() << '\n'; + texrow.newline(); + } + + if (style->isCommand()) { + os << '\n'; + texrow.newline(); + } + + if (params().pagebreakTop()) { + os << "\\newpage"; + further_blank_line = true; + } + if (params().spaceTop().kind() != VSpace::NONE) { + os << params().spaceTop().asLatexCommand(bparams); + further_blank_line = true; + } + + if (params().lineTop()) { + os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}' + << "\\vspace{-1\\parskip}"; + further_blank_line = true; + } + + if (further_blank_line) { + os << '\n'; + texrow.newline(); + } + } + switch (style->latextype) { case LATEX_COMMAND: os << '\\' @@ -1133,24 +1134,6 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, } } - if (!next_ && 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 << '\n' - << subst(lyxrc.language_command_begin, - "$$lang", - doc_language->babel()); - else - os << '\n' - << subst(lyxrc.language_command_end, - "$$lang", - language->babel()); - texrow.newline(); - } - if ((in == 0) || !in->forceDefaultParagraphs(in)) { further_blank_line = false; if (params().lineBottom()) { @@ -1180,6 +1163,24 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf, } } + if (!next_ && 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 << '\n' + << subst(lyxrc.language_command_begin, + "$$lang", + doc_language->babel()); + else + os << '\n' + << subst(lyxrc.language_command_end, + "$$lang", + language->babel()); + texrow.newline(); + } + // 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 diff --git a/status.13x b/status.13x index 3b34f39b30..e066685587 100644 --- a/status.13x +++ b/status.13x @@ -45,7 +45,7 @@ What's new working correctly [bug #605]. - Fix nesting of language change commands, especially important for - Arabic [bug #1404]. + Arabic [bugs #1225, #1404]. - Fix missing line break in front of \end{...} in some cases [bug #1225].