]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloat.cpp
Handle the case of TeX fonts LuaTeX
[lyx.git] / src / insets / InsetFloat.cpp
index 49fd3bb00844692b4b24aa830582704330581f49..7a95178227230f14607555698c0f1af35ccb8ea0 100644 (file)
@@ -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();
 }