]> git.lyx.org Git - features.git/commitdiff
Allow footnotes in floating tables via tablefootnote package
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 19 Nov 2017 11:56:40 +0000 (12:56 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 20 Nov 2017 08:49:36 +0000 (09:49 +0100)
See #808.

(cherry picked from commit 5017a0a1c635ed8da2b1fce5e240d0e297cf1aaf)

lib/chkconfig.ltx
lib/doc/LaTeXConfig.lyx
lib/layouts/stdinsets.inc
src/LaTeXFeatures.cpp
src/insets/InsetFoot.cpp
src/insets/InsetFoot.h
src/insets/InsetTabular.cpp

index 7087e55442130c04f352dc06c1f10251da86bbcf..c31fb9228e43e1d4a64bec0188d920dba8710935 100644 (file)
 \TestPackage{subfig}
 \TestPackage{subscript}
 \TestPackage{Sweave}
+\TestPackage{tablefootnote}
 \TestPackage{tcolorbox}
 \TestPackage{textcomp}
 \TestPackage{thswitch}
index 93b6563b92e107179ce5dc822744cd28f5cb2e7d..10693d2e9a0a7f9977b8171a4511a3ee596f8122 100644 (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
index 90e59589204f3f0ca726a51d2559262fc88cb880..da91f1c189de06bbec652114e63a384f909e650c 100644 (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
index c28d7958f6908e64ef3818b6fe518a25decfe618..3f9eb6776267ab6fb3b0c00efb21a1c53d4d9898 100644 (file)
@@ -975,6 +975,7 @@ char const * simplefeatures[] = {
        "forest",
        "varwidth",
        "footnote",
+       "tablefootnote",
 };
 
 char const * bibliofeatures[] = {
index de00e8935e19abf6a416c7a2040f5b95d2645730..db7e1ac3314181d7c8aa3c411cec13d1ae67c161 100644 (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;
index c04ecabb7843c1b12c7a724b10b7a51cf45e527e..d032e04848fc7d38c817dfd15feb23136849cc81 100644 (file)
@@ -48,6 +48,8 @@ private:
        docstring custom_label_;
        ///
        bool intitle_;
+       ///
+       bool infloattable_;
 };
 
 
index 032621d367fc60163456b97a4556d20a799f6f3e..a49c5bf77d94b48e7cf5a0426be53058b4ca722c 100644 (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");