Am Donnerstag, 24. März 2005 14:45 schrieb Jean-Pierre Chretien:
> 
> Hello Georg,
> 
> Attached is my round trip example:
> 
>  - start from appendix.lyx.orig (1 chapter, 1 appendix)
>  - export to appendix.tex
>  - convert to appendix.lyx using tex2lyx (fist to 241, then to 221).
>  
> Open appendix.lyx w/lyx-1.3.5: the marker is on the right place but it 
disappears
> as soon as you edit the file.

Yes, because LyX deletes empty paragraphs. I forgot that.

> What is the rule in 1.4: \start_of_appendix before or after \layout 
Chapter ?

It does not matter (both in 1.4 and 1.3), as long as the paragraph before 
Chapter contains a comment.
Of course the nicer place is after Chapter.

The attached patch adds a dummy comment to prevent the deletion of the 
empty paragraph. I don't like this, but neither the current solution nor 
the previous one handle \appendix commands as written by LyX correctly. 
Unfortunately I have no idea how to do this better at the moment, so I 
propose to apply this patch.


Georg
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/tex2lyx/ChangeLog lyx-1.4-cvs/src/tex2lyx/ChangeLog
--- lyx-1.4-clean/src/tex2lyx/ChangeLog	2005-03-27 19:27:47.000000000 +0200
+++ lyx-1.4-cvs/src/tex2lyx/ChangeLog	2005-03-27 19:27:16.000000000 +0200
@@ -1,3 +1,7 @@
+2005-03-27  Georg Baum  <[EMAIL PROTECTED]>
+
+	* text.C (parse_text): Really fix \start_of_appendix output
+
 2005-03-27  Georg Baum  <[EMAIL PROTECTED]>
 
 	* tex2lyx.C (read_syntaxfile): Don't use racy test with IsFileReadable
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/tex2lyx/text.C lyx-1.4-cvs/src/tex2lyx/text.C
--- lyx-1.4-clean/src/tex2lyx/text.C	2005-03-22 20:53:25.000000000 +0100
+++ lyx-1.4-cvs/src/tex2lyx/text.C	2005-03-27 19:03:33.000000000 +0200
@@ -1158,6 +1567,12 @@ void parse_text(Parser & p, ostream & os
 			// appendix in '\par\appendix\par\chapter{' would
 			// start too late.
 			context.check_layout(os);
+			// FIXME: This is a hack to prevent paragraph
+			// deletion if it is empty. Handle this better!
+			handle_comment(os,
+				"%dummy comment inserted by tex2lyx to "
+				"ensure that this paragraph is not empty",
+				context);
 			// Both measures above may generate an additional
 			// empty paragraph, but that does not hurt, because
 			// whitespace does not matter here.

Reply via email to