]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Move bind file format tag to LyXAction.cpp, and rename it.
[lyx.git] / src / LaTeXFeatures.cpp
index 46afe7cc4a6e34bfa381438b5a9dd9917330f5cb..090a1d84d70328e58d753c86305f3c4cb6da23e0 100644 (file)
@@ -60,6 +60,11 @@ namespace lyx {
 static docstring const lyx_def = from_ascii(
        "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}");
 
+static docstring const lyx_hyperref_def = from_ascii(
+       "\\providecommand{\\LyX}{\\texorpdfstring%\n"
+       "  {L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}\n"
+        "  {LyX}}");
+
 static docstring const noun_def = from_ascii(
        "\\newcommand{\\noun}[1]{\\textsc{#1}}");
 
@@ -299,6 +304,7 @@ bool LaTeXFeatures::usePolyglossia() const
        return (lyxrc.language_package_selection == LyXRC::LP_AUTO)
                && isRequired("polyglossia")
                && isAvailable("polyglossia")
+               && !params_.documentClass().provides("babel")
                && this->hasPolyglossiaLanguages();
 }
 
@@ -575,7 +581,6 @@ char const * simplefeatures[] = {
        "framed",
        "soul",
        "textcomp",
-       "fixltx2e",
        "pmboxdraw",
        "bbding",
        "ifsym",
@@ -695,6 +700,12 @@ string const LaTeXFeatures::getPackages() const
        if (!params_.useNonTeXFonts && !loadAMSPackages().empty())
                packages << loadAMSPackages();
 
+       // fixltx2e must be loaded after amsthm, since amsthm produces an error with
+       // the redefined \[ command (bug 7233). Load is as early as possible, since
+       // other packages might profit from it.
+       if (mustProvide("fixltx2e"))
+               packages << "\\usepackage{fixltx2e}\n";
+
        // wasysym is a simple feature, but it must be after amsmath if both
        // are used
        // wasysym redefines some integrals (e.g. iint) from amsmath. That
@@ -843,8 +854,12 @@ docstring const LaTeXFeatures::getMacros() const
                        macros << papersizepdf_def << '\n';
        }
 
-       if (mustProvide("LyX"))
-               macros << lyx_def << '\n';
+       if (mustProvide("LyX")) {
+               if (isRequired("hyperref"))
+                       macros << lyx_hyperref_def << '\n';
+               else
+                       macros << lyx_def << '\n';
+       }
 
        if (mustProvide("noun"))
                macros << noun_def << '\n';