Allow footnotes in floating tables via tablefootnote package

See #808.
This commit is contained in:
Juergen Spitzmueller 2017-11-19 12:56:40 +01:00
parent aaa6150089
commit 5017a0a1c6
7 changed files with 56 additions and 6 deletions

View File

@ -369,6 +369,7 @@
\TestPackage{subfig}
\TestPackage{subscript}
\TestPackage{Sweave}
\TestPackage{tablefootnote}
\TestPackage{tcolorbox}
\TestPackage{textcomp}
\TestPackage{thswitch}

View File

@ -5178,8 +5178,8 @@ Notes: The package
footnote
\family default
is needed by \SpecialChar LyX
to allow footnotes in non-floating tables and multi-page
table headers and footers.
to allow footnotes in description items, non-floating tables
and multi-page table headers and footers.
\end_layout
@ -5307,6 +5307,35 @@ longtable
to be able to output correctly multipage tables.
\end_layout
\begin_layout Subsection
tablefootnote
\end_layout
\begin_layout Description
Found:
\begin_inset Info
type "package"
arg "tablefootnote"
\end_inset
\end_layout
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/tablefootnote/
\end_layout
\begin_layout Description
Notes: The package
\family sans
tablefootnote
\family default
is needed by \SpecialChar LyX
to be able to output footnotes in floating tables.
\end_layout
\begin_layout Subsection
textcomp
\end_layout

View File

@ -122,6 +122,13 @@ InsetLayout Foot:InTitle
EndHTMLStyle
End
InsetLayout Foot:InFloatTable
CopyStyle Foot
LatexName tablefootnote
Requires tablefootnote
End
InsetLayout Note:Comment
LabelString Comment
LatexType environment

View File

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

View File

@ -34,13 +34,17 @@ using namespace std;
namespace lyx {
InsetFoot::InsetFoot(Buffer * buf)
: InsetFootlike(buf), intitle_(false)
: InsetFootlike(buf), intitle_(false), infloattable_(false)
{}
docstring InsetFoot::layoutName() const
{
return intitle_ ? from_ascii("Foot:InTitle") : from_ascii("Foot");
if (intitle_)
return from_ascii("Foot:InTitle");
else if (infloattable_)
return from_ascii("Foot:InFloatTable");
return from_ascii("Foot");
}
@ -54,7 +58,13 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype)
}
intitle_ = false;
for (size_type sl = 0 ; sl < it.depth() ; ++ sl) {
infloattable_ = false;
bool intable = false;
if (it.innerInsetOfType(TABULAR_CODE) != 0)
intable = true;
if (it.innerInsetOfType(FLOAT_CODE) != 0)
infloattable_ = intable;
for (size_type sl = 0 ; sl < it.depth() ; ++sl) {
if (it[sl].text() && it[sl].paragraph().layout().intitle) {
intitle_ = true;
break;

View File

@ -48,6 +48,8 @@ private:
docstring custom_label_;
///
bool intitle_;
///
bool infloattable_;
};

View File

@ -3427,7 +3427,7 @@ void Tabular::validate(LaTeXFeatures & features) const
// Tell footnote that we need a savenote
// environment in non-long tables or
// longtable headers/footers
if (!is_long_tabular)
else if (!is_long_tabular && !features.inFloat())
features.saveNoteEnv("tabular");
else if (!isValidRow(cellRow(cell)))
features.saveNoteEnv("longtable");