This surprisingly simple patch (for 1.4) fixes bug 808 (footnotes in tables)
which has been discussed several times. I do not consider this a file
format change, since footnotes should work even in tables and floats, so I
think it is suitable for 1.4. I do not know whether/how it interferes with
workarounds users may have for this problem, therefore I am not sure about
it.
Comments and testing wanted.
Georg
Index: src/LaTeXFeatures.C
===================================================================
--- src/LaTeXFeatures.C (Revision 15150)
+++ src/LaTeXFeatures.C (Arbeitskopie)
@@ -244,6 +244,7 @@ char const * simplefeatures[] = {
"fancybox",
"calc",
"tipa",
+ "footnote",
};
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
Index: src/insets/insetfloat.C
===================================================================
--- src/insets/insetfloat.C (Revision 15150)
+++ src/insets/insetfloat.C (Arbeitskopie)
@@ -24,6 +24,7 @@
#include "funcrequest.h"
#include "FuncStatus.h"
#include "gettext.h"
+#include "insetiterator.h"
#include "LaTeXFeatures.h"
#include "LColor.h"
#include "lyxlex.h"
@@ -277,6 +278,18 @@ void InsetFloat::validate(LaTeXFeatures
features.useFloat(params_.type);
InsetCollapsable::validate(features);
+ InsetIterator it =
+ inset_iterator_begin(*const_cast<InsetFloat *>(this));
+ InsetIterator const end =
+ inset_iterator_end(*const_cast<InsetFloat *>(this));
+ for (; it != end; ++it) {
+ if (it->lyxCode() == InsetBase::FOOT_CODE) {
+ features.require("footnote");
+ features.addExternalPreamble(
+ "\\makesavenoteenv{" + params_.type + "}\n");
+ return;
+ }
+ }
}
Index: src/tabular.C
===================================================================
--- src/tabular.C (Revision 15150)
+++ src/tabular.C (Arbeitskopie)
@@ -24,6 +24,7 @@
#include "BufferView.h"
#include "cursor.h"
#include "debug.h"
+#include "insetiterator.h"
#include "LaTeXFeatures.h"
#include "lyxlex.h"
#include "outputparams.h"
@@ -2594,8 +2598,6 @@ LyXTabular::getCellFromInset(InsetBase c
void LyXTabular::validate(LaTeXFeatures & features) const
{
features.require("NeedTabularnewline");
- if (isLongTabular())
- features.require("longtable");
if (needRotating())
features.require("rotating");
for (idx_type cell = 0; cell < numberofcells; ++cell) {
@@ -2604,6 +2606,23 @@ void LyXTabular::validate(LaTeXFeatures
features.require("array");
getCellInset(cell)->validate(features);
}
+ if (isLongTabular())
+ features.require("longtable");
+ else {
+ for (idx_type cell = 0; cell < numberofcells; ++cell) {
+ InsetBase & inset = *getCellInset(cell);
+ InsetIterator it = inset_iterator_begin(inset);
+ InsetIterator const end = inset_iterator_end(inset);
+ for (; it != end; ++it) {
+ if (it->lyxCode() == InsetBase::FOOT_CODE) {
+ features.require("footnote");
+ features.addExternalPreamble(
+ "\\makesavenoteenv{tabular}\n");
+ return;
+ }
+ }
+ }
+ }
}