From f8af5f804ef11b3237d1bbb6e7497842fb92df1f Mon Sep 17 00:00:00 2001 From: spitz Date: Fri, 20 Feb 2009 09:46:03 +0000 Subject: [PATCH] * tex2lyx/preamble.cpp: - fix thinko that caused tex2lyx to silently drop custom preamble entries in non-LyX-generated tex files. (bug 5788). Patch from Jean-Marc. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28567 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/preamble.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index a9b879a320..490a8ed387 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -397,10 +397,10 @@ void handle_package(Parser &p, string const & name, string const & opts, h_cite_engine = "jurabib"; else if (!in_lyx_preamble) { if (options.empty()) - h_preamble << "\\usepackage{" << name << "}\n"; + h_preamble << "\\usepackage{" << name << "}"; else { h_preamble << "\\usepackage[" << opts << "]{" - << name << "}\n"; + << name << "}"; options.clear(); } } @@ -469,7 +469,7 @@ void parse_preamble(Parser & p, ostream & os, special_columns['D'] = 3; bool is_full_document = false; bool is_lyx_file = false; - bool in_lyx_preamble = true; + bool in_lyx_preamble = false; // determine whether this is a full document or a fragment for inclusion while (p.good()) { @@ -527,10 +527,11 @@ void parse_preamble(Parser & p, ostream & os, } smatch sub; - if (regex_search(comment, sub, islyxfile)) + if (regex_search(comment, sub, islyxfile)) { is_lyx_file = true; - else if (is_lyx_file - && regex_search(comment, sub, usercommands)) + in_lyx_preamble = true; + } else if (is_lyx_file + && regex_search(comment, sub, usercommands)) in_lyx_preamble = false; else if (!in_lyx_preamble) h_preamble << t.asInput(); -- 2.11.4.GIT