X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetText.cpp;h=f0a6c81832ffcc4ee088084fa10810b7ff3a6cb0;hb=bfddee97e191a853f0576f4fab3f095c4e9ce0de;hp=f35320b8e7ca0b9e95498f5fb6dffec2528e42d3;hpb=782e68aeb65a40590f270e3e4f40361da1e53441;p=lyx.git diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index f35320b8e7..f0a6c81832 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -331,10 +331,10 @@ void InsetText::fixParagraphsFont() ParagraphList::iterator par = paragraphs().begin(); ParagraphList::iterator const end = paragraphs().end(); while (par != end) { - if (par->isPassThru()) { + if (par->isPassThru()) par->resetFonts(font); + if (!par->allowParagraphCustomization()) par->params().clear(); - } ++par; } } @@ -370,14 +370,13 @@ void InsetText::validate(LaTeXFeatures & features) const } -int InsetText::latex(odocstream & os, OutputParams const & runparams) const +void InsetText::latex(otexstream & os, OutputParams const & runparams) const { // This implements the standard way of handling the LaTeX // output of a text inset, either a command or an // environment. Standard collapsable insets should not // redefine this, non-standard ones may call this. InsetLayout const & il = getLayout(); - int rows = 0; if (!il.latexname().empty()) { if (il.latextype() == InsetLayout::COMMAND) { // FIXME UNICODE @@ -388,10 +387,16 @@ int InsetText::latex(odocstream & os, OutputParams const & runparams) const os << from_utf8(il.latexparam()); os << '{'; } else if (il.latextype() == InsetLayout::ENVIRONMENT) { - os << "%\n\\begin{" << from_utf8(il.latexname()) << "}\n"; + if (il.isDisplay()) + os << breakln; + else + os << safebreakln; + if (runparams.lastid != -1) + os.texrow().start(runparams.lastid, + runparams.lastpos); + os << "\\begin{" << from_utf8(il.latexname()) << "}\n"; if (!il.latexparam().empty()) os << from_utf8(il.latexparam()); - rows += 2; } } OutputParams rp = runparams; @@ -403,20 +408,23 @@ int InsetText::latex(odocstream & os, OutputParams const & runparams) const rp.par_end = paragraphs().size(); // Output the contents of the inset - TexRow texrow; - latexParagraphs(buffer(), text_, os, texrow, rp); - rows += texrow.rows(); + latexParagraphs(buffer(), text_, os, rp); runparams.encoding = rp.encoding; if (!il.latexname().empty()) { if (il.latextype() == InsetLayout::COMMAND) { os << "}"; } else if (il.latextype() == InsetLayout::ENVIRONMENT) { - os << "%\n\\end{" << from_utf8(il.latexname()) << "}\n"; - rows += 2; + // A comment environment doesn't need a % before \n\end + if (il.isDisplay() || runparams.inComment) + os << breakln; + else + os << safebreakln; + os << "\\end{" << from_utf8(il.latexname()) << "}\n"; + if (!il.isDisplay()) + os.protectSpace(true); } } - return rows; }