summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/numprint/numprinttest.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/numprint/numprinttest.tex
Initial commit
Diffstat (limited to 'macros/latex/contrib/numprint/numprinttest.tex')
-rw-r--r--macros/latex/contrib/numprint/numprinttest.tex462
1 files changed, 462 insertions, 0 deletions
diff --git a/macros/latex/contrib/numprint/numprinttest.tex b/macros/latex/contrib/numprint/numprinttest.tex
new file mode 100644
index 0000000000..dee6c1a3cf
--- /dev/null
+++ b/macros/latex/contrib/numprint/numprinttest.tex
@@ -0,0 +1,462 @@
+\listfiles
+\documentclass[portuges,french,ngerman,english,a4paper,fleqn,11pt]{article}
+\usepackage[T1]{fontenc}
+\usepackage[warning,debug,nosepfour,autolanguage]{numprint}
+\usepackage{array}
+\usepackage{babel}
+\usepackage{tabularx}
+\usepackage{longtable}
+
+% Switch off spacing between number and percent sign in English
+\makeatletter
+\g@addto@macro\npstyleenglish{%
+ \nppercentseparator{}%
+}%
+\makeatother
+
+\begin{document}
+\sffamily
+To be able to see the difference between text and math mode I switch
+to a sans serif font. The math mode stays with serifs.
+
+text mode:
+
+\numprint{1234} abc
+
+\numprint{1234.1234} abc
+
+\numprint{1234.12345} abc
+
+\numprint{12345.12345}
+
+\numprint{1234567890}
+
+\numprint[mm]{1234567890}
+
+\numprint[MPa\sqrt{m}]{12345.12345}
+
+\numprint{1234567890,1234567890}, \numprint{1234567890.1234567890}
+
+\numprint{+123456}, \numprint{+1234567}, \numprint{+12345678}
+
+\numprint{-123456}, \numprint{-1234567}, \numprint{-12345678}
+
+\numprint{\pm 123456}, \numprint{\pm 1234567}, \numprint{\pm 12345678}
+
+\numprint{12345678.12345678e1234.1234}
+
+\numprint{12345678.12345678E+1234.1234}
+
+\numprint{12345678.12345678E1234}
+
+\numprint{E1234}
+
+\numprint{+E1234}
+
+\numprint{-E1234}
+
+\numprint{+-E1234}
+
+\numprint{\pm E1234}
+
+\bigskip
+math mode:
+
+$\numprint{1234.1234}$
+
+$\numprint{12345.12345}$
+
+$\numprint[\%]{1234567890}$
+
+$\numprint[mm]{1234567890}$
+
+$\numprint[MPa\sqrt{m}]{12345.12345}$
+
+$\numprint{1234567890,1234567890}$, $\numprint{1234567890.1234567890}$
+
+$\numprint{+123456}$, $\numprint{+1234567}$, $\numprint{+12345678}$
+
+$\numprint{-123456}$, $\numprint{-1234567}$, $\numprint{-12345678}$
+
+$\numprint{\pm 123456}$, $\numprint{\pm 1234567}$, $\numprint{\pm 12345678}$
+
+$\numprint{12345678.12345678e1234.1234}$
+
+$\numprint{12345678.12345678E+1234.1234}$
+
+$\numprint{12345678.12345678E1234}$
+
+$\numprint{E1234}$
+
+$\numprint{+E1234}$
+
+$\numprint{-E1234}$
+
+$\numprint{+-E1234}$
+
+$\numprint{\pm E1234}$
+
+$\numprint{1.}$
+
+$\numprint{0.1}$
+
+$\numprint{.1}$
+
+$\numprint{1.E5}$
+
+Round to 2 digits resp. 1 digit in exponents:
+
+{\nprounddigits{2}\nproundexpdigits{1}%
+$\numprint{12345678.12345678e1234.1234}$
+
+$\numprint{12345678.12345678E+1234.1234}$
+
+$\numprint{12345678.12345678E1234}$}
+
+Round to 0 digits:
+
+{\nprounddigits{0}%
+$\numprint{12345678.12}$
+
+$\numprint{12345678.1}$
+
+$\numprint{12345678.}$
+
+$\numprint{12345678}$}
+
+Replace zero by ---:
+
+{\nprounddigits{2}\npreplacenull{\mbox{---}}%
+$\numprint{12345678.00}$
+
+$\numprint{12345678.12}$
+
+$\numprint{12345678}$}
+
+Don't add missing zero:
+
+{\npnoaddmissingzero
+$\numprint{1.}$
+
+$\numprint{.1}$
+
+$\numprint{1.E5}$}
+
+English:
+
+$\numprint{12345678.12345678E1234}$
+
+{\selectlanguage{ngerman}German:
+
+$\numprint{12345678.12345678E1234}$}
+
+{\selectlanguage{portuges}Portuguese:
+
+$\numprint{12345678.12345678E1234}$}
+
+{\selectlanguage{french}French:
+
+$\numprint{12345678.12345678E1234}$}
+
+English:
+
+$\numprint{12345678.12345678E1234}$
+
+German (foreignlanguage):
+\foreignlanguage{ngerman}{$\numprint{12345678.12345678E1234}$}
+
+\bigskip
+Padding:\par
+$\numprint{12345.1234E1234}$\par
+\begingroup
+\nplpadding{7}
+$\numprint{12345.1234E1234}$\par
+\endgroup
+$\numprint{12345.1234E1234}$\par
+\nplpadding{7}
+$\numprint{12345.1234E1234}$\par
+\nplpadding[x]{7}
+$\numprint{12345.1234E1234}$\par
+\npnolpadding
+$\numprint{12345.1234E1234}$
+
+\bigskip
+tabulars:
+
+\tabcolsep0mm
+\begin{tabular}{|n{6}{5}|}
+ 1.1e1 \\
+ 12.12e12 \\
+ 123.123e123 \\
+ 1234.1234e1234 \\
+ 12345.12345e1234.1 \\
+ 123456.12345
+\end{tabular}
+
+\begin{tabular}{|n{6}{5}|}
+ 1.1 \\
+ 12.12 \\
+ 123.123
+\end{tabular}
+
+\begin{tabular}{|n[4]{6}{5}|}
+ 1.1e1 \\
+ 12.12e12 \\
+ 123.123e123 \\
+ 1234.1234e1234 \\
+ 12345.12345e1234.1 \\
+ 12345.12345e12345.1 \\
+ 123456.12345
+\end{tabular}
+
+\begin{tabular}{|n[4][1]{6}{5}|}
+ 1.1e1 \\
+ 12.12e12 \\
+ 123.123e123 \\
+ 1234.1234e1234 \\
+ 12345.12345e1234.1 \\
+ 12345.12345e12345.1 \\
+ 123456.12345
+\end{tabular}
+
+\begin{tabular}{|n{4}{4}|}
+ 1.1 \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234
+\end{tabular}
+
+\npfourdigitnosep
+\begin{tabular}{|n[4]{5}{4}|}
+ 1.1e1 \\
+ 12.12e12 \\
+ 123.123e123 \\
+ 1234.1234e1234 \\
+ 12345.12345e1234.1 \\
+ 12345.12345e12345.1 \\
+ 123456.12345
+\end{tabular}
+
+\begin{tabular}{|n{4}{4}|}
+ 1.1 \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234
+\end{tabular}
+
+\begin{tabular}{|n{4}{5}|}
+ 1.1 \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234 \\
+ 1234.12345
+\end{tabular}
+
+\def\gammel{1234}%
+\nprounddigits{3}%
+\begin{tabular}{@{}>{\boldmath}n[3]{6}{3}} %$
+ +12343,0e-3\\
+ \gammel
+\end{tabular}
+
+\begin{tabular}{@{}n[3]{6}{3}}
+ +12343,0e-3\\
+ \gammel
+\end{tabular}
+
+\begin{tabular}{@{}>{\bfseries}N[3]{6}{3}} %$
+ +12343,0e-3\\
+ \gammel
+\end{tabular}
+
+\begin{tabular}{@{}|N[3]{6}{3}|}
+ +12343.0e-3 \\
+ 12343.0e-3 \\
+ \gammel
+\end{tabular}
+
+
+
+\numprint{1234} abc
+
+\numprint{1234.1234} abc
+
+\numprint{1234.12345} abc
+
+\numprint{12345.1234} abc
+
+\numprint{12345.12345}
+
+||\numprint{e3}||
+
+||$10^{3}$||
+
+||1\,234||
+
+||\numprint{1234}||
+
+\numprint{1000.00}%
+
+\numprint{-10000.00}%
+
+\numprint{-1000.00}%
+
+\numprint{-100.00}%
+
+\nprounddigits{2}%
+\numprint{-99.999}%
+
+\numprint{-999.999}%
+
+\numprint{-9999.999}%
+
+\numprint{999.999}%
+
+\numprint{9\,99.999}%
+
+\numprint{999.999}%
+
+\numprint{999.999}%
+
+%\numprint{99a99.999}%
+
+%\def\harry\ignorespaces#1\unskip\endharry{\numprint{#1}}
+
+%\begin{tabular}{@{|}>{\harry}r<{\endharry}@{}c@{|}}
+% 1.1&\\
+% 12.12&\\
+% 123.123 &\\
+% 1234.1234&\\
+% 1234.12345&
+%\end{tabular}
+
+\npnoround
+\npnodigits
+``\numprint{e1234}''
+
+``\numprint{e1234.0}''
+
+\npexponentdigits[1]{4}%
+``\numprint{e1234}''
+
+``\numprint{e1234.0}''
+
+\npexponentdigits[0]{4}%
+``\numprint{e1234}''
+
+``\numprint{e1234.0}''
+
+\def\asdf{1234}
+\def\fdsa{\asdf.4567}
+
+\numprint\fdsa
+
+\numprint{\gammel}
+
+\numprint{fd}
+
+\npnodigits
+\npnoexponentdigits
+
+\begin{tabular*}{0.6\linewidth}{|n{4}{5}|}
+ {\boldmath} 1.1 \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234 \\
+ 1234.12345
+\end{tabular*}
+
+\noindent
+\typeout{tabularx}
+\begin{tabularx}{\linewidth}{|X|n{4}{5}|}
+filled column& {\boldmath} 1.1 \\
+& 12.12 \\
+& 123.123 \\
+& 1234.1234 \\
+& 1234.12345
+\end{tabularx}
+
+\typeout{longtable}
+
+\begin{longtable}[l]{|n{4}{5}|N{4}{5}|}
+ {Mathe}& {Text}\\
+ \endhead
+ {\boldmath} 1.1 { asdf}& {\bfseries} 1.1 { asdf} \\
+ 12.12& 12.12 \\
+ 123.123& 123.123 \\
+ 1234.1234& 1234.1234 \\
+ 1234.12345{ asdf}& 1234.12345{ asdf}
+\end{longtable}
+
+\begin{equation}
+ \left(\begin{array}{n{4}{5}}
+ 1.1 \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234 \\
+ 1234.12345
+ \end{array}\right)
+ =
+ \left(\begin{array}{>{{moin}}N{4}{5}}
+ 1.1 \\
+ 12.12 \\*
+ 123.123 \\
+ 1234.1234 \\
+ 1234.12345
+ \end{array}\right)
+\end{equation}
+
+\begin{tabular}{n{4}{5}}
+ \numprint{1234,12345} \\
+ \numprint{1234} \\
+ {\makebox[2cm][l]{987}} {\numprint{123,3e5}} {654} \\
+ {987} \numprint{123,3e5} {654} \\
+ {987} 123,3e5 {654} \\
+ 987 \numprint{123,3e5} {654} \\
+ 987 {\numprint{123,3e5}} {654} \\
+\end{tabular}
+
+Test for empty cells:
+
+\begin{tabular}{|n{4}{4}|n{4}{4}|}
+ 12.21 & \\
+ & 34.43 \\
+ 56.65 &
+\end{tabular}
+
+\clearpage
+\setcounter{page}{13413}%
+
+$\cntprint{page}$
+
+\nprounddigits{4}
+
+$\lenprint{40\textwidth}$
+
+$\lenprint[pt]{40\textwidth}$
+
+$\lenprint[mm]{40\textwidth}$
+
+$\lenprint[cm]{40\textwidth}$
+
+$\lenprint[bp]{40\textwidth}$
+
+$\lenprint[in]{40\textwidth}$
+
+$\lenprint[ft]{40\textwidth}$
+
+\npdefunit{ft}{foot}{*}%
+$\lenprint[ft]{40\textwidth}$
+
+$\lenprint[m]{40\textwidth}$
+
+$\lenprint[km]{40\textwidth}$
+
+\begin{tabular}{|n{4}{4}|}
+ \\
+ 12.12 \\
+ 123.123 \\
+ 1234.1234
+\end{tabular}
+
+\end{document}