X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=38ca643400698da1c4247edc177423ac02437896;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=5522c705a0bee0baa259f907f7d0ca66e5886da1;hpb=0dd3311dd42996f9aede7d8c58b27937ebb48b54;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 5522c705a0..38ca643400 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -461,6 +461,7 @@ BufferParams::BufferParams() output_sync = false; use_refstyle = true; + use_minted = false; // map current author author_map_[pimpl_->authorlist.get(0).bufferId()] = 0; @@ -865,7 +866,11 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> is_math_indent; } else if (token == "\\math_indentation") { lex.next(); - pimpl_->mathindent = Length(lex.getString()); + string mathindent = lex.getString(); + if (mathindent == "default") + pimpl_->mathindent = Length(); + else + pimpl_->mathindent = Length(mathindent); } else if (token == "\\math_numbering_side") { string tmp; lex >> tmp; @@ -1095,6 +1100,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> output_sync_macro; } else if (token == "\\use_refstyle") { lex >> use_refstyle; + } else if (token == "\\use_minted") { + lex >> use_minted; } else { lyxerr << "BufferParams::readToken(): Unknown token: " << token << endl; @@ -1302,6 +1309,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const << "\n\\suppress_date " << convert(suppress_date) << "\n\\justification " << convert(justification) << "\n\\use_refstyle " << use_refstyle + << "\n\\use_minted " << use_minted << '\n'; if (isbackgroundcolor == true) os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n'; @@ -1373,8 +1381,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const else os << "\n\\defskip " << getDefSkip().asLyXCommand(); os << "\n\\is_math_indent " << is_math_indent; - if (is_math_indent && !getMathIndent().empty()) - os << "\n\\math_indentation " << getMathIndent().asString(); + if (is_math_indent) + os << "\n\\math_indentation " + << (getMathIndent().empty() ? "default" : getMathIndent().asString()); os << "\n\\math_numbering_side "; switch(math_numbering_side) { case LEFT: @@ -2253,10 +2262,19 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, } if (features.isRequired("bicaption")) os << "\\usepackage{bicaption}\n"; - if (!listings_params.empty() || features.mustProvide("listings")) - os << "\\usepackage{listings}\n"; + if (!listings_params.empty() + || features.mustProvide("listings") + || features.mustProvide("minted")) { + if (features.mustProvide("listings")) + os << "\\usepackage{listings}\n"; + else + os << "\\usepackage{minted}\n"; + } if (!listings_params.empty()) { - os << "\\lstset{"; + if (features.mustProvide("listings")) + os << "\\lstset{"; + else + os << "\\setminted{"; // do not test validity because listings_params is // supposed to be valid string par = @@ -2353,7 +2371,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, } docstring const i18npreamble = - features.getTClassI18nPreamble(use_babel, use_polyglossia); + features.getTClassI18nPreamble(use_babel, use_polyglossia, + use_minted); if (!i18npreamble.empty()) os << i18npreamble + '\n';