11

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

  • Just out of curiosity: what is arara? – ScumCoder Jan 15 at 20:20
  • "Good question! arara is a TEX automation tool based on rules and directives. It is, in some aspects, similar to other well-known tools like latexmk and rubber. The key difference (and probably the selling point) might be the fact that arara aims at explicit instructions in the source code (in the form of comments) in order to determine what to do instead of relying on other resources, such as log file analysis. It is a different approach for an automation tool, and we have both advantages and disadvantages of such design." From the manual – LaRiFaRi Jan 16 at 8:16

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.