]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Allow captions also on non-floating minted listings
[lyx.git] / src / LaTeXFeatures.cpp
index b10a9a27544623df2181f059a8f9ad668cbf9ad6..bf8cf24f0744fdfec7856af72a829f7cb057863f 100644 (file)
@@ -419,6 +419,17 @@ static docstring const rtloutputdblcol_def = from_ascii(
        "}\n"
        "\\@mparswitchtrue\n");
 
+static docstring const lyxmintcaption_def = from_ascii(
+       "\\long\\def\\lyxmintcaption[#1]#2{%\n"
+       "  \\ifx#1t\\vskip\\baselineskip\\fi%\n"
+       "  \\refstepcounter{listing}\\noindent%\n"
+       "  \\setbox\\@tempboxa\\hbox{\\listingscaption~\\thelisting: #2}%\n"
+       "  \\ifdim \\wd\\@tempboxa >\\linewidth%\n"
+       "  \\parbox[t]{\\linewidth}{\\unhbox\\@tempboxa}\\else%\n"
+       "  \\hbox to\\linewidth{\\hfil\\box\\@tempboxa\\hfil}\\fi%\n"
+       "  \\ifx#1b\\vskip\\baselineskip\\fi\n"
+       "}\n");
+
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -1491,6 +1502,9 @@ TexString LaTeXFeatures::getMacros() const
        if (mustProvide("rtloutputdblcol"))
                macros << rtloutputdblcol_def;
 
+       if (mustProvide("lyxmintcaption"))
+               macros << lyxmintcaption_def;
+
        return macros.release();
 }