When I write
HF:HNO$_3$:H$_2$O
15:1:2,5
I get
HF :HNO3 :H20
15 :1 :2,5
The problem is the space before :. Please, would someone know why I get a space before each : that I wrote?

NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Code: Select all
\usepackage{caption}
\DeclareCaptionLabelSeparator{colonfr}{~: }
Code: Select all
\documentclass{article}
\usepackage[french]{babel}
\usepackage{chemformula}
\begin{document}
\ch{HF} and \ch{HNO3} and \ch{H2O}
HF:HNO$_3$:H$_2$O
{\sffamily \ch{HF} and \ch{HNO3} and \ch{H2O}
\NoAutoSpacing
HF:HNO$_3$:H$_2$O}
\end{document}
Let me guess: you're using babel with French?nicr wrote:When I write
HF:HNO$_3$:H$_2$O
15:1:2,5
I get
HF :HNO3 :H20
15 :1 :2,5
Code: Select all
\documentclass{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\begin{document}
HF:HNO$_3$:H$_2$O
15:1:2,5
\end{document}
Code: Select all
\documentclass{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{chemformula}
\begin{document}
$\ch{HF}:\ch{HNO3}:\ch{H2O}$
$15:1:2{,}5$
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p