Fix footnote output in tables outside floats and longtable header/footer

Fixes: #808 (sic!), #5869
This commit is contained in:
Juergen Spitzmueller 2017-11-19 08:57:58 +01:00
parent c21c07e027
commit 3affde3957
7 changed files with 65 additions and 0 deletions

View File

@ -315,6 +315,7 @@
\TestPackage{float}
\TestPackage{fontspec}
\TestPackage{footmisc}
\TestPackage{footnote}
\TestPackage{forest}
\TestPackage{framed}
\TestPackage{geometry}

View File

@ -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

View File

@ -974,6 +974,7 @@ char const * simplefeatures[] = {
"todonotes",
"forest",
"varwidth",
"footnote",
};
char const * bibliofeatures[] = {

View File

@ -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_;
};

View File

@ -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

View File

@ -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);
///

View File

@ -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());
}
}