1

I have a question related to this one: How to line break a siunitx unit. In my case I have paragraphs where even with allow-number-unit-breaks=true no break happens in some cases (see example below). I can see why Latex has problems with that, as there are so many long units in one paragraph but it is not making me happy.

This is happening a couple of time during a 100 page long thesis, so I am looking for any fix to this that is better than manually inducing linebreaks before printing as I think that is really scary.

Thanks your taking the time, any help appreciated.

\documentclass{article}

\usepackage[version=3]{mhchem} 
\usepackage{amsmath}

\usepackage[
allow-number-unit-breaks=true   
]{siunitx}  

\DeclareSIUnit[]{\tco}{\text{$\textup{t}_{\textup{\ce{CO2}eq.}}$}}
\DeclareSIUnit[]{\teth}{\text{$\textup{t}_{\textup{Eth.}}$}}

\begin{document}

For the initial scenario assumptions, the conventional system yields emissions of \SI{5.00}{\tco\per\teth}, \SI{5.00}{\tco\per\teth} \SI{5.00000}{\tco\per\teth} \SI{5.00}{\tco\per\teth} \SI{5.00}{\tco\per\teth}the second system of \SI{5.00}{\tco\per\teth} and the third of \SI{10.7}{\tco\per\teth}, making the conventional system favourable in terms of emissions. 

\end{document}
1
  • If a line break between the number and the second part is allowed, then this is not a “number-unit” combination. Since it happens a couple of times, I'm pretty sure that rewording can help in getting good breaks.
    – egreg
    Jul 29 '19 at 13:59
1

The problem here really is that your units are very long. TeX doesn't want to do the offending line break in your MWE because it would be a bad one (you would get an Underfull \hbox). In order to get around this, I you could try to make your units shorter.

  • First off, your unit definition is a bit over-complicated. You can just use
    \DeclareSIUnit{\tco}{{t_{\ce{CO2}eq.}}}
    \DeclareSIUnit{\teth}{{t_{Eth.}}}
    
    with identical output.
  • If you don't mind the different style, you can use the option per-mode=symbol, which makes the unit a bit shorter. In your MWE, this is enough. It might not be in your real document, though.
  • An even shorter alternative is per-mode=fraction, though this may well be deemed too small or ugly, due to the nested subscript in your unit.
  • You could allow the exponent of your unit to be above its subscript (like for regular symbols) by omitting the outer group in the unit:
    \DeclareSIUnit{\tco}{t_{\ce{CO2}eq.}}
    \DeclareSIUnit{\teth}{t_{Eth.}}
    
  • You could make the unit symbols themselves a lot shorter, e.g.
    \DeclareSIUnit{\tco}{{t_c}}
    \DeclareSIUnit{\teth}{{t_e}}
    
    You could of course additionally omit the outer group and change per-mode, if you prefer.

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.