3

How do I fit the numbers inside the textwidth without specifying manually a line break before each number?

problem

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

We compare our results against the recommended values of $F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = \SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis eum. Sint porro dolorem distinctio quae soluta quibusdam. Aut eligendi temporibus soluta molestiae. Iste hic commodi quia sint impedit porro. Corporis nemo ipsa qui voluptates omnis autem autem est. Maiores minima iure occaecati iusto. Pariatur quia aliquid et enim illo aliquam culpa explicabo.

\end{document}
  • 1
    You may find something helpful along these lines: tex.stackexchange.com/questions/67440/… – Matthias Arras Oct 20 '17 at 16:38
  • Hi, welcome. If all else fails, you could rewrite the sentence. For example We compare our results against the recommended values of $F$ and $e$, which are \SI{96485.33289(59)}{\coulomb\per\mol} and \SI{1.6021766208(98)e-19}{\coulomb}, respectively. (Or something else, I've never been good at coming up with good ways of phrasing things.) – Torbjørn T. Oct 20 '17 at 22:51
  • 2
    Please indicate where in 96485.33289(59) a line break should be made permissible. – Mico Oct 21 '17 at 11:07
  • 1
    @Mico I'd rather have \LaTeX figure out that it should break before the number if the number is going to run over the line end. – philmcole Oct 21 '17 at 13:28
  • @philmcole - In that case, all you need to do is provide the instruction \sloppy before the paragraph(s) in question. That, or encase the paragraph in question in \begin{sloppypar} and \end{sloppypar} directives. Be prepared to encounter, though, some sloppy-looking paragraphs. (To return to normal paragraph-setting modus after using \sloppy, issue the instruction \fussy.) – Mico Oct 21 '17 at 16:07
1

You wrote,

I'd rather have LaTeX figure out that it should break before the number if the number is going to run over the line end.

In that case, just issue the instruction \sloppy at the start of the paragraph that's featuring over-full lines. (To revert to normal later on, issue the directive \fussy.) That, or encase the paragraph in question in a sloppypar environment.

enter image description here

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,siunitx,xcolor}

\begin{document}

\textcolor{red}{\texttt{\string\sloppy}}
\begin{sloppypar}
We compare our results against the recommended values of 
$F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = 
\SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis 
eum. Sint porro dolorem distinctio quae soluta quibusdam. 
Aut eligendi temporibus soluta molestiae. Iste hic commodi 
quia sint impedit porro. 
\end{sloppypar}

\bigskip
\textcolor{red}{\texttt{\string\fussy}}
\par
We compare our results against the recommended values of 
$F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = 
\SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis 
eum. Sint porro dolorem distinctio quae soluta quibusdam. 
Aut eligendi temporibus soluta molestiae. Iste hic commodi 
quia sint impedit porro. 

\end{document}

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.