]> git.lyx.org Git - features.git/commitdiff
tex2lyx: lineno support
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 14 Jul 2019 07:41:17 +0000 (09:41 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:36 +0000 (15:48 +0200)
src/tex2lyx/Preamble.cpp
src/tex2lyx/Preamble.h
src/tex2lyx/TODO.txt

index 336a939dd206d6d5247bafefcf1c892410c53a31..3dc53c9638a39ae7f218483cb9ddc44be1c29a0e 100644 (file)
@@ -504,8 +504,7 @@ string remove_braces(string const & value)
 
 
 Preamble::Preamble() : one_language(true), explicit_babel(false),
-       title_layout_found(false), index_number(0), h_font_cjk_set(false),
-       h_use_microtype("false")
+       title_layout_found(false), index_number(0), h_font_cjk_set(false)
 {
        //h_backgroundcolor;
        //h_boxbgcolor;
@@ -599,6 +598,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_use_default_options     = "false";
        h_use_hyperref            = "false";
        h_use_microtype           = "false";
+       h_use_lineno              = "false";
        h_use_refstyle            = false;
        h_use_minted              = false;
        h_use_packages["amsmath"]    = "1";
@@ -1486,6 +1486,14 @@ void Preamble::handle_package(Parser &p, string const & name,
                        h_preamble << "\\usepackage[" << opts << "]{microtype}";
        }
 
+       else if (name == "lineno") {
+               h_use_lineno = "true";
+               if (!options.empty()) {
+                       h_lineno_options = join(options, ",");
+                       options.clear();
+               }
+       }
+
        else if (!in_lyx_preamble) {
                if (options.empty())
                        h_preamble << "\\usepackage{" << name << '}';
@@ -1678,7 +1686,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
           << "\\suppress_date " << h_suppress_date << '\n'
           << "\\justification " << h_justification << '\n'
           << "\\use_refstyle " << h_use_refstyle << '\n'
-          << "\\use_minted " << h_use_minted << '\n';
+          << "\\use_minted " << h_use_minted << '\n'
+          << "\\use_lineno " << h_use_lineno << '\n';
+       if (!h_lineno_options.empty())
+               os << "\\lineno_options " << h_lineno_options << '\n';
        if (!h_fontcolor.empty())
                os << "\\fontcolor " << h_fontcolor << '\n';
        if (!h_notefontcolor.empty())
index 1130ad2d5bbea252d6053a5414d0fe799015248a..0ec2b4581f4db9c7ce2b46288b100d78dd350e67 100644 (file)
@@ -178,6 +178,8 @@ private:
        bool h_font_cjk_set;
        std::string h_font_cjk;
        std::string h_use_microtype;
+       std::string h_use_lineno;
+       std::string h_lineno_options;
        std::string h_is_mathindent;
        std::string h_math_numbering_side;
        std::string h_mathindentation;
index 55c57f3949c07b051f2a4fb4d62c395c75c1ea5f..3c6693e3150d3cc2d6cc85faacfe3e36059e0a79 100644 (file)
@@ -34,7 +34,6 @@ Format LaTeX feature                        LyX feature
 443    unicode-math.sty                     InsetMath*
 453    automatic stmaryrd loading           \use_package stmaryrd
 457    automatic stackrel loading           \use_package stackrel
-575    numbering of lines (lineno)          \use_lineno, \lineno_options
 
 
 General