]> git.lyx.org Git - features.git/commitdiff
Load footmisc.sty instead of using outdated code
authorGeorg Baum <baum@lyx.org>
Fri, 14 Nov 2014 19:20:35 +0000 (20:20 +0100)
committerGeorg Baum <baum@lyx.org>
Fri, 14 Nov 2014 19:20:35 +0000 (20:20 +0100)
This is a patch I originally sent to lyx-devel in 2012 with subject
'Load footmisc.sty instead of using copied code from obsolete stblftnt.sty'.
It now takes all comments into account: It works also if the user loads the
package herself, it can be disabled by providing the footmisc feature in a
layout, and it does not use the ugly \AtBeginDocument{}.

lib/chkconfig.ltx
lib/doc/LaTeXConfig.lyx
src/BufferParams.cpp
src/LaTeXFeatures.cpp
src/Paragraph.cpp

index 0cba00ad3778ace47b80f9305f8b48f73a1fae8f..2bf2ea20e14eb7fb9f8193c6312e04ad9e87657a 100644 (file)
 \TestPackage{fix-cm}
 \TestPackage{float}
 \TestPackage{fontspec}
+\TestPackage{footmisc}
 \TestPackage{framed}
 \TestPackage{geometry}
 \TestPackage{graphicx}
index da4c2e4fa137687a7159adf23e749046ba6de139..1bfa2db221094319c5b800354f1118f1f313f4f3 100644 (file)
@@ -69,6 +69,7 @@
 \html_latex_end </span>
 \author -1379302345 "Julien Rioux" jrioux@lyx.org
 \author -712698321 "Jürgen Spitzmüller" 
+\author -195340706 "Georg Baum"
 \end_header
 
 \begin_body
@@ -7007,6 +7008,46 @@ fixltx2e
 fixltx2e
 \family default
  module.
+\change_inserted -195340706 1415992274
+
+\end_layout
+
+\begin_layout Subsection
+
+\change_inserted -195340706 1415992274
+footmisc
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -195340706 1415992274
+Found: 
+\begin_inset Info
+type  "package"
+arg   "footmisc"
+\end_inset
+
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -195340706 1415992274
+CTAN: 
+\family typewriter
+macros/latex/contrib/supported/footmisc/footmisc.sty
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -195340706 1415992274
+Notes: The package 
+\family sans
+footmisc 
+\family default
+is needed to support stable footnotes in chapter titles.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Subsection
index 01927a74cf6bdc2fcf201c0c1c8757923f0014bd..d94600fb0f303b8511f4a05b3f6eb681e37322ef 100644 (file)
@@ -1892,6 +1892,13 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        "User specified LaTeX commands.\n"
                        + from_utf8(preamble) + '\n';
 
+       // footmisc must be loaded after setspace
+       // Load it here to avoid clashes with footmisc loaded in the user
+       // preamble. For that reason we also pass the options via
+       // \PassOptionsToPackage in getPreamble() and not here.
+       if (features.mustProvide("footmisc"))
+               atlyxpreamble += "\\usepackage{footmisc}\n";
+
        // subfig loads internally the LaTeX package "caption". As
        // caption is a very popular package, users will load it in
        // the preamble. Therefore we must load subfig behind the
index 400dfb6c3e133708a91ab13adf39362f2fb223e2..630cc4c30ee4c59e71f3f073805bed83da3fa759 100644 (file)
@@ -134,24 +134,6 @@ static docstring const paragraphleftindent_def = from_ascii(
        "}\n"
        "{\\end{list}}\n");
 
-static docstring const floatingfootnote_def = from_ascii(
-       "%% Special footnote code from the package 'stblftnt.sty'\n"
-       "%% Author: Robin Fairbairns -- Last revised Dec 13 1996\n"
-       "\\let\\SF@@footnote\\footnote\n"
-       "\\def\\footnote{\\ifx\\protect\\@typeset@protect\n"
-       "    \\expandafter\\SF@@footnote\n"
-       "  \\else\n"
-       "    \\expandafter\\SF@gobble@opt\n"
-       "  \\fi\n"
-       "}\n"
-       "\\expandafter\\def\\csname SF@gobble@opt \\endcsname{\\@ifnextchar[%]\n"
-       "  \\SF@gobble@twobracket\n"
-       "  \\@gobble\n"
-       "}\n"
-       "\\edef\\SF@gobble@opt{\\noexpand\\protect\n"
-       "  \\expandafter\\noexpand\\csname SF@gobble@opt \\endcsname}\n"
-       "\\def\\SF@gobble@twobracket[#1]#2{}\n");
-
 static docstring const binom_def = from_ascii(
        "%% Binom macro for standard LaTeX users\n"
        "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n");
@@ -1050,6 +1032,12 @@ string const LaTeXFeatures::getPackages() const
        if (mustProvide("subscript") && !isRequired("fixltx2e"))
                packages << "\\usepackage{subscript}\n";
 
+       // footmisc must be loaded after setspace
+       // Set options here, load the package after the user preamble to
+       // avoid problems with manual loaded footmisc.
+       if (mustProvide("footmisc"))
+               packages << "\\PassOptionsToPackage{stable}{footmisc}\n";
+
        return packages.str();
 }
 
@@ -1178,8 +1166,6 @@ docstring const LaTeXFeatures::getMacros() const
        // other
        if (mustProvide("ParagraphLeftIndent"))
                macros << paragraphleftindent_def;
-       if (mustProvide("NeedLyXFootnoteCode"))
-               macros << floatingfootnote_def;
 
        // some problems with tex->html converters
        if (mustProvide("NeedTabularnewline"))
index 37e26a8b86683d125124c218e3e586cbefd4e07b..5bfa687abb53ebbc0e9d94bdb1b20fca12eda1cd 100644 (file)
@@ -1521,7 +1521,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                        icit->inset->validate(features);
                        if (layout_->needprotect &&
                            icit->inset->lyxCode() == FOOT_CODE)
-                               features.require("NeedLyXFootnoteCode");
+                               features.require("footmisc");
                }
        }