I include the number as \num{0.12368455}. I need to print '0.1237'.
How to do this...
I include the number as \num{0.12368455}. I need to print '0.1237'.
How to do this...
With the the siunitx package you can use the option round-mode=places, round-precision=4 to obtain the desired results.
If you only need to control the rounding for a few numbers you use it as an option to \num:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\num{0.12368455}
\num[round-mode=places,round-precision=4]{0.12368455}
\end{document}
If you need to do this for the entire document you can use \sisetup{round-mode=places,round-precision=4} so that this formatting is applied for the entire document:

\documentclass{article}
\usepackage{siunitx}
\sisetup{round-mode=places,round-precision=4}
\begin{document}
\num{0.12368455}
\end{document}
Another way of achieving this is to use round-mode=figures, round-precision=4.

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\num[round-mode=figures,round-precision=4]{0.12368455}\par
\num[round-mode=figures,round-precision=4]{0.12}\par
\num[round-mode=places,round-precision=4]{0.12368455}\par
\num[round-mode=places,round-precision=4]{0.12}
\end{document}
round-mode=figures vs round-mode=placesWith [round-mode=figures,round-precision=4] you get 4 significant figures, and
with [round-mode=places,round-precision=4] you get 4 decimal places. Here is a comparison:

Similar results can also be achieved using \pgfmathprintnumber:

\documentclass{article}
\usepackage{pgf}
\newcommand*{\MyNum}[1]{%
\pgfmathprintnumber[
fixed,
precision=4,
fixed zerofill=true,
]{#1}}%
\begin{document}
\MyNum{0.12368455}\par
\MyNum{0.12}
\end{document}
figuresandplaces, e.g.\num[...]{12.12}. – dgs Jun 09 '12 at 10:070.1234as0.123, while0.12should be printed as it is without adding an additional zero? – Diaa Nov 04 '19 at 22:59\newcommand*{\MyNum}[1]{\pgfmathprintnumber[precision=3]{#1}}. – Peter Grill Nov 04 '19 at 23:26