6

The \AA and \aa macros are defined in latex.ltx as

\def \aa {\r a}
\def \AA {\r A}

This fails with the X2 encoding which has no Latin letters. Why didn't the LaTeX team revert to the following definition:

\DeclareTextSymbolDefault{\AA}{OT1}
\DeclareTextSymbolDefault{\aa}{OT1}
\DeclareTextCommand{\aa}{OT1}{\r a}
\DeclareTextCommand{\AA}{OT1}{\r A}

Here is a MWE (UPDATED):

\documentclass{article}
\usepackage[utf8]{inputenc} % source file encoding
\usepackage[X2,T2A]{fontenc} % cyrillic font encoding
%  \DeclareTextSymbolDefault{\AA}{OT1}
%  \DeclareTextSymbolDefault{\aa}{OT1}
%  \DeclareTextCommand{\aa}{OT1}{\r a}
%  \DeclareTextCommand{\AA}{OT1}{\r A}

\begin{document}%

\verb|\AA|=\AA
\verb|\aa|=\aa

\fontencoding{X2}\selectfont

\verb|\AA|=\AA
\verb|\aa|=\aa

\end{document}
psmears
  • 141
  • 3
    Good question, but for mixed input like that I'd just use a unicode engine and a font which supports both scripts and input Å directly. – Henri Menke Aug 08 '17 at 03:51
  • 3
    X2 is not a “proper” LaTeX font encoding, for the precise reason it doesn't contain the Latin alphabet. – egreg Aug 08 '17 at 08:28
  • 2
    as egreg says the reason it is X.. not T.. is because it doesn't follow the rules that underlie the assumptions in the code with respect to latin in the ascii positions and T1-compatible upper/lower case tables. That said something like you suggest would be possible but I have to ask, why would you expect \AA to work, if A does not work within the scope of that encoding? – David Carlisle Aug 08 '17 at 09:39
  • you do not show your output but I get this with tl2017 which seems to show \AA working OK??? – David Carlisle Aug 08 '17 at 09:44
  • @egreg: X2 encoding contains ancient slavonic letters. There are no enough slots for all such letters in T2* encodings. – Igor Kotelnikov Aug 08 '17 at 11:30
  • @DavidCarlisle: I have exactly same output as in your answer. – Igor Kotelnikov Aug 08 '17 at 11:31
  • @IgorKotelnikov so the example posted does not show any problem, you could have used an example that did not load babel-russian it woudl have been rather clearer. – David Carlisle Aug 08 '17 at 11:32
  • @DavidCarlisle: @DavidCarlisle: I have exactly same output as in your answer is case of russian-babel available from CTAN. But I experimented with forthcoming version where workaround for X2 encoding is removed. I believe that russian-babel is not a good place for such workaround. That's where my question raised from. – Igor Kotelnikov Aug 08 '17 at 11:42
  • Unicode and Opentype exist and are supported by XeTeX & LuaTeX.
  • – Martin Schröder Aug 08 '17 at 19:50