I am sure this has probably come up before, but I cannot find it - I am guessing I might not be using the correct search terms?
Anyways, I have the term '4 \textcelsius' in my source file to get the term 4 °C. However, LaTeX insists on splitting 4 and °C on two separate lines. Is there any way of forcing it to put them together? I only seem to have this problem once as yet, so a solution that will work for one instances is more than perfect!
Thanks
Ann
Text Formatting ⇒ Prevent Separation of Number and Unit Symbol
Prevent Separation of Number and Unit Symbol
Last edited by annmucc on Tue Aug 23, 2011 11:42 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Prevent Separation of Number and Unit Symbol
Use a non-breaking space, ~:
Code: Select all
4~\textcelsius
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Prevent Separation of Number and Unit Symbol
For physical quantities like this use the excellent siunitx package. The line break problem then should vanish.
For details refer to the package manual.
Thorsten
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{siunitx}
\begin{document}
\SI{4}{\celsius}
\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Prevent Separation of Number and Unit Symbol
Thanks for your help! This has solved my problem brilliantly.
Ann
Ann