[Tex/LaTex] Defining a list and range of \ang values in siunitx

siunitx

The angle processing function \ang provided in siunitx
to print angles are printed in arc format with degree, arcmin and arcsec separated by semi-colons:

\ang{1;2;3}

Is it possible to define a macro for lists and ranges of angular quantities in a similar way as the \SIlist and \SIrange functions to handle lists and ranges of numbers?

Best Answer

Here is something to start with:

% arara: pdflatex

\documentclass{article}
\usepackage{siunitx}
\usepackage{xparse}
\NewDocumentCommand\angRange{O{} m m}{\SIrange[parse-numbers=false, #1]{\ang[parse-numbers=true]{#2}}{\ang[parse-numbers=true]{#3}}{}}

\begin{document}
    \noindent
    \angRange{2.67}{6;7;6.5} \\
    \angRange[number-angle-product = \,]{2.67}{6;7;6.5} \\
    \angRange{6;7;6.5}{-1;;} \\
    \angRange[arc-separator = \,]{6;7;6.5}{-1;;} \\   
    \angRange{-1;;}{;;-3} \\
    \sisetup{add-arc-degree-zero}
    \angRange{-1;;}{;;-3} \\
    \sisetup{add-arc-minute-zero}
    \angRange{-1;;}{;;-3} \\
    \sisetup{add-arc-second-zero}
    \angRange{-1;;}{;;-3} \\
    \angRange{45.697}{6;7;6.5} \\
    \angRange[angle-symbol-over-decimal]{45.697}{6;7;6.5} \\
    \angRange{2}{4} \\
    \angRange[range-units = brackets]{2}{4} \\
    %\angRange[range-units = repeat][]{2}{4} \\ % should not be used as it makes no sense here
    %\angRange[range-units = single][]{2}{4}\\ % should not be used as it makes no sense here
    \SIrange[range-units = single]{2}{4}{\degree}
\end{document}

enter image description here