diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 8161d9ce73..7087e55442 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -315,6 +315,7 @@ \TestPackage{float} \TestPackage{fontspec} \TestPackage{footmisc} +\TestPackage{footnote} \TestPackage{forest} \TestPackage{framed} \TestPackage{geometry} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index 6a99ec482f..93b6563b92 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -5152,6 +5152,37 @@ here, definitely! \end_layout +\begin_layout Subsection +footnote +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "footnote" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +macros/latex/contrib/footnote/ +\end_layout + +\begin_layout Description +Notes: The package +\family sans +footnote +\family default + is needed by \SpecialChar LyX + to allow footnotes in non-floating tables and multi-page + table headers and footers. + +\end_layout + \begin_layout Subsection graphicx \end_layout diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 92e48293cd..c28d7958f6 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -974,6 +974,7 @@ char const * simplefeatures[] = { "todonotes", "forest", "varwidth", + "footnote", }; char const * bibliofeatures[] = { diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index df071c671b..72451ad8ee 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -163,6 +163,10 @@ public: bool inDeletedInset() const { return in_deleted_inset_; } /// are we in a deleted inset? void inDeletedInset(bool const b) { in_deleted_inset_ = b; } + /// set savenote environment (footnote package) + std::string saveNoteEnv() const { return savenote_env_; } + /// return savenote environment + void saveNoteEnv(std::string const s) { savenote_env_ = s; } /// Runparams that will be used for exporting this file. OutputParams const & runparams() const { return runparams_; } /// Resolve alternatives like "esint|amsmath|wasysym" @@ -221,6 +225,8 @@ private: bool in_deleted_inset_; /// docstring htmltitle_; + /// + std::string savenote_env_; }; diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 86c719ae65..de00e8935e 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -17,6 +17,7 @@ #include "BufferParams.h" #include "Counters.h" #include "Language.h" +#include "LaTeXFeatures.h" #include "Layout.h" #include "OutputParams.h" #include "ParIterator.h" @@ -104,4 +105,18 @@ int InsetFoot::docbook(odocstream & os, OutputParams const & runparams) const return i; } + +void InsetFoot::validate(LaTeXFeatures & features) const +{ + if (!features.saveNoteEnv().empty()) { + features.require("footnote"); + features.addPreambleSnippet( + from_ascii("\\makesavenoteenv{" + + features.saveNoteEnv() + + "}\n")); + } + + InsetText::validate(features); +} + } // namespace lyx diff --git a/src/insets/InsetFoot.h b/src/insets/InsetFoot.h index 67110d2574..c04ecabb78 100644 --- a/src/insets/InsetFoot.h +++ b/src/insets/InsetFoot.h @@ -36,6 +36,8 @@ private: size_t max_length = INT_MAX) const; /// int docbook(odocstream &, OutputParams const &) const; + /// + void validate(LaTeXFeatures & features) const; /// Update the counters of this inset and of its contents void updateBuffer(ParIterator const &, UpdateType); /// diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 788858e189..032621d367 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3424,7 +3424,16 @@ void Tabular::validate(LaTeXFeatures & features) const if (getVAlignment(cell) != LYX_VALIGN_TOP || !getPWidth(cell).zero()) features.require("array"); + // Tell footnote that we need a savenote + // environment in non-long tables or + // longtable headers/footers + if (!is_long_tabular) + features.saveNoteEnv("tabular"); + else if (!isValidRow(cellRow(cell))) + features.saveNoteEnv("longtable"); + cellInset(cell)->validate(features); + features.saveNoteEnv(string()); } }