10

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?

  • Please clarify, how this list should look like. As \ang and \SIlist both use a semicolon as separator, you should choose your preferred syntax. – LaRiFaRi Mar 23 '15 at 15:11
6

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

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.