Debian Codegraph @

texmf-dist/doc/latex/numprint/numprinttest.tex

raw
1 \listfiles
2 \documentclass[portuges,french,ngerman,english,a4paper,fleqn,11pt]{article}
3 \usepackage[T1]{fontenc}
4 \usepackage[warning,debug,nosepfour,autolanguage]{numprint}
5 \usepackage{array}
6 \usepackage{babel}
7 \usepackage{tabularx}
8 \usepackage{longtable}
9
10 % Switch off spacing between number and percent sign in English
11 \makeatletter
12 \g@addto@macro\npstyleenglish{%
13 \nppercentseparator{}%
14 }%
15 \makeatother
16
17 \begin{document}
18 \sffamily
19 To be able to see the difference between text and math mode I switch
20 to a sans serif font. The math mode stays with serifs.
21
22 text mode:
23
24 \numprint{1234} abc
25
26 \numprint{1234.1234} abc
27
28 \numprint{1234.12345} abc
29
30 \numprint{12345.12345}
31
32 \numprint{1234567890}
33
34 \numprint[mm]{1234567890}
35
36 \numprint[MPa\sqrt{m}]{12345.12345}
37
38 \numprint{1234567890,1234567890}, \numprint{1234567890.1234567890}
39
40 \numprint{+123456}, \numprint{+1234567}, \numprint{+12345678}
41
42 \numprint{-123456}, \numprint{-1234567}, \numprint{-12345678}
43
44 \numprint{\pm 123456}, \numprint{\pm 1234567}, \numprint{\pm 12345678}
45
46 \numprint{12345678.12345678e1234.1234}
47
48 \numprint{12345678.12345678E+1234.1234}
49
50 \numprint{12345678.12345678E1234}
51
52 \numprint{E1234}
53
54 \numprint{+E1234}
55
56 \numprint{-E1234}
57
58 \numprint{+-E1234}
59
60 \numprint{\pm E1234}
61
62 \bigskip
63 math mode:
64
65 $\numprint{1234.1234}$
66
67 $\numprint{12345.12345}$
68
69 $\numprint[\%]{1234567890}$
70
71 $\numprint[mm]{1234567890}$
72
73 $\numprint[MPa\sqrt{m}]{12345.12345}$
74
75 $\numprint{1234567890,1234567890}$, $\numprint{1234567890.1234567890}$
76
77 $\numprint{+123456}$, $\numprint{+1234567}$, $\numprint{+12345678}$
78
79 $\numprint{-123456}$, $\numprint{-1234567}$, $\numprint{-12345678}$
80
81 $\numprint{\pm 123456}$, $\numprint{\pm 1234567}$, $\numprint{\pm 12345678}$
82
83 $\numprint{12345678.12345678e1234.1234}$
84
85 $\numprint{12345678.12345678E+1234.1234}$
86
87 $\numprint{12345678.12345678E1234}$
88
89 $\numprint{E1234}$
90
91 $\numprint{+E1234}$
92
93 $\numprint{-E1234}$
94
95 $\numprint{+-E1234}$
96
97 $\numprint{\pm E1234}$
98
99 $\numprint{1.}$
100
101 $\numprint{0.1}$
102
103 $\numprint{.1}$
104
105 $\numprint{1.E5}$
106
107 Round to 2 digits resp. 1 digit in exponents:
108
109 {\nprounddigits{2}\nproundexpdigits{1}%
110 $\numprint{12345678.12345678e1234.1234}$
111
112 $\numprint{12345678.12345678E+1234.1234}$
113
114 $\numprint{12345678.12345678E1234}$}
115
116 Round to 0 digits:
117
118 {\nprounddigits{0}%
119 $\numprint{12345678.12}$
120
121 $\numprint{12345678.1}$
122
123 $\numprint{12345678.}$
124
125 $\numprint{12345678}$}
126
127 Replace zero by ---:
128
129 {\nprounddigits{2}\npreplacenull{\mbox{---}}%
130 $\numprint{12345678.00}$
131
132 $\numprint{12345678.12}$
133
134 $\numprint{12345678}$}
135
136 Don't add missing zero:
137
138 {\npnoaddmissingzero
139 $\numprint{1.}$
140
141 $\numprint{.1}$
142
143 $\numprint{1.E5}$}
144
145 English:
146
147 $\numprint{12345678.12345678E1234}$
148
149 {\selectlanguage{ngerman}German:
150
151 $\numprint{12345678.12345678E1234}$}
152
153 {\selectlanguage{portuges}Portuguese:
154
155 $\numprint{12345678.12345678E1234}$}
156
157 {\selectlanguage{french}French:
158
159 $\numprint{12345678.12345678E1234}$}
160
161 English:
162
163 $\numprint{12345678.12345678E1234}$
164
165 German (foreignlanguage):
166 \foreignlanguage{ngerman}{$\numprint{12345678.12345678E1234}$}
167
168 \bigskip
169 Padding:\par
170 $\numprint{12345.1234E1234}$\par
171 \begingroup
172 \nplpadding{7}
173 $\numprint{12345.1234E1234}$\par
174 \endgroup
175 $\numprint{12345.1234E1234}$\par
176 \nplpadding{7}
177 $\numprint{12345.1234E1234}$\par
178 \nplpadding[x]{7}
179 $\numprint{12345.1234E1234}$\par
180 \npnolpadding
181 $\numprint{12345.1234E1234}$
182
183 \bigskip
184 tabulars:
185
186 \tabcolsep0mm
187 \begin{tabular}{|n{6}{5}|}
188 1.1e1 \\
189 12.12e12 \\
190 123.123e123 \\
191 1234.1234e1234 \\
192 12345.12345e1234.1 \\
193 123456.12345
194 \end{tabular}
195
196 \begin{tabular}{|n{6}{5}|}
197 1.1 \\
198 12.12 \\
199 123.123
200 \end{tabular}
201
202 \begin{tabular}{|n[4]{6}{5}|}
203 1.1e1 \\
204 12.12e12 \\
205 123.123e123 \\
206 1234.1234e1234 \\
207 12345.12345e1234.1 \\
208 12345.12345e12345.1 \\
209 123456.12345
210 \end{tabular}
211
212 \begin{tabular}{|n[4][1]{6}{5}|}
213 1.1e1 \\
214 12.12e12 \\
215 123.123e123 \\
216 1234.1234e1234 \\
217 12345.12345e1234.1 \\
218 12345.12345e12345.1 \\
219 123456.12345
220 \end{tabular}
221
222 \begin{tabular}{|n{4}{4}|}
223 1.1 \\
224 12.12 \\
225 123.123 \\
226 1234.1234
227 \end{tabular}
228
229 \npfourdigitnosep
230 \begin{tabular}{|n[4]{5}{4}|}
231 1.1e1 \\
232 12.12e12 \\
233 123.123e123 \\
234 1234.1234e1234 \\
235 12345.12345e1234.1 \\
236 12345.12345e12345.1 \\
237 123456.12345
238 \end{tabular}
239
240 \begin{tabular}{|n{4}{4}|}
241 1.1 \\
242 12.12 \\
243 123.123 \\
244 1234.1234
245 \end{tabular}
246
247 \begin{tabular}{|n{4}{5}|}
248 1.1 \\
249 12.12 \\
250 123.123 \\
251 1234.1234 \\
252 1234.12345
253 \end{tabular}
254
255 \def\gammel{1234}%
256 \nprounddigits{3}%
257 \begin{tabular}{@{}>{\boldmath}n[3]{6}{3}} %$
258 +12343,0e-3\\
259 \gammel
260 \end{tabular}
261
262 \begin{tabular}{@{}n[3]{6}{3}}
263 +12343,0e-3\\
264 \gammel
265 \end{tabular}
266
267 \begin{tabular}{@{}>{\bfseries}N[3]{6}{3}} %$
268 +12343,0e-3\\
269 \gammel
270 \end{tabular}
271
272 \begin{tabular}{@{}|N[3]{6}{3}|}
273 +12343.0e-3 \\
274 12343.0e-3 \\
275 \gammel
276 \end{tabular}
277
278
279
280 \numprint{1234} abc
281
282 \numprint{1234.1234} abc
283
284 \numprint{1234.12345} abc
285
286 \numprint{12345.1234} abc
287
288 \numprint{12345.12345}
289
290 ||\numprint{e3}||
291
292 ||$10^{3}$||
293
294 ||1\,234||
295
296 ||\numprint{1234}||
297
298 \numprint{1000.00}%
299
300 \numprint{-10000.00}%
301
302 \numprint{-1000.00}%
303
304 \numprint{-100.00}%
305
306 \nprounddigits{2}%
307 \numprint{-99.999}%
308
309 \numprint{-999.999}%
310
311 \numprint{-9999.999}%
312
313 \numprint{999.999}%
314
315 \numprint{9\,99.999}%
316
317 \numprint{999.999}%
318
319 \numprint{999.999}%
320
321 %\numprint{99a99.999}%
322
323 %\def\harry\ignorespaces#1\unskip\endharry{\numprint{#1}}
324
325 %\begin{tabular}{@{|}>{\harry}r<{\endharry}@{}c@{|}}
326 % 1.1&\\
327 % 12.12&\\
328 % 123.123 &\\
329 % 1234.1234&\\
330 % 1234.12345&
331 %\end{tabular}
332
333 \npnoround
334 \npnodigits
335 ``\numprint{e1234}''
336
337 ``\numprint{e1234.0}''
338
339 \npexponentdigits[1]{4}%
340 ``\numprint{e1234}''
341
342 ``\numprint{e1234.0}''
343
344 \npexponentdigits[0]{4}%
345 ``\numprint{e1234}''
346
347 ``\numprint{e1234.0}''
348
349 \def\asdf{1234}
350 \def\fdsa{\asdf.4567}
351
352 \numprint\fdsa
353
354 \numprint{\gammel}
355
356 \numprint{fd}
357
358 \npnodigits
359 \npnoexponentdigits
360
361 \begin{tabular*}{0.6\linewidth}{|n{4}{5}|}
362 {\boldmath} 1.1 \\
363 12.12 \\
364 123.123 \\
365 1234.1234 \\
366 1234.12345
367 \end{tabular*}
368
369 \noindent
370 \typeout{tabularx}
371 \begin{tabularx}{\linewidth}{|X|n{4}{5}|}
372 filled column& {\boldmath} 1.1 \\
373 & 12.12 \\
374 & 123.123 \\
375 & 1234.1234 \\
376 & 1234.12345
377 \end{tabularx}
378
379 \typeout{longtable}
380
381 \begin{longtable}[l]{|n{4}{5}|N{4}{5}|}
382 {Mathe}& {Text}\\
383 \endhead
384 {\boldmath} 1.1 { asdf}& {\bfseries} 1.1 { asdf} \\
385 12.12& 12.12 \\
386 123.123& 123.123 \\
387 1234.1234& 1234.1234 \\
388 1234.12345{ asdf}& 1234.12345{ asdf}
389 \end{longtable}
390
391 \begin{equation}
392 \left(\begin{array}{n{4}{5}}
393 1.1 \\
394 12.12 \\
395 123.123 \\
396 1234.1234 \\
397 1234.12345
398 \end{array}\right)
399 =
400 \left(\begin{array}{>{{moin}}N{4}{5}}
401 1.1 \\
402 12.12 \\*
403 123.123 \\
404 1234.1234 \\
405 1234.12345
406 \end{array}\right)
407 \end{equation}
408
409 \begin{tabular}{n{4}{5}}
410 \numprint{1234,12345} \\
411 \numprint{1234} \\
412 {\makebox[2cm][l]{987}} {\numprint{123,3e5}} {654} \\
413 {987} \numprint{123,3e5} {654} \\
414 {987} 123,3e5 {654} \\
415 987 \numprint{123,3e5} {654} \\
416 987 {\numprint{123,3e5}} {654} \\
417 \end{tabular}
418
419 Test for empty cells:
420
421 \begin{tabular}{|n{4}{4}|n{4}{4}|}
422 12.21 & \\
423 & 34.43 \\
424 56.65 &
425 \end{tabular}
426
427 \clearpage
428 \setcounter{page}{13413}%
429
430 $\cntprint{page}$
431
432 \nprounddigits{4}
433
434 $\lenprint{40\textwidth}$
435
436 $\lenprint[pt]{40\textwidth}$
437
438 $\lenprint[mm]{40\textwidth}$
439
440 $\lenprint[cm]{40\textwidth}$
441
442 $\lenprint[bp]{40\textwidth}$
443
444 $\lenprint[in]{40\textwidth}$
445
446 $\lenprint[ft]{40\textwidth}$
447
448 \npdefunit{ft}{foot}{*}%
449 $\lenprint[ft]{40\textwidth}$
450
451 $\lenprint[m]{40\textwidth}$
452
453 $\lenprint[km]{40\textwidth}$
454
455 \begin{tabular}{|n{4}{4}|}
456 \\
457 12.12 \\
458 123.123 \\
459 1234.1234
460 \end{tabular}
461
462 \end{document}