1\documentclass{article} 2\usepackage[autolanguage,boldmath]{numprint} 3\usepackage{textcomp} 4\usepackage{color} 5\let\toprule\hline 6\let\midrule\hline 7\let\bottomrule\hline 8 9\textwidth=6in\relax 10 11\begin{document} 12\section{Basics} 13\paragraph{Basics} 14\numprint{-123456}; \numprint{\pm 123456}; \numprint{+-3,1415927e-3.1} 15 16\paragraph{Text vs Math} 17\numprint{123456.134e123} and $\numprint{123456.134e123}$ 18 19\paragraph{Exponents} 20Pure exponents: \numprint{e43242}; \numprint{-e43242}; \numprint{+-e43242}. 21 22\paragraph{Expansion} 23\def\numberbefore{1234}% 24\def\totalnumber{\numberbefore.5678}% 25\numprint{\totalnumber} 26 27\paragraph{Units} 28\numprint[N/mm^2]{-123456} 29\numprint[\textdegree]{360} 30 31\paragraph{Counters and Lengths} 32Page: \cntprint{page} 33 34Lengths: 35$\lenprint{\textwidth}$, 36$\lenprint[pt]{\textwidth}$, 37$\lenprint[in]{\textwidth}$, 38$\lenprint[bp]{\textwidth}$, 39$\lenprint[mm]{\textwidth}$, 40$\lenprint[cm]{\textwidth}$. 41 42\section{Customization} 43\paragraph{Four-digit case} 44\numprint{1234} vs.~ {\npfourdigitnosep\numprint{1234}}; 45But : \numprint{12345} vs.~ {\npfourdigitnosep\numprint{12345}}. 46 47\paragraph{Missing zero} 48{\npnoaddmissingzero\numprint{.1234}} vs.~ {\npaddmissingzero\numprint{.1234}}; 49But : {\npnoaddmissingzero\numprint{1234}} vs.~ {\npaddmissingzero\numprint{1234}}; 50 51\paragraph{Adding pluses} 52\numprint{1234} vs.~ {\npaddplus\numprint{1234}}; 53And : \numprint{1234e4} vs.~ {\npaddplusexponent\numprint{1234e4}}; 54 55% % Test is not so portable across versions of numprint 56% \paragraph{Rounding numbers} 57% {\npnoround 58% $\numprint{1.123}$; $\numprint{1.149}$; 59% $\numprint{1}$; $\numprint{9.999}$; $\numprint{-9.999}$} 60 61% {\nprounddigits{2} 62% $\numprint{1.123}$; $\numprint{1.149}$; 63% $\numprint{1}$; $\numprint{9.999}$; $\numprint{-9.999}$ } 64 65\paragraph{Padding} 66{\nplpadding{6}% 67 $\numprint{1234}$; $\numprint{-1234}$; 68 $\numprint{12345678}$; $\numprint{1234.5678}$ --} 69 70vs.~{\nplpadding[x]{6}% 71 $\numprint{1234}$; $\numprint{-1234}$; 72 $\numprint{12345678}$; $\numprint{1234.5678}$} 73 74\paragraph{Replacing zeros} 75\numprint{123.00000} 76 vs.~{\npreplacenull{\mbox{---}} \numprint{123.00000}} 77 78\paragraph{Units format} 79\numprint[N/mm^2]{300} 80vs. {\renewcommand*\npunitcommand[1]{\ensuremath{\color{blue}\mathrm{#1}}} 81 \numprint[N/mm^2]{300}} 82 83\paragraph{New units} 84\npdefunit{myin}{\!''}{0.01383700013} 85 86$\lenprint[in]{\textwidth}$ vs.~ $\lenprint[myin]{\textwidth}$ 87% 88 89\paragraph{Fancier} 90\numprint{-123456}; \numprint{3,1415927e-32} 91 92% pdflatex error: undefined control sequence \ndecimalsign 93%%%{\ndecimalsign 94{\ensuremath{\cdot}\npthousandsep{,}\npproductsign{*}% 95\numprint{-123456}; \numprint{3,1415927e-32}} 96 97\section{Tabulars} 98\begin{tabular}{n{5}{3}} 99123.45\\ 10012345.678\\ 101\end{tabular} 102 103\begin{tabular}{n{5}{3}|n{5}{3}} 104123.45 & 12345.678\\ 105\end{tabular} 106 107{\tabcolsep0mm\small 108\begin{tabular}{|n{5}{3}|n[3]{5}{3}|n[3][1]{5}{3}|N{5}{3}|} 109\hline 110123.45e12& 123.45e12& 123.45e12 & 123.45e12 \\ 11112345.678e123& 12345.678e123& 12345.678e123& 12345.678e123 \\ 112\hline 113\end{tabular}} 114 115\begin{tabular}{n{2}{1}n{2}{1}n{2}{1}n[1]{2}{1}} 116\toprule 117{without braces}& 118{with braces}& 119{with braces and box}& 120\multicolumn{1}{l}{with braces, exp, and box} 121\\ 122\midrule 123% pdflatex error: char for exponent used more than once 124%%%abc def 12,3e3 rt& 125{error} & 126{abc def } 12,3e3 { rt}& 127{\npmakebox[abc def ][l]{abc def }} 12,3e3 { rt}& 128{\npmakebox[abc def ][l]{abc def }} 12,3e3 { rt} 129\\ 130more 45,1 txt& 131{more } 45,1 { txt}& 132{\npmakebox[abc def ][l]{more }} 45,1 { txt}& 133{\npmakebox[abc def ][l]{more }} 45,1 { txt} 134\\ 135\midrule 136not blue 45,1 txt& 137{\color{blue}blue } 45,1 { txt}& 138{\color{blue}\npmakebox[abc def ][l]{blue }} 45,1 { txt}& 139{\color{blue}\npmakebox[abc def ][l]{blue }} 45,1 { txt} 140\\ 141\bottomrule 142\end{tabular} 143 144\begin{tabular}{lN{12}{3}n{12}{3}} 145\toprule 146normal:& 147123456123456.123e12& 148123456123456.123e12 149\\ 150bold:& 151{\fontseries{b}\selectfont} 123456123456.123e12& 152%{\npboldmath} 123456123456.123e12 153\\ 154bold extended:& 155{\bfseries} 123456123456.123e12& 156{\boldmath} 123456123456.123e12 157\\ 158\bottomrule 159\end{tabular} 160 161 162\begin{tabular}{% 163>{{before \npafternum{ after}}}n[2]{12}{3}% 164>{{\nprounddigits{4}}}n{3}{4}% 165>{{\color{blue}}}n{12}{3}} 166\toprule 167123456123456.123e12& 16812.12345& 169123456.23e1 170\\ 17112345.123e12& 17212.1& 17314561234.562e12 174\\ 175\bottomrule 176\end{tabular} 177 178\begin{tabular}{>{{\npunit{N/mm^2}}}n{5}{3}} 179\toprule 18012345.123\\ 18112.12\\ 182{\npunit{psi}} 234.4\\ 1834.3\\ 184\bottomrule 185\end{tabular} 186 187\end{document}