4

I have written my thesis using \numlist and \numrange (and the \SI variants thereof) from the siunitx package. In some cases, I have used these macros in math mode, for instance, $\phi = \numlist{0.5;0.6;0.7}$, in contrast to the very explicit advice in the siunitx manual that I only now see. With the default settings, this causes the list final separator to be printed in math text (i.e. italics). So I thought, no problem, I'll just wrap the separators in the \text{} macro from mathtools, problem solved. Unfortunately, this prevents line breaks from taking place inside the list or range, whether the list or range occurs in math mode or not.

So my question is, can I allow line breaks where I need them by changing siunitx settings, or do I have to go through my thesis and remove every \...range and \...list command from math mode, such that I can remove the \text{} around the list-separators?

Demo:

\documentclass[draft]{article}
\usepackage{siunitx}

\usepackage[showframe]{geometry}
\geometry{width=0.5in}

\setlength{\parindent}{0pt}

\begin{document}
\SIrange{750}{1000}{\kelvin} % Breaks

\SIlist{0.5;0.6;0.7}{\percent} % Breaks

$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break and italics

\sisetup{%
    range-phrase = {\text{ to }},
    list-separator = {\text{, }},
    list-final-separator = {\text{, and }},
    list-pair-separator = {\text{ and }},
}%


\SIrange{750}{1000}{\kelvin} % Doesn't break

\SIlist{0.5;0.6;0.7}{\percent} % Doesn't break

$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break
\end{document}
4

The message you link is indeed relevant.

\documentclass[draft]{article}
\usepackage{siunitx}

\setlength{\parindent}{0pt}

\begin{document}

\sisetup{%
  range-phrase = {\ \linebreak[0]\text{to}\ \nolinebreak},
  list-separator = {\text{, }},
  list-final-separator = {,\ \linebreak[0]\text{and }},
  list-pair-separator = {\ \text{and}\ },
  list-separator = {,\ \linebreak[0]}
}%

\parbox{0pt}{

\SIrange{750}{1000}{\kelvin} % Doesn't break

\SIlist{0.5;0.6;0.7}{\percent} % Doesn't break

$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break

}
\end{document}

The spaces so introduced will participate to stretching or shrinking in the line.

enter image description here

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.