This patch fixes the appendix problems Jean-Pierre reported. A test file is
also attached. OK to apply?
Georg
\documentclass[english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\begin{document}
\chapter{My first chapter}bla\appendix\chapter{My first appendix}bla
\appendix
bla\chapter{My second appendix}
\appendix
bla bla bla
\section{Conclusions}
blah blah blah
\appendix
bla
\appendix
\chapter{My last appendix}
end
\end{document}
Index: src/tex2lyx/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/ChangeLog,v
retrieving revision 1.87
diff -u -p -r1.87 ChangeLog
--- src/tex2lyx/ChangeLog 14 Mar 2005 17:34:57 -0000 1.87
+++ src/tex2lyx/ChangeLog 18 Mar 2005 08:40:59 -0000
@@ -1,3 +1,7 @@
+2005-03-18 Georg Baum <[EMAIL PROTECTED]>
+
+ * text.C (parse_text): Fix \start_of_appendix output
+
2005-03-11 Georg Baum <[EMAIL PROTECTED]>
* table.C (parse_table): handle nested tables
Index: src/tex2lyx/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/text.C,v
retrieving revision 1.53
diff -u -p -r1.53 text.C
--- src/tex2lyx/text.C 7 Mar 2005 12:30:44 -0000 1.53
+++ src/tex2lyx/text.C 18 Mar 2005 08:41:01 -0000
@@ -962,6 +1351,7 @@ void parse_text(Parser & p, ostream & os
t.cat() == catOther ||
t.cat() == catAlign ||
t.cat() == catParameter) {
+ // This translates "&" to "\\&" which may be wrong...
context.check_layout(os);
os << t.character();
}
@@ -1147,8 +1557,20 @@ void parse_text(Parser & p, ostream & os
}
else if (t.cs() == "appendix") {
- p.skip_spaces();
context.add_extra_stuff("\\start_of_appendix\n");
+ // We need to start a new paragraph. Otherwise the
+ // appendix in 'bla\appendix\chapter{' would start
+ // too late.
+ context.new_paragraph(os);
+ // We need to make sure that the paragraph is
+ // generated even if it is empty. Otherwise the
+ // appendix in '\par\appendix\par\chapter{' would
+ // start too late.
+ context.check_layout(os);
+ // Both measures above may generate an additional
+ // empty paragraph, but that does not hurt, because
+ // whitespace does not matter here.
+ eat_whitespace(p, os, context, true);
}
// Must attempt to parse "Section*" before "Section".