Closed eg9 closed 1 year ago
Actually, with spanish
they already are language dependent, and the manual explains how to disable them (with a @
-command, which is admittedly clumsy, but there it is), so it’s certainly possible to make a Spanish/Ukrainian document, although not without some action from the user, which isn’t good.
Note russian
is supported here: https://github.com/kia999/babel-russian. As to Ukrainian, I’m not sure if it’s supported.
I’ll investigate if there is something wrong in the babel
core.
Something that bothered me as well: https://tex.stackexchange.com/questions/611161/different-behavior-of-gcd-analogs-within-babel-russian-and-serbianc.
I think locales' authors must be driven, pushed and encouraged to reach certain level of consistency.
@ivankokan Definitely.
I’ll report it to the maintainer of the russian
style, because it also bombs if the user defines their own \tg
in the preamble. I think, like @eg9, they must be language dependent (as in spanish
and serbianc
[edit: with serbianc
sometimes are global and sometimes are local]) or, at least and if done globally, activated only if the language is the main one.
In the case of spanish
, there is a workaround:
\documentclass{article}
\usepackage[T2A, T1]{fontenc}
\usepackage[ukrainian,spanish]{babel}
\let\savemathspanish\mathspanish
\let\mathspanish\relax
\AtBeginDocument{%
\let\mathspanish\savemathspanish
\selectlanguage{spanish}}
\usepackage{amsmath}
\begin{document}
$\lim\tg$ \foreignlanguage{ukrainian}{$\lim\tg$} $\lim\tg$
\end{document}
It prints “lím tg lim tg lím tg”.
But with serbianc
it’s not so easy, because the ‘switcher’ isn’t isolated from the rest of \extras...
.
TBH, I have always missed some indication/example of a properly made ldf.
Multiscript languages seem to be good candidates for such thing, is there any 100%-perfect?
I expanded the corresponding section in the manual a long ago (§ 3) with several recommendations, but perhaps not comprehensive enough.
Here is a workaround for serbianc
:
\documentclass{article}
\usepackage[T2A, T1]{fontenc}
\usepackage[ukrainian,serbianc]{babel}
\AddBabelHook[serbianc]{fix-ops}{afterextras}{%
\let\sh\relax
\let\ch\relax
\let\tg\relax
\let\ctg\relax
\let\arctg\relax
\let\arcctg\relax
\let\cth\relax
\let\cosec\relax}
\AtBeginDocument{\DisableBabelHook{fix-ops}}
\usepackage{amsmath}
\begin{document}
$\lim\tg$ \foreignlanguage{ukrainian}{$\lim\tg$} $\lim\tg$
\end{document}
Actually, this applies the definitions for Ukrainian, but they are similar. If they were different, they would have to be saved in afterextras
and restored in \AtBeginDocument
.
I’m closing this issue because the maintainer of russian
and the maintainer of ukrainian
have been informed.
Languages such as Spanish, Ukrainian, Russian and perhaps some more define “language local” math operators due to national mathematical traditions.
For instance they all define (in different ways)
\tg
for the tangent function, with the consequence thatfails when the
\AtBeginDocument
code ofukraineb.ldf
tries to do\DeclareMathOperator{\tg}{tg}
, becausespanish.ldf
defines it at the outer level. The error doesn't occur whenamsmath
is not loaded, because in that caserussianb.ldf
does\DeclareRobustCommand{\tg}{...}
. However, this only shifts the issue, because the definition for Ukrainian overrides the one for Spanish. With previous versions ofukraineb.ldf
, it would be Spanish to get over, becauseukraineb.ldf
didn't do the definitions at begin document. Source: https://tex.stackexchange.com/q/672982/4427In a bilingual Spanish/Ukrainian document using math, it would be funny to have “lím” for a limit in a Ukrainian language part.1 Such “localizations” should really be part of the language settings, done in
\extras<language>
maybe with the possibility of importing them at the outer level, if needed and safe (this depends on the loaded languages).In any case, within the current state of
babel
it's impossible to make a Spanish/Ukrainian document.2Footnotes.
1 In my opinion, Spanish should not use accents in math operators, which are symbols from abbreviations of Latin words, not Spanish ones. But I know that going against tradition is hard.
2 The same holds for Russian instead of Ukrainian.