# Angular frequency in siunitx

When using siunitx, is there an intuitive way to type angular frequencies with the prefix 2\pi \times? The provided example

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI{2\pi x 100}{\mega\hertz}
\end{document}


yields So is there a neat way to supress the first unit?

• You can use the [parse-numbers=false] to leave the number intact but if you have 2pi factor I think you are looking for rad/s no? – percusse Apr 11 '13 at 8:04
• @percusse No, then the  x  is not parsed as a \times command. The 2\pi is just a helpful way to avoid confusion whether the angular or the bare frequency is used, if you want to avoid to specify this in each instance used. – jjdb Apr 11 '13 at 17:06
• But you are making things difficult for siunitx since you both want parsing but also don't want the great functionality when you write 3m x 5m. So \times is needed there if you don't want the parsing. Also I wouldn't call it a helpful way. We are constantly correcting this behavior in the papers. Units are not ambiguous. 100 Mrad/s is precisely what you wrote. 100 MHz is the bare number. Note that I didn't write any 2pi factor in any of them. – percusse Apr 11 '13 at 17:36
• @percusse you are totally right that the correct SI unit is \radian\per\second, and I think I would certainly use it to write an angular frequency describing a real rotation. But consider a harmonic oscillator, or LC circuit if you want, the rad/s unit is confusing. Actually, I can not remember having seen it anywhere in usage in physics, at least not within my community. – jjdb Apr 11 '13 at 19:52
• I have to agree, in physics, writing omega = 2pi x f is the common way of writing these two things, because it includes both, frequency and angular freqency, at once and because this way there's no chance to confuse them. – Foo Bar Apr 13 '13 at 9:34

This:

${2\pi \times \SI{100}{\mega\hertz}}$


Or this:

\newcommand*{\angfreq}  {2\pi \times \SI{#1}{#2\hertz}}
\angfreq{5}{\mega} % gives "2pi x 5 Mhz"
\angfreq{8}{\kilo} % gives "2pi x 8 khz"


With both ways you avoid situations where product-units=single as a global option would give wrong results on other values and you avoid repeating this option on every single angular frequency when not using it as a global option.

• Ok, this solves the problem for the \mega\hertz. But then I need to define another one for \kilo\hertz, \giga\hertz etc. – jjdb Apr 11 '13 at 17:08
• I changed the code a bit. Just pass two arguments to \angfreq, the first is the number, the second is the frequency. – Foo Bar Apr 11 '13 at 17:11
• I think this is quite the workaround I've wanted. Still I feel strange having a common framework for all other units, and needing a special command for angular frequencies – jjdb Apr 12 '13 at 21:44
• But 2pi x is no unit, so I think it's just natural that you need something special for this. The "unit way" for angular frequencies would be rad/s (talking sloppy: rad basically means x 2pi). – Foo Bar Apr 13 '13 at 9:16
• @SvendTveskæg Good idea, I changed it this way. – Foo Bar Apr 14 '13 at 13:09

Isn't the following all you need or am I missing something?

\documentclass{article}

\usepackage{siunitx}

\begin{document}

\SI[product-units = single]{2\pi x 100}{\MHz}

\end{document} • But he's also using other values and units, which could be wrong this way, if the option is set globally. And always typing [product-units=single] on every single angular frequency locally can also be rather annoying if you have many of them. – Foo Bar Apr 13 '13 at 9:31
• I see; good point. – Svend Tveskæg Apr 13 '13 at 9:36
• But I can use the option also for each \SI where I need it, or choose globally one option for the case used the most, and switch for the others. That's perfect, thanks. – jjdb Apr 14 '13 at 9:23

The solution for me is the following: I can choose the default behaviour when calling the package, and control then for each call of \SI the output where it deviates from the default.

\documentclass{article}
\usepackage[product-units=repeat]{siunitx}
\begin{document}
\SI[product-units=single]{2\pi x 100}{\mega\hertz}

\SI{2 x 2}{\meter}
\end{document}


gives the desired output: EDIT

The usage as such is preferred to plain writing as we have access to all the features of the siunitx package, such as preventing line breaks etc.

\documentclass[twocolumn]{article}
\usepackage{siunitx}
\begin{document}
This is text which should induce a line break
\SI[product-units=single]{2\pi x 100}{\mega\hertz}

This is text which should induce a line break
$2 \times \SI{100}{\mega\hertz}$
\end{document} • I don't really see why this is better than $2\pi \times \SI{100}{\mega\hertz}$ or a new command, which both would even be shorter and more clear and without the need of repeated command options. – Foo Bar Apr 14 '13 at 9:35
• I've added an example where I compared the solutions for line breaking. – jjdb Apr 14 '13 at 9:46
• Curly brackets in math avoid line breaking: ${2\pi \times \SI{1}{\hertz}}$ will never linebreak. – Foo Bar Apr 14 '13 at 9:46
• Ok, I didn't know that one. But than, you have to add it manually for every use. I thought it is one of the purposes of the package to write all quantities with \num and \SI just to have better control of the behaviour. – jjdb Apr 14 '13 at 9:49
• You only have to add it when it actually breaks, which will happen very rarely (proof-reading is a must with LaTeX in all cases). Or add it to the self-defined command, then it will always be there. Speaking semantically as a physicist myself, I don't think that 2pi belongs to the physical quantity. It's only a mathematical factor, it's neither the unit nor the value. Taking something "times 2pi" is a mathematical operation. – Foo Bar Apr 14 '13 at 9:53