git.iko.soy/typeable/pandoc
on master help sign in
latex template: disable language-specific shorthands in babel.

Babel defines "shorthands" for some languages, and these can produce unexpected results. For example, in Spanish, `1.22` gets rendered as `122`, and `et~al.` as `etal`. One would think that babel's `shorthands=off` option (which we were using) would disable these, but it doesn't. So we remove `shorthands=off` and add some code that redefines the shorthands macro. Eventually this will be fixed in babel, I hope, and we can revert to something simpler. Closes #6817, closes #6887.

commite26d31d56bc61553d5d6153f2130184643869877 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 25 Nov 2020, 08:25 (6 years ago) parentbfb2a49
2 files changed+8−2
data/templates/default.latex+4−1 test/writers-lang-and-dir.latex+4−1
data/templates/default.latex+4−1
@@ -336,7 +336,10 @@ $for(polyglossia-otherlangs)$
336336 \setotherlanguage[$for(polyglossia-otherlangs.options)$$polyglossia-otherlangs.options$$sep$,$endfor$]{$polyglossia-otherlangs.name$}
337337$endfor$
338338\else
339− \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
339+ \usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
340+% get rid of language-specific shorthands (see #6817):
341+\let\LanguageShortHands\languageshorthands
342+\def\languageshorthands#1{}
340343$if(babel-newcommands)$
341344 $babel-newcommands$
342345$endif$
test/writers-lang-and-dir.latex+4−1
@@ -56,7 +56,10 @@
5656 \setotherlanguage[]{spanish}
5757 \setotherlanguage[]{french}
5858\else
59− \usepackage[shorthands=off,ngerman,british,nswissgerman,spanish,french,main=english]{babel}
59+ \usepackage[ngerman,british,nswissgerman,spanish,french,main=english]{babel}
60+% get rid of language-specific shorthands (see #6817):
61+\let\LanguageShortHands\languageshorthands
62+\def\languageshorthands#1{}
6063 \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
6164 \newenvironment{german}[2][]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
6265 \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}