5

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.

1
  • 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
    Commented Jul 24, 2018 at 14:09

1 Answer 1

9

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

2
  • 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
    Commented Jul 24, 2018 at 14:50
  • @slew123 I would suggest highlighting that row in the table Commented Jul 24, 2018 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .