Juergen Spitzmueller wrote:

> Georg Baum wrote:
>> I don't understand. Maybe we do not talk about the same thing? This is my
>> test document: All footnotes appear and none is swallowed.
>> Maybe you mean that they may not appear on the same page where the table
>> is?
> 
> Not only that. For me, some footnotes of your test document appear at the
> _top_ of another page.

I think the reason for that is the big vspace*.

>> That is of course possible. So maybe we should not enable them for
>> floats?
> 
> I think so.

Then I propose to put this patch (1.4 version) in trunk and 1.4. OK?


Georg

Log:

Fix bug 808
        * src/LaTeXFeatures.C
        (simplefeatures): Add footnote

        * src/tabular.C
        (LyXTabular::validate): request LaTeX support code for footnotes if
        the table contains one or more footnotes

        * src/LaTeXFeatures.[Ch]
        addExternalPreamble: rename to addPreambleSnippet

        * src/insets/insetexternal.C
        (InsetExternal::validate): Adjust to the name change above
Index: src/LaTeXFeatures.C
===================================================================
--- src/LaTeXFeatures.C	(Revision 15167)
+++ src/LaTeXFeatures.C	(Arbeitskopie)
@@ -161,7 +161,7 @@ bool LaTeXFeatures::isAvailable(string c
 }
 
 
-void LaTeXFeatures::addExternalPreamble(string const & preamble)
+void LaTeXFeatures::addPreambleSnippet(string const & preamble)
 {
 	FeaturesList::const_iterator begin = preamble_snippets_.begin();
 	FeaturesList::const_iterator end   = preamble_snippets_.end();
@@ -243,6 +243,7 @@ char const * simplefeatures[] = {
 	"fancybox",
 	"calc",
 	"tipa",
+	"footnote",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
Index: src/insets/insetexternal.C
===================================================================
--- src/insets/insetexternal.C	(Revision 15167)
+++ src/insets/insetexternal.C	(Arbeitskopie)
@@ -785,7 +785,7 @@ void InsetExternal::validate(LaTeXFeatur
 	for (; it != end; ++it) {
 		string const preamble = etm.getPreambleDefByName(*it);
 		if (!preamble.empty())
-			features.addExternalPreamble(preamble);
+			features.addPreambleSnippet(preamble);
 	}
 }
 
Index: src/LaTeXFeatures.h
===================================================================
--- src/LaTeXFeatures.h	(Revision 15167)
+++ src/LaTeXFeatures.h	(Arbeitskopie)
@@ -62,7 +62,7 @@ public:
 	/// Print requirements to lyxerr
 	void showStruct() const;
 	///
-	void addExternalPreamble(std::string const &);
+	void addPreambleSnippet(std::string const &);
 	/// Provide a string name-space to the requirements
 	void require(std::string const & name);
 	/// Which of the required packages are installed?
Index: src/tabular.C
===================================================================
--- src/tabular.C	(Revision 15167)
+++ 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 +2595,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 +2603,24 @@ void LyXTabular::validate(LaTeXFeatures 
 			features.require("array");
 		getCellInset(cell)->validate(features);
 	}
+	if (isLongTabular())
+		features.require("longtable");
+	else {
+		// FIXME: Move this code to InsetFoot
+		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.addPreambleSnippet(
+						"\\makesavenoteenv{tabular}\n");
+					return;
+				}
+			}
+		}
+	}
 }
 
 
Index: status.14x
===================================================================
--- status.14x	(Revision 15170)
+++ status.14x	(Arbeitskopie)
@@ -31,6 +31,8 @@ What's new
 
 * Document Input/Output
 
+- Footnotes in tables do appear now in the output (bug 808)
+
 
 * User Interface:
 

Reply via email to