X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.cpp;h=7a95178227230f14607555698c0f1af35ccb8ea0;hb=421853d1bf021b7180a61d8c2908ede2dce48061;hp=49fd3bb00844692b4b24aa830582704330581f49;hpb=3fd2398a28c8d2c85d1bb2c33c6ca15bfc398b54;p=lyx.git diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 49fd3bb008..7a95178227 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -324,17 +324,19 @@ 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"; OutputParams rp = runparams_in; rp.moving_arg = true; - getCaption(os, rp); + 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); @@ -494,37 +496,31 @@ bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const } -docstring InsetFloat::getCaption(OutputParams const & runparams) const -{ - odocstringstream ods; - otexstream os(ods); - getCaption(os, runparams); - return ods.str(); -} - - -void InsetFloat::getCaption(otexstream & os, - OutputParams const & runparams) const +TexString InsetFloat::getCaption(OutputParams const & runparams) const { - if (paragraphs().empty()) - return; - InsetCaption const * ins = getCaptionInset(); if (ins == 0) - return; + return TexString(); + otexstringstream os; ins->getArgs(os, runparams); + if (!runparams.nice) + // increase TexRow precision in non-nice mode + os << safebreakln; os << '['; - odocstringstream ods; - otexstream oss(ods); - ins->getArgument(oss, runparams); - docstring arg = ods.str(); + otexstringstream os2; + ins->getArgument(os2, runparams); + TexString ts = os2.release(); + docstring & arg = ts.str; // Protect ']' if (arg.find(']') != docstring::npos) arg = '{' + arg + '}'; - os.append(arg, move(oss.texrow())); + os << move(ts); os << ']'; + if (!runparams.nice) + os << safebreakln; + return os.release(); }