]> git.lyx.org Git - features.git/commitdiff
* tex2lyx/preamble.cpp:
authorJürgen Spitzmüller <spitz@lyx.org>
Fri, 20 Feb 2009 09:46:03 +0000 (09:46 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Fri, 20 Feb 2009 09:46:03 +0000 (09:46 +0000)
- 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

index a9b879a3200ef7341d68b81352b07f152e951681..490a8ed387a5d8a45c8e32ea852de3afd4777a16 100644 (file)
@@ -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();