Load footmisc.sty instead of using outdated code

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{}.
This commit is contained in:
Georg Baum 2014-11-14 20:20:35 +01:00
parent ff85a4902e
commit 0bf8b8a1d2
5 changed files with 56 additions and 21 deletions

View File

@ -306,6 +306,7 @@
\TestPackage{fix-cm}
\TestPackage{float}
\TestPackage{fontspec}
\TestPackage{footmisc}
\TestPackage{framed}
\TestPackage{geometry}
\TestPackage{graphicx}

View 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

View 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

View 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"))

View 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");
}
}