Am Montag, 31. Januar 2005 20:58 schrieb Angus Leeming:
> Trying a round trip on the user guide doesn't work ATM. Log file 
attached.

I introduced this bug when I changed the handling {\small bla} in tex2lyx. 
tex2lyx could write something like

\end_layout
\size normal
\begin_layout Standard

which is wrong. The attached patch fixes that. It assumes that font 
changes like

\size small

are local to a

\begin_layout ...
\end_layout

block. Please tell if if assumption is wrong, otherwise thsi will go in 
tomorrow.


BTW, Angus: Did you see my message on the docs list about documentation of 
the external inset? I'D value any comment you might have.


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-01-29 12:19:48.000000000 +0100
+++ lyx-1.4-cvs/src/tex2lyx/ChangeLog	2005-02-01 19:56:36.000000000 +0100
@@ -1,3 +1,8 @@
+2005-02-01  Georg Baum  <[EMAIL PROTECTED]>
+
+	* text.C (parse_text): Only reset font changes if not at the
+	beginning of a new layout
+
 2005-01-31  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* tex2lyx.C (main): enable tex2lyx to find the top level
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-01-06 20:28:51.000000000 +0100
+++ lyx-1.4-cvs/src/tex2lyx/text.C	2005-02-01 19:55:24.000000000 +0100
@@ -994,37 +1254,48 @@ void parse_text(Parser & p, ostream & os
 				; // ignore it in {}`` or -{}-
 			else if (s == "[" || s == "]" || s == "*")
 				os << s;
-			else if (is_known(next.cs(), known_sizes))
+			else if (is_known(next.cs(), known_sizes)) {
 				// s will change the size, so we must reset
 				// it here
-				os << s << "\n\\size " << context.font.size
-				   << "\n";
-			else if (is_known(next.cs(), known_font_families))
+				os << s;
+				if (!context.atParagraphStart())
+					os << "\\n\\size "
+					   << context.font.size << "\n";
+			} else if (is_known(next.cs(), known_font_families)) {
 				// s will change the font family, so we must
 				// reset it here
-				os << s << "\n\\family "
-				   << context.font.family << "\n";
-			else if (is_known(next.cs(), known_font_series))
+				os << s;
+				if (!context.atParagraphStart())
+					os << "\n\\family "
+					   << context.font.family << "\n";
+			} else if (is_known(next.cs(), known_font_series)) {
 				// s will change the font series, so we must
 				// reset it here
-				os << s << "\n\\series "
-				   << context.font.series << "\n";
-			else if (is_known(next.cs(), known_font_shapes))
+				os << s;
+				if (!context.atParagraphStart())
+					os << "\n\\series "
+					   << context.font.series << "\n";
+			} else if (is_known(next.cs(), known_font_shapes)) {
 				// s will change the font shape, so we must
 				// reset it here
-				os << s << "\n\\shape "
-				   << context.font.shape << "\n";
-			else if (is_known(next.cs(), known_old_font_families) ||
-			         is_known(next.cs(), known_old_font_series) ||
-			         is_known(next.cs(), known_old_font_shapes))
+				os << s;
+				if (!context.atParagraphStart())
+					os << "\n\\shape "
+					   << context.font.shape << "\n";
+			} else if (is_known(next.cs(), known_old_font_families) ||
+			           is_known(next.cs(), known_old_font_series) ||
+			           is_known(next.cs(), known_old_font_shapes)) {
 				// s will change the font family, series
 				// and shape, so we must reset it here
-				os << s
-				   <<  "\n\\family " << context.font.family
-				   << "\n\\series " << context.font.series
-				   << "\n\\shape "  << context.font.shape
-				   << "\n";
-			else {
+				os << s;
+				if (!context.atParagraphStart())
+					os <<  "\n\\family "
+					   << context.font.family
+					   << "\n\\series "
+					   << context.font.series
+					   << "\n\\shape "
+					   << context.font.shape << "\n";
+			} else {
 				handle_ert(os, "{", context, false);
 				// s will end the current layout and begin a
 				// new one if necessary

Reply via email to