16

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?

16

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

  • 3
    I'd use \ensuremath in the definition, for safety – Joseph Wright Sep 12 '12 at 6:28

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.