5

I have this document:

\documentclass{article}
\usepackage[OT1]{fontenc}
\usepackage{libertine}
%\UndeclareTextCommand{\l}{OT1}
%\DeclareTextSymbolDefault{\l}{T1}

%\UndeclareTextCommand{\AA}{OT1}
%\DeclareTextSymbolDefault{\AA}{T1}

%\let\oldAA\AA
%\renewcommand{\AA}{\begingroup\fontencoding{T1}\selectfont\oldAA\endgroup}

\usepackage{amsmath}
\usepackage{siunitx}

%\DeclareSIUnit{\angstrom}{\AA}

\begin{document}

This is Quantifiably Efficiently Ligatured Text.

\AA

\si{\angstrom}

\l

\capitalring{A}

\end{document}

As you can see, the ł character is misprinted. I got that sorted out in this question, which is the first two commented lines, taking that specific symbol from the T1 encoding. I'm having similar issues with the Å symbol through the siunitx package. This checks for the default encoding and selects either \AA or \capitalring{A}:

\str_if_eq:VnT \encodingdefault { OT1 }
  {
    \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_math_tl
      { \text { \AA } }
      { \text { \capitalring { A } } }
    \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_text_tl
      { \AA }
      { \capitalring { A } }
  }

Hence, the MWE above checking these commands. Problem is, I can't get the symbol to show properly through siunitx. The second pair of commented lines follows the fix I got from the ł issue. But that just freezes the LaTeX compiler. The third pair of commented lines fix the \AA command, but I can't seem to make siunitx use it (final commented line).

Is there any way for the siunitx package to use the T1 encoded \AA (which is exacltly what I need)? Note that I need OT1 encoding for cool ligatures (especially the Qu) displayed in the first sentence,a nd they disappear if I don't use OT1.

6

The command \AA is not encoding specific and this is the reason for the error: its definition is \r{A}. Unfortunately, the ring accent macro in OT1 encoding doesn't work well with the Libertine font, so you can adopt an ad hoc definition:

\documentclass{article}
\usepackage[T1,OT1]{fontenc}
\usepackage{libertine}

\usepackage{amsmath}
\usepackage{siunitx}

\DeclareSIUnit{\angstrom}{\mbox{\normalfont\AA}}

\UndeclareTextCommand{\l}{OT1}
\DeclareTextSymbolDefault{\l}{T1}

\makeatletter
\DeclareRobustCommand{\AA}{%
  \leavevmode
  \vbox{\ialign{##\cr
    \hidewidth\char'27 \hidewidth\cr
    \noalign{\nointerlineskip\kern-1.4ex}
    A\cr
  }}%
}
\makeatother


\begin{document}

This is Quantifiably Efficiently Ligatured Text.

\si{\angstrom}

\l

\end{document}

I'm afraid that \AA will not work in other font shapes (italic, especially). If you just use it for the angstrom unit (which you shouldn't, by the way), it's good.

enter image description here

  • Plus 1 for the example text – MaxNoe Oct 29 '15 at 13:39
  • What should I use for the ångström unit instead of \AA then? The siunitx package uses it, if it's not using \capitalring. – rubenvb Oct 29 '15 at 13:40
  • @rubenvb My comment was that the unit is deprecated, as far as I know. I read from Wikipedia: “The International Committee for Weights and Measures officially discourages its use, and it is not included in the European Union's catalogue of units of measure that may be used within its Internal Market.” (There's also a reference.) – egreg Oct 29 '15 at 13:52
  • @egreg Well, it's still in use in physics (at least those fields dealing with atomic sized... things). Just do a google scholar search and see for yourself. There's a little less than 5000 results using the word in conjunction with "size". I can't change what my peers read and write... – rubenvb Oct 29 '15 at 13:58
  • @rubenvb If nobody starts… – egreg Oct 29 '15 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.