[LyX/master] Work around French babel's incompatibility with prettyref
Juergen Spitzmueller
spitz at lyx.org
Fri Aug 11 14:23:45 UTC 2023
commit 858b076ab7aed3f41e7ad97f1a3a2fbf0589d7bf
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Fri Aug 11 17:35:18 2023 +0200
Work around French babel's incompatibility with prettyref
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 | 2 ++
src/LaTeXFeatures.cpp | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/lib/languages b/lib/languages
index 58c85cc..3101ee3 100644
--- a/lib/languages
+++ b/lib/languages
@@ -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
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 364a492..0e678ea 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -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
More information about the lyx-cvs
mailing list