Take the 2-minute tour ×
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.

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?

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

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

share|improve this answer
    
Thanks, this works perfectly! –  Frans Sep 12 '12 at 0:44
2  
I'd use \ensuremath in the definition, for safety –  Joseph Wright Sep 12 '12 at 6:28
    
@JosephWright: As you say, done. Thank you. –  Harish Kumar Sep 12 '12 at 12:35
add comment

Your Answer

 
discard

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.