From dbe0c6991bb12b95389ad4b336eba69fa0c2a8e0 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Mon, 10 Oct 2016 17:14:39 +0200 Subject: [PATCH] Add safe line breaks to improve TexRow precision in subfloat & caption --- src/insets/InsetFloat.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 1030b45c76..7a95178227 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -324,6 +324,10 @@ docstring InsetFloat::xhtml(XHTMLStream & xs, OutputParams const & rp) const void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const { if (runparams_in.inFloat != OutputParams::NONFLOAT) { + if (!paragraphs().empty() && !runparams_in.nice) + // improve TexRow precision in non-nice mode + os << safebreakln; + if (runparams_in.moving_arg) os << "\\protect"; os << "\\subfloat"; @@ -333,8 +337,6 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const os << getCaption(rp); os << '{'; // The main argument is the contents of the float. This is not a moving argument. - if (!paragraphs().empty()) - os.texrow().forceStart(paragraphs()[0].id(), 0); rp.moving_arg = false; rp.inFloat = OutputParams::SUBFLOAT; InsetText::latex(os, rp); @@ -503,6 +505,9 @@ TexString InsetFloat::getCaption(OutputParams const & runparams) const otexstringstream os; ins->getArgs(os, runparams); + if (!runparams.nice) + // increase TexRow precision in non-nice mode + os << safebreakln; os << '['; otexstringstream os2; ins->getArgument(os2, runparams); @@ -513,6 +518,8 @@ TexString InsetFloat::getCaption(OutputParams const & runparams) const arg = '{' + arg + '}'; os << move(ts); os << ']'; + if (!runparams.nice) + os << safebreakln; return os.release(); } -- 2.39.5