3

I have been using \textit for italic text in my work and also used \SI for numbers with units using the siunitx package. There is now an instance where I want the number and unit to be in italics, so I've written:

\textit{\SI[]{8}{\micro\meter}}

But it does not appear in italics. I can't understand from the help documentation which option to use. Any advice? I have not used \sisetup{} in the preamble either.

  • 3
    Why should it? By default siunitx complies to the si guidelines, aka units should always be upright so noone confuses them as variables – daleif Jul 24 '18 at 14:09
6

Simply use \sisetup{detect-all = true}

See the documentation on page 20:

The siunitx package controls the font used to print output independently of the surrounding material. The standard method is to ignore the surroundings entirely, and to use the current body fonts. However, the package can detect and follow surrounding bold, italic and font family changes.

\documentclass{article}
\usepackage{siunitx}

\begin{document}
    \SI{7}{\metre}

    %Change to detect-all = true
    \sisetup{detect-all = true}
    \textit{\SI{7}{\metre}}

    %Change it back to detect-none = true
    \sisetup{detect-none = true}
    \textit{\SI{7}{\metre}}
\end{document} 

enter image description here

The documentation also says on page 83:

The mathematical meaning of units also means that the shape, weight and family are important. Units are supposed to be typeset in an upright, medium weight serif font. Italic, bold and sans serif are all used mathematically to convey other meanings.

Maybe you should think over using italic units

  • Thanks, this works. It was actually part of a table, where the entire row, which includes this \Si information, is all in italics, because it is different from other rows for certain reasons. I will try to think of a better way to do it though, thanks – slew123 Jul 24 '18 at 14:50
  • @slew123 I would suggest highlighting that row in the table – Azor Ahai Jul 24 '18 at 18:49

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.