]> git.lyx.org Git - features.git/commitdiff
Fix footnote output in tables outside floats and longtable header/footer
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 19 Nov 2017 07:57:58 +0000 (08:57 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 20 Nov 2017 08:49:10 +0000 (09:49 +0100)
Fixes: #808 (sic!), #5869
(cherry picked from commit 3affde3957ff29fb0543478e072427616eb9b049)

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

index 8161d9ce73d483965e1dceb95a2ac9da38f5b81f..7087e55442130c04f352dc06c1f10251da86bbcf 100644 (file)
 \TestPackage{float}
 \TestPackage{fontspec}
 \TestPackage{footmisc}
+\TestPackage{footnote}
 \TestPackage{forest}
 \TestPackage{framed}
 \TestPackage{geometry}
index 6a99ec482fce31c1fe2219d1ce961a2a22e50df8..93b6563b92e107179ce5dc822744cd28f5cb2e7d 100644 (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
index 92e48293cd28d15d4bf872f5dabef6cb60e5476f..c28d7958f6908e64ef3818b6fe518a25decfe618 100644 (file)
@@ -974,6 +974,7 @@ char const * simplefeatures[] = {
        "todonotes",
        "forest",
        "varwidth",
+       "footnote",
 };
 
 char const * bibliofeatures[] = {
index df071c671b2658419f439272d086eab7ae7167c7..72451ad8eeb80bc6505dba456d5f6fe7cd28ec64 100644 (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_;
 };
 
 
index 86c719ae65fc81ca0ed3e2554c7cf91b3db40dab..de00e8935e19abf6a416c7a2040f5b95d2645730 100644 (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
index 67110d2574853ce2197310e15c3182ceed8f595f..c04ecabb7843c1b12c7a724b10b7a51cf45e527e 100644 (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);
        ///
index 788858e189a2497d50f7c6d4892c5ca7192c4d21..032621d367fc60163456b97a4556d20a799f6f3e 100644 (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());
        }
 }