[Tex/LaTex] SI units for sheet resistance using siunitx

siunitx

I'm trying to get the package siunitx to output the units for sheet resistance (Ohm per square), with the square as a square box. My current solution (in text mode) is:

30-60 $\Omega/\square$

Which works, but I prefer to have it rendered using the \SI command, for code consistency. My closest approach within the SIunitx commands is

\SIrange{30}{60}{\Ohm/sq}

This doesn't output the box, but rather the letters sq. Simply using \square fails, since that is already defined as longhand for ^2. Is there any way to output the square symbol within SIunitx?

Best Answer

Following works:

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\DeclareSIUnit\sq{\ensuremath{\Box}}
\begin{document}
\SIrange{30}{60}{\ohm\per\sq} 
\end{document}

enter image description here

You can also customize the way in which the range is written using range-phrase = -- and range-units=single as in this code sample:

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\DeclareSIUnit\sq{\ensuremath\Box}
\begin{document}
\SIrange{30}{60}{\ohm\per\sq}


\SIrange[range-phrase = --,range-units=single]{30}{60}{\ohm\per\sq}

\SIrange[range-phrase = --,range-units=brackets]{30}{60}{\ohm\per\sq}

\end{document}

enter image description here