Text Formatting ⇒ number formatting
number formatting
I have been googling this but couldn't find anything.
Is there a way to make LaTeX take care of formatting numbers? For example, if I write 165010621 in my tex file I'd like to see 165,010,621 in my PDF. It's not really a big deal, I can add the commas manually, but I am really curious whether something exists to do it automatically.
I use report class and PDFLaTeX.
Cheers,
Mina
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
number formatting
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
number formatting
Thank you guys. I tried the numprint packages. An example:
Code: Select all
\documentclass[a4paper,10pt]{report}\usepackage[english]{babel}\usepackage{numprint}\begin{document}\numprint[m^2]{48524378} (\numprint{4.8e-7}, or \numprint[mln]{48.5}) and \numprint[\%]{36.19}.\selectlanguage{english}\numprint[nt]{48524378} (\numprint{4.8e7}, or \numprint[mln]{48.5}) and \numprint[\%]{36.19}.\npdecimalsign{\ensuremath{\cdot}}\npthousandsep{,}\npproductsign{*}\numprint[nt]{48524378} (\numprint{4.8e7}, or \numprint[mln]{48.5}) and \numprint[\%]{36.19}.\end{document}
Cheers,
Mina