TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The siunitx package provides support for "astronomy style" placement of the degree symbol using the angle-symbol-over-decimal switch, and for simple entry of degree-minutes-second values using the form


Is there a way to used the package's \DeclareSIUnit macro to define a corresponding formatting for right ascension so that, for example, one could use something like


to produce (roughly)

enter image description here

with spacing and other behavior that follows the packages current settings for \ang?

share|improve this question
up vote 9 down vote accepted

Reading the siunitx manual ( 5.15 “Symbols”, pp. 62/63) one can find two ways to achieve this:

  1. Redefinition of \SIUnitSymbolDegree, -Arcminute and -Arcsecond
  2. Using the options text-/math-degree, -arcminute and -arcsecond ( Table 43, p. 63)

For both cases applies:

The new macro \ra takes two arguments:

  • one optional that gets passed to \ang and
  • one mandatory (the angle itself).

All “arc format” options (angle-symbol-over-decimal, arc-separator, …) can be given to \ra, too.

Solution 1

\newcommand*{\ra}[2][]{{% extra pair of braces to keep the \def-intion local!

Solution 2




\newcommand*{\ra}[2][]{{% extra pair of braces for solution 1, doesn't hurt for solution 2
%   \def\SIUnitSymbolDegree{\textsuperscript{h}}%     Solution 1
%   \def\SIUnitSymbolArcminute{\textsuperscript{m}}%  Solution 1
%   \def\SIUnitSymbolArcsecond{\textsuperscript{s}}%  Solution 1
        math-degree=\textsuperscript{h},             % Solution 2
        text-degree=\textsuperscript{h},             % Solution 2
        math-arcminute=\textsuperscript{m},          % Solution 2
        text-arcminute=\textsuperscript{m},          % Solution 2
        math-arcsecond=\textsuperscript{s},          % Solution 2
        text-arcsecond=\textsuperscript{s},          % Solution 2
\ra[angle-symbol-over-decimal]{5.237}   \par
\ra{5.237}        \par \ra{5;15;6.5}    \par \vspace{2ex}
\ang{2.3;3.4;4.5} \par \ra{2.3;3.4;4.5} \par \ang{2.3;3.4;4.5} \par
\ra[angle-symbol-over-decimal,arc-separator=\,]{2.3}           \par \vspace{2ex}
$\ra[angle-symbol-over-decimal]{5.237} \quad \ra{5.237} \quad \ra{5;15;6.5}$



share|improve this answer
Excellent! And in addition, and to complete the set, if I want to be able to write something like \si{hourra} I'll need to additionally have \DeclareSIUnit\hourra{\textsuperscript{h}}; or is there a way to fold that into the definitions above (I'm using #2)? – raxacoricofallapatorius Nov 4 '12 at 2:02
@raxacoricofallapatorius You can certainly do that (minor correction, you'd need to use \si{\hourra}). Besides \ang/\ra, I would rather use the standard \hour because a superscript h would look weird, especially in something like \si{\hourra\per\anything}. – Qrrbrbirlbel Nov 4 '12 at 2:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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