tex2lyx: lineno support

This commit is contained in:
Juergen Spitzmueller 2019-07-14 09:41:17 +02:00
parent 509551cae0
commit c4e90cec86
3 changed files with 16 additions and 4 deletions

View File

@ -504,8 +504,7 @@ string remove_braces(string const & value)
Preamble::Preamble() : one_language(true), explicit_babel(false), Preamble::Preamble() : one_language(true), explicit_babel(false),
title_layout_found(false), index_number(0), h_font_cjk_set(false), title_layout_found(false), index_number(0), h_font_cjk_set(false)
h_use_microtype("false")
{ {
//h_backgroundcolor; //h_backgroundcolor;
//h_boxbgcolor; //h_boxbgcolor;
@ -599,6 +598,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
h_use_default_options = "false"; h_use_default_options = "false";
h_use_hyperref = "false"; h_use_hyperref = "false";
h_use_microtype = "false"; h_use_microtype = "false";
h_use_lineno = "false";
h_use_refstyle = false; h_use_refstyle = false;
h_use_minted = false; h_use_minted = false;
h_use_packages["amsmath"] = "1"; h_use_packages["amsmath"] = "1";
@ -1486,6 +1486,14 @@ void Preamble::handle_package(Parser &p, string const & name,
h_preamble << "\\usepackage[" << opts << "]{microtype}"; 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) { else if (!in_lyx_preamble) {
if (options.empty()) if (options.empty())
h_preamble << "\\usepackage{" << name << '}'; h_preamble << "\\usepackage{" << name << '}';
@ -1678,7 +1686,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
<< "\\suppress_date " << h_suppress_date << '\n' << "\\suppress_date " << h_suppress_date << '\n'
<< "\\justification " << h_justification << '\n' << "\\justification " << h_justification << '\n'
<< "\\use_refstyle " << h_use_refstyle << '\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()) if (!h_fontcolor.empty())
os << "\\fontcolor " << h_fontcolor << '\n'; os << "\\fontcolor " << h_fontcolor << '\n';
if (!h_notefontcolor.empty()) if (!h_notefontcolor.empty())

View File

@ -178,6 +178,8 @@ private:
bool h_font_cjk_set; bool h_font_cjk_set;
std::string h_font_cjk; std::string h_font_cjk;
std::string h_use_microtype; std::string h_use_microtype;
std::string h_use_lineno;
std::string h_lineno_options;
std::string h_is_mathindent; std::string h_is_mathindent;
std::string h_math_numbering_side; std::string h_math_numbering_side;
std::string h_mathindentation; std::string h_mathindentation;

View File

@ -34,7 +34,6 @@ Format LaTeX feature LyX feature
443 unicode-math.sty InsetMath* 443 unicode-math.sty InsetMath*
453 automatic stmaryrd loading \use_package stmaryrd 453 automatic stmaryrd loading \use_package stmaryrd
457 automatic stackrel loading \use_package stackrel 457 automatic stackrel loading \use_package stackrel
575 numbering of lines (lineno) \use_lineno, \lineno_options
General General