]> git.lyx.org Git - features.git/commitdiff
Work around French babel's incompatibility with prettyref
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 11 Aug 2023 15:35:18 +0000 (17:35 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 11 Aug 2023 15:35:18 +0000 (17:35 +0200)
In classic (pdf)latex, where the colon is activated, detokenize
the argument of \prettyref.

Fix proposed by egreg at
https://tex.stackexchange.com/a/527912/19291

lib/languages
src/LaTeXFeatures.cpp

index 58c85ccfb47a879dcabe91e982f52ca737523856..3101ee3990aba31997803c2ffe04cdec1a814a9f 100644 (file)
@@ -498,6 +498,7 @@ Language canadien
        BabelName        acadian
        PolyglossiaName  french
        PolyglossiaOpts  "variant=canadian"
+       ActiveChars      ;!?:
        XindyName        french
        QuoteStyle       french
        Encoding         iso8859-15
@@ -705,6 +706,7 @@ Language french
        GuiName          "French"
        HasGuiSupport    true
        BabelName        french
+       ActiveChars      ;!?:
        PolyglossiaName  french
        XindyName        french
        QuoteStyle       french
index 364a4921e1ac13799cd76ab7853de9fa41f32ef0..0e678ea62a52af3d93fbc6af80cb1a6ca4aaf613 100644 (file)
@@ -1284,6 +1284,14 @@ string const LaTeXFeatures::getPackages() const
        // The rest of these packages are somewhat more complicated
        // than those above.
 
+       // Babel languages with activated colon (such as French) break
+       // with prettyref. Work around that.
+       if (!runparams_.isFullUnicode() && useBabel()
+           && mustProvide("prettyref") && contains(getActiveChars(), ':')) {
+               packages << "% Make prettyref compatible with babel active colon\n"
+                        << "\\def\\prettyref#1{\\expandafter\\@prettyref\\detokenize{#1:}}\n";
+       }
+
        if (mustProvide("changebar")) {
                packages << "\\usepackage";
                if (runparams_.flavor == Flavor::LaTeX