X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeXFeatures.cpp;h=6b23fc537b4f69d497235965e6d6df51d5d403a4;hb=90f7007a2e6c78ffd031e4636ff909ab1bc2ddec;hp=169f4e68737d616ce1d63b023eaa4ebc2b802ef5;hpb=29e64597d045e8cb6ebebb67de75835d128f6be3;p=lyx.git diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 169f4e6873..6b23fc537b 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -184,19 +184,19 @@ static docstring const changetracking_dvipost_def = from_ascii( "\\dvipost{osend color pop}\n" "\\dvipost{cbstart color push Blue}\n" "\\dvipost{cbend color pop}\n" - "\\newcommand{\\lyxadded}[3]{\\changestart#3\\changeend}\n" - "\\newcommand{\\lyxdeleted}[3]{%\n" + "\\DeclareRobustCommand{\\lyxadded}[3]{\\changestart#3\\changeend}\n" + "\\DeclareRobustCommand{\\lyxdeleted}[3]{%\n" "\\changestart\\overstrikeon#3\\overstrikeoff\\changeend}\n"); static docstring const changetracking_xcolor_ulem_def = from_ascii( "%% Change tracking with ulem\n" - "\\newcommand{\\lyxadded}[3]{{\\color{lyxadded}{}#3}}\n" - "\\newcommand{\\lyxdeleted}[3]{{\\color{lyxdeleted}\\sout{#3}}}\n"); + "\\DeclareRobustCommand{\\lyxadded}[3]{{\\color{lyxadded}{}#3}}\n" + "\\DeclareRobustCommand{\\lyxdeleted}[3]{{\\color{lyxdeleted}\\sout{#3}}}\n"); static docstring const changetracking_xcolor_ulem_hyperref_def = from_ascii( "%% Change tracking with ulem\n" - "\\newcommand{\\lyxadded}[3]{{\\texorpdfstring{\\color{lyxadded}{}}{}#3}}\n" - "\\newcommand{\\lyxdeleted}[3]{{\\texorpdfstring{\\color{lyxdeleted}\\sout{#3}}{}}}\n"); + "\\DeclareRobustCommand{\\lyxadded}[3]{{\\texorpdfstring{\\color{lyxadded}{}}{}#3}}\n" + "\\DeclareRobustCommand{\\lyxdeleted}[3]{{\\texorpdfstring{\\color{lyxdeleted}\\sout{#3}}{}}}\n"); static docstring const changetracking_none_def = from_ascii( "\\newcommand{\\lyxadded}[3]{#3}\n" @@ -327,7 +327,7 @@ LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p, {} -LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const +LaTeXFeatures::LangPackage LaTeXFeatures::langPackage() const { string const local_lp = bufferParams().lang_package; @@ -347,9 +347,6 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const * If babel is selected (either directly or via the "auto" * mechanism), we really do only require it if we have * a language that needs it. - * English alone normally does not require babel (since it is - * the default language of LaTeX). However, in some cases we - * need to surpass this exception (see Font::validate). */ bool const polyglossia_required = isRequired("polyglossia") @@ -357,8 +354,7 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const && !isProvided("babel") && this->hasOnlyPolyglossiaLanguages(); bool const babel_required = - ((englishbabel || bufferParams().language->lang() != "english") - && !bufferParams().language->babel().empty()) + !bufferParams().language->babel().empty() || !this->getBabelLanguages().empty(); if (local_lp == "auto") { @@ -474,6 +470,9 @@ bool LaTeXFeatures::isRequired(string const & name) const bool LaTeXFeatures::isProvided(string const & name) const { + if (params_.useNonTeXFonts) + return params_.documentClass().provides(name); + bool const ot1 = (params_.font_encoding() == "default" || params_.font_encoding() == "OT1"); bool const complete = (params_.fonts_sans == "default") @@ -490,10 +489,15 @@ bool LaTeXFeatures::isProvided(string const & name) const nomath) || theLaTeXFonts().getLaTeXFont( from_ascii(params_.fonts_typewriter)).provides(name, ot1, + complete, + nomath) + || theLaTeXFonts().getLaTeXFont( + from_ascii(params_.fonts_math)).provides(name, ot1, complete, nomath); } + bool LaTeXFeatures::mustProvide(string const & name) const { return isRequired(name) && !isProvided(name); @@ -842,6 +846,15 @@ string const LaTeXFeatures::getPackages() const params_.use_package("yhmath") != BufferParams::package_off) packages << "\\usepackage{yhmath}\n"; + // stmaryrd must be loaded after amsmath + if (mustProvide("stmaryrd") && + params_.use_package("stmaryrd") != BufferParams::package_off) + packages << "\\usepackage{stmaryrd}\n"; + + if (mustProvide("stackrel") && + params_.use_package("stackrel") != BufferParams::package_off) + packages << "\\usepackage{stackrel}\n"; + if (mustProvide("undertilde") && params_.use_package("undertilde") != BufferParams::package_off) packages << "\\usepackage{undertilde}\n"; @@ -1273,6 +1286,7 @@ docstring const LaTeXFeatures::getTClassHTMLStyles() const namespace { + docstring const getFloatI18nPreamble(docstring const & type, docstring const & name, Language const * lang, Encoding const & enc, bool const polyglossia)