]> git.lyx.org Git - features.git/commitdiff
Fix misparsing of \usepackage in
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 6 Jan 2011 21:38:26 +0000 (21:38 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 6 Jan 2011 21:38:26 +0000 (21:38 +0000)
\@ifundefined{textcolor}{\usepackage{color}}{}

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37140 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/preamble.cpp

index 1c10c6a4e528fd9b21ff3267d11b87bf049aadc5..22ffcd976cb3c1026ad8d0a6b739d825326103d9 100644 (file)
@@ -1094,6 +1094,16 @@ void parse_preamble(Parser & p, ostream & os,
                        }
                }
 
+               else if (t.cs() == "@ifundefined") {
+                       // prevent misparsing of \usepackage if it is used
+                       // as an argument (see e.g. our own output of
+                       // \@ifundefined above)
+                       h_preamble << t.asInput();
+                       h_preamble << '{' << p.verbatim_item() << '}';
+                       h_preamble << '{' << p.verbatim_item() << '}';
+                       h_preamble << '{' << p.verbatim_item() << '}';
+               }
+
                else if (!t.cs().empty() && !in_lyx_preamble)
                        h_preamble << '\\' << t.cs();
        }