4

My Problem: I see that siunitx needs Latex3 support. Unfortunately I don't have this support (with respect to using latex on a server for which I am not admin). An older version of siunitx.sty (2009/03/29 v2.0alpha) works for me until I want to use \ang. So

Hence

My Question: what is the explicit macro I need so that I can have \ang and continue using the older version of siunitx?

7

You need to use the units \degree, \arcminute and \arcsecond directly.

Here is a simple parser that acts similar to the current \ang macro.

Code

\documentclass{article}
\usepackage{siunitx}
\listfiles
\makeatletter
\def\ang{\kernel@ifnextchar[\ang@{\ang@[]}}
\def\ang@[#1]#2{\def\@tempb{[{#1}]}\@ang#2;;;\@nil}
\def\@ang#1;#2;#3;#4\@nil{%
  \@tempswatrue
  \@@ang{#1}{\degree}%
  \@@ang{#2}{\arcminute}%
  \@@ang{#3}{\arcsecond}%
}
\def\@@ang#1#2{%
  \edef\@tempa{#1}%
  \ifx\@tempa\@empty
   \if@tempswa
    \expandafter\SI\@tempb{0}{#2}%
   \fi
  \else
    \expandafter\SI\@tempb{#1}{#2}%
    \@tempswafalse
  \fi
}
\makeatother
\begin{document}
\ang{0.1} \quad \ang{1;2} \quad \ang{2;30;59}

\ang{;0.2} \quad \ang[symbols/math/degree=^?]{;;3} % just for fun, don't use this!
\end{document}

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 siunitx.sty    2009/03/29 v2.0alpha A comprehensive (SI) units package
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
   array.sty    2008/09/09 v2.4c Tabular extension package (FMi)
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
 pgfkeys.sty    
 pgfkeys.code.tex
  ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions

Output

enter image description here

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.