Closed wehro closed 3 years ago
Confirmed.
Thank you, @jbezos. \shorthandoff*{^}
and \shorthandon{^}
now work as expected.
But what is the reason the following code does not work?
\documentclass{article}
\usepackage[esperanto]{babel}
\def\Off{\shorthandoff*{^}}
\def\On{\shorthandon{^}}
\begin{document}
\Off
^^51 % the letter Q
$a^2+b^2=c^2$
\On
^c
$a^2+b^2=c^2$
\end{document}
Error message:
! Missing $ inserted.
<inserted text>
$
l.13 ^
c
Fixed (so I hope).
Both examples above now run without errors, but here is the next one which does not. :(
\documentclass{article}
\usepackage[esperanto,english]{babel}
\begin{document}
\shorthandoff*{^}
^^51 % the letter Q
$a^2+b^2=c^2$
\selectlanguage{esperanto}
\shorthandon{^}
^c
$a^2+b^2=c^2$
\end{document}
Error message:
! Missing $ inserted.
<inserted text>
$
l.11 ^
c
Fixed. (Have I finally managed to do it? 🙂.)
Fixed. (Have I finally managed to do it? slightly_smiling_face.)
Yes, everything seems to work now. Thanks.
An active
^
character (as defined by babel-esperanto and some other languages) may cause problems under certain circumstances. To turn this shorthand off, the babel manual advises to use\shorthandoff*{^}
(starred form) instead of\shorthandoff{^}
aiming to keep^
intact in math mode. However, when using the starred form, it seems not to be possible to turn^
on again with\shorthandon{^}
. I ran into this issue when experimenting with babel-latin, which I am revising at the moment, but for the sake of simplicity, let me demonstrate with Esperanto:Error message: