Hi all,
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
Text Formatting ⇒ number formatting
number formatting
Last edited by mina on Mon Jul 26, 2010 10:07 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10320
- Joined: Mon Mar 10, 2008 9:44 pm
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
number formatting
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
number formatting
Hi,
Thank you guys. I tried the numprint packages. An example:
Note that the numbers are in German by default, unless you specify another language using the Babel package and the \selectlanguage command (supports English, German, Portuguese, Dutch and French) or use the autolanguage option. See manual.
Cheers,
Mina
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