]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Preamble.cpp
Remove wmf2eps as EMF > EPS converter
[lyx.git] / src / tex2lyx / Preamble.cpp
index 6324a91c7930276c7a377e0afe165e6a86a13c6f..ea315dd156677da80c165acdce4cbe8e97c5fed9 100644 (file)
@@ -183,9 +183,10 @@ const char * const known_xetex_packages[] = {"arabxetex", "fixlatvian",
 const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb",
 "amstext", "amsthm", "array", "babel", "booktabs", "calc", "CJK", "color",
 "float", "fontspec", "framed", "graphicx", "hhline", "ifthen", "longtable",
-"makeidx", "multirow", "nomencl", "pdfpages", "prettyref", "refstyle", "rotating",
-"rotfloat", "splitidx", "setspace", "subscript", "textcomp", "tipa", "tipx",
-"tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor", "xunicode", 0};
+"makeidx", "minted", "multirow", "nomencl", "pdfpages", "prettyref", "refstyle",
+"rotating", "rotfloat", "splitidx", "setspace", "subscript", "textcomp", "tipa",
+"tipx", "tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor",
+"xunicode", 0};
 
 // codes used to remove packages that are loaded automatically by LyX.
 // Syntax: package_beg_sep<name>package_mid_sep<package loading code>package_end_sep
@@ -554,6 +555,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_use_hyperref            = "false";
        h_use_microtype           = "false";
        h_use_refstyle            = false;
+       h_use_minted              = false;
        h_use_packages["amsmath"]    = "1";
        h_use_packages["amssymb"]    = "0";
        h_use_packages["cancel"]     = "0";
@@ -990,7 +992,9 @@ void Preamble::handle_package(Parser &p, string const & name,
        else if (is_known(name, known_lyx_packages) && options.empty()) {
                if (name == "splitidx")
                        h_use_indices = "true";
-               if (name == "refstyle")
+               else if (name == "minted")
+                       h_use_minted = true;
+               else if (name == "refstyle")
                        h_use_refstyle = true;
                else if (name == "prettyref")
                        h_use_refstyle = false;
@@ -1261,7 +1265,8 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
           << "\\paperorientation " << h_paperorientation << '\n'
           << "\\suppress_date " << h_suppress_date << '\n'
           << "\\justification " << h_justification << '\n'
-          << "\\use_refstyle " << h_use_refstyle << '\n';
+          << "\\use_refstyle " << h_use_refstyle << '\n'
+          << "\\use_minted " << h_use_minted << '\n';
        if (!h_fontcolor.empty())
                os << "\\fontcolor " << h_fontcolor << '\n';
        if (!h_notefontcolor.empty())
@@ -1700,7 +1705,7 @@ void Preamble::parse(Parser & p, string const & forceclass,
                                h_math_numbering_side = "right";
                                opts.erase(it);
                        }
-                       
+
                        // paper orientation
                        if ((it = find(opts.begin(), opts.end(), "landscape")) != opts.end()) {
                                h_paperorientation = "landscape";
@@ -1785,13 +1790,19 @@ void Preamble::parse(Parser & p, string const & forceclass,
                }
 
                else if (t.cs() == "newtheorem") {
+                       bool star = false;
+                       if (p.next_token().character() == '*') {
+                               p.get_token();
+                               star = true;
+                       }
                        string const name = p.getArg('{', '}');
                        string const opt1 = p.getFullOpt();
                        string const opt2 = p.getFullOpt();
                        string const body = p.verbatim_item();
                        string const opt3 = p.getFullOpt();
+                       string const cmd = star ? "\\newtheorem*" : "\\newtheorem";
 
-                       string const complete = "\\newtheorem{" + name + '}' +
+                       string const complete = cmd + "{" + name + '}' +
                                          opt1 + opt2 + '{' + body + '}' + opt3;
 
                        add_known_theorem(name, opt1, !opt2.empty(), from_utf8(complete));
@@ -2007,7 +2018,7 @@ void Preamble::parse(Parser & p, string const & forceclass,
        if (!forceclass.empty())
                h_textclass = forceclass;
        tc.setName(h_textclass);
-       if (!tc.load()) {
+       if (!LayoutFileList::get().haveClass(h_textclass) || !tc.load()) {
                cerr << "Error: Could not read layout file for textclass \"" << h_textclass << "\"." << endl;
                exit(EXIT_FAILURE);
        }