# [Tex/LaTex] Calculate prices

calculationsformattinglanguagespythonsymbols

I want to calculate prices in a LaTex file. This means I want to add two numbers with exactly 2 decimal places and I want to multiply these values by an integer.

An other thing is the output format. The numbers should be printed like this: 1.234.567,89 (I want to use this in Germany, and there we write numbers like that).

I know there are many packages for calculation in LaTeX, but I assume/hope there is one especially for money values.

PGF

You might want to take a look at the mathematical capabilities of pgf. I prepared a MWE:

\documentclass{standalone}
\usepackage{pgf}
\usepgflibrary{fpu}
\pgfkeys{
/pgf/fpu = true,
/pgf/number format/.cd,
precision=2,
fixed,
fixed zerofill,
use comma,
1000 sep={.}
}
\begin{document}
\pgfmathparse{2*(1234.56+9786.45)}
\pgfmathprintnumber{\pgfmathresult}
\end{document}


The output will look something like this

To process huge numbers you need to load the fpu library. (Thank you, Jake)

Alternative

Your questions is a little bit unclear, but if it is only about typesetting currency, you could abuse the siunitx package and do something like this

\documentclass{standalone}
\usepackage{marvosym}
\usepackage{siunitx}
\sisetup{
group-separator = {.},
round-mode = places,
round-precision = 2,
output-decimal-marker = {,}
}
\DeclareSIUnit\euro{\EUR}
\begin{document}
\SI{1234567.8499999}{\euro}
\end{document}


Which leads to the following output