Debian Codegraph @

texmf-dist/source/latex/siunitx/siunitx-emulation.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: siunitx-emulation.dtx Copyright (C) 2016-2019,2021-2026 Joseph Wright
4 %
5 % It may be distributed and/or modified under the conditions of the
6 % LaTeX Project Public License (LPPL), either version 1.3c of this
7 % license or (at your option) any later version. The latest version
8 % of this license is in the file
9 %
10 % https://www.latex-project.org/lppl.txt
11 %
12 % This file is part of the "siunitx bundle" (The Work in LPPL)
13 % and all files in that bundle must be distributed together.
14 %
15 % The released version of this bundle is available from CTAN.
16 %
17 % -----------------------------------------------------------------------
18 %
19 % The development version of the bundle can be found at
20 %
21 % https://github.com/josephwright/siunitx
22 %
23 % for those people who are interested.
24 %
25 % -----------------------------------------------------------------------
26 %
27 %<*driver>
28 \documentclass{l3doc}
29 % Additional commands needed in this source
30 \ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}}
31 % The next line is needed so that \GetFileInfo will be able to pick up
32 % version data
33 \usepackage{siunitx}
34 \begin{document}
35 \DocInput{\jobname.dtx}
36 \end{document}
37 %</driver>
38 % \fi
39 %
40 % \GetFileInfo{siunitx.sty}
41 %
42 % \title{^^A
43 % \pkg{siunitx-emulation} -- Emulation^^A
44 % \thanks{This file describes \fileversion,
45 % last revised \filedate.}^^A
46 % }
47 %
48 % \author{^^A
49 % Joseph Wright^^A
50 % \thanks{^^A
51 % E-mail:
52 % \email{[email protected]}^^A
53 % }^^A
54 % }
55 %
56 % \date{Released \filedate}
57 %
58 % \maketitle
59 %
60 % \begin{documentation}
61 %
62 % This sub-module exposes no API.
63 %
64 % \end{documentation}
65 %
66 % \begin{implementation}
67 %
68 % \section{\pkg{siunitx-emulation} implementation}
69 %
70 % Identify the internal prefix.
71 % \begin{macrocode}
72 %<@@=siunitx>
73 % \end{macrocode}
74 %
75 % Start the \pkg{DocStrip} guards.
76 % \begin{macrocode}
77 %<*package>
78 % \end{macrocode}
79 %
80 % \begin{macrocode}
81 %<*options>
82 % \end{macrocode}
83 %
84 % Some messages.
85 % \begin{macrocode}
86 \msg_new:nnn { siunitx } { option-removed }
87 { Option~"#1"~has~been~removed~in~this~release. }
88 % \end{macrocode}
89 %
90 % \begin{macro}{\@@_option_deprecated:nn}
91 % \begin{macro}{\@@_option_deprecated:nnn}
92 % Abstract out a simple wrapper.
93 % \begin{macrocode}
94 \cs_new_protected:Npn \@@_option_deprecated:nn #1#2
95 {
96 \@@_deprecated_info:nn {#1} {#2}
97 \keys_set:nn { siunitx } {#2}
98 }
99 \cs_new_protected:Npn \@@_option_deprecated:nnn #1#2#3
100 {
101 \str_if_eq:nnTF {#3} { true }
102 { \@@_option_deprecated:nn {#1} {#2} }
103 {
104 \@@_deprecated_info:nn {#1} { #2 ~=~ #3 }
105 \keys_set:nn { siunitx } { #2 = #3 }
106 }
107 }
108 % \end{macrocode}
109 % \end{macro}
110 % \end{macro}
111 %
112 % \begin{macro}{\@@_option_removed:n, \@@_option_removed:V}
113 % Abstract out a simple wrapper.
114 % \begin{macrocode}
115 \cs_new_protected:Npn \@@_option_removed:n #1
116 {
117 \msg_warning:nne { siunitx } { option-removed }
118 {#1}
119 }
120 \cs_generate_variant:Nn \@@_option_removed:n { V }
121 % \end{macrocode}
122 % \end{macro}
123 %
124 % \subsection{Load-time option}
125 %
126 % \begin{macrocode}
127 \clist_map_inline:nn
128 {
129 abbreviations ,
130 binary-units ,
131 load-configurations ,
132 version-1-compatibility
133 }
134 {
135 \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
136 }
137 % \end{macrocode}
138 %
139 % \subsection{Angle options}
140 %
141 % All straight-forward emulation.
142 % \begin{macrocode}
143 \keys_define:nn { siunitx }
144 {
145 add-arc-degree-zero .code:n =
146 {
147 \@@_option_deprecated:nnn
148 { add-arc-degree-zero }
149 { fill-angle-degrees }
150 {#1}
151 } ,
152 add-arc-degree-zero .default:n = true ,
153 add-arc-minute-zero .code:n =
154 {
155 \@@_option_deprecated:nnn
156 { add-arc-minute-zero }
157 { fill-angle-minutes }
158 {#1}
159 } ,
160 add-arc-minute-zero .default:n = true ,
161 add-arc-second-zero .code:n =
162 {
163 \@@_option_deprecated:nnn
164 { add-arc-second-zero }
165 { fill-angle-seconds }
166 {#1}
167 } ,
168 add-arc-second-zero .default:n = true ,
169 arc-separator .code:n =
170 {
171 \@@_option_deprecated:nnn
172 { arc-separator }
173 { angle-separator }
174 {#1}
175 }
176 }
177 % \end{macrocode}
178 %
179 % \subsection{Combination functions options}
180 %
181 % \begin{macrocode}
182 \keys_define:nn { siunitx }
183 {
184 list-units / brackets .code:n =
185 {
186 \@@_option_deprecated:nn
187 { list-units~=~brackets }
188 { list-units~=~bracket }
189 } ,
190 range-units / brackets .code:n =
191 {
192 \@@_option_deprecated:nn
193 { range-units~=~brackets }
194 { range-units~=~bracket }
195 } ,
196 product-units / brackets .code:n =
197 {
198 \@@_option_deprecated:nn
199 { product-units~=~brackets }
200 { product-units~=~bracket }
201 }
202 }
203 % \end{macrocode}
204 %
205 % \subsection{Command options}
206 %
207 % \begin{macrocode}
208 \keys_define:nn { siunitx }
209 {
210 overwrite-functions .code:n =
211 {
212 \@@_option_deprecated:nnn
213 { overwrite-functions }
214 { overwrite-commands }
215 {#1}
216 } ,
217 overwrite-functions .default:n = true
218 }
219 % \end{macrocode}
220 %
221 % \subsection{Print options}
222 %
223 % \begin{macrocode}
224 \keys_define:nn { siunitx }
225 {
226 detect-all .code:n =
227 {
228 \@@_option_deprecated:nn
229 { detect-all }
230 {
231 mode~=~match , ~
232 propagate-math-font~=~true , ~
233 reset-math-version~=~false , ~
234 reset-text-family~=~false , ~
235 reset-text-series~=~false , ~
236 reset-text-shape~=~false , ~
237 text-family-to-math~=~true , ~
238 text-series-to-math~=~true
239 }
240 } ,
241 detect-family .code:n =
242 {
243 \@@_option_deprecated:nn
244 { detect-family }
245 {
246 reset-text-family~=~false , ~
247 text-family-to-math~=~true
248 }
249 } ,
250 detect-mode .code:n =
251 {
252 \@@_option_deprecated:nn
253 { detect-mode }
254 { mode~=~match }
255 } ,
256 detect-none .code:n =
257 {
258 \@@_option_deprecated:nn
259 { detect-none }
260 {
261 mode~=~math , ~
262 propagate-math-font~=~false , ~
263 reset-math-version~=~true , ~
264 reset-text-family~=~true , ~
265 reset-text-series~=~true , ~
266 text-family-to-math~=~false , ~
267 text-series-to-math~=~false
268 }
269 } ,
270 detect-shape .code:n =
271 {
272 \@@_option_deprecated:nn
273 { detect-shape }
274 { reset-text-shape~=~false }
275 } ,
276 detect-weight .code:n =
277 {
278 \@@_option_deprecated:nn
279 { detect-weight }
280 {
281 reset-text-series~=~false , ~
282 text-series-to-math~=~true
283 }
284 }
285 }
286 \clist_map_inline:nn
287 {
288 detect-display-math ,
289 detect-inline-family ,
290 detect-inline-weight
291 }
292 {
293 \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
294 }
295 % \end{macrocode}
296 %
297 % The old font insertion options.
298 % \begin{macrocode}
299 \clist_map_inline:nn
300 {
301 math-rm ,
302 math-sf ,
303 math-tt ,
304 number-math-rm ,
305 number-math-sf ,
306 number-math-tt ,
307 number-text-rm ,
308 number-text-sf ,
309 number-text-tt ,
310 text-rm ,
311 text-sf ,
312 text-tt ,
313 unit-math-rm ,
314 unit-math-sf ,
315 unit-math-tt ,
316 unit-text-rm ,
317 unit-text-sf ,
318 unit-text-tt
319 }
320 {
321 \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
322 }
323 % \end{macrocode}
324 %
325 % One that accidentally ended up in \emph{The \LaTeX{} Companion}.
326 % \begin{macrocode}
327 \keys_define:nn { siunitx }
328 {
329 reset-font-series .code:n =
330 {
331 \@@_option_deprecated:nn
332 { reset-font-series }
333 { reset-text-series }
334 } ,
335 }
336 % \end{macrocode}
337 %
338 % \subsection{Symbol options}
339 %
340 % \begin{macrocode}
341 \clist_map_inline:nn
342 {
343 math-angstrom ,
344 math-arcminute ,
345 math-arcsecond ,
346 math-celsius ,
347 math-degree ,
348 math-micro ,
349 math-ohm ,
350 text-angstrom ,
351 text-arcminute ,
352 text-arcsecond ,
353 text-celsius ,
354 text-degree ,
355 text-micro ,
356 text-ohm ,
357 }
358 {
359 \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
360 }
361 % \end{macrocode}
362 %
363 % \subsection{Number options}
364 %
365 % \begin{macrocode}
366 \keys_define:nn { siunitx }
367 {
368 group-digits / false .code:n =
369 {
370 \@@_option_deprecated:nn
371 { group-digits ~ = ~ false }
372 { group-digits ~ = ~ none }
373 } ,
374 group-digits / true .code:n =
375 {
376 \@@_option_deprecated:nn
377 { group-digits ~ = ~ true }
378 { group-digits ~ = ~ all }
379 } ,
380 input-symbols .code:n =
381 {
382 \msg_info:nnnn { siunitx } { option-deprecated }
383 { input-symbols } { input-digits }
384 \tl_put_right:Nn \l_@@_number_input_digit_tl {#1}
385 } ,
386 separate-uncertainty .choice: ,
387 separate-uncertainty / false .code:n =
388 {
389 \@@_option_deprecated:nn
390 { separate-uncertainty }
391 { uncertainty-mode~=~compact }
392 } ,
393 separate-uncertainty / true .code:n =
394 {
395 \@@_option_deprecated:nn
396 { separate-uncertainty }
397 { uncertainty-mode~=~separate }
398 } ,
399 separate-uncertainty .default:n = true
400 }
401 % \end{macrocode}
402 %
403 % A small number of removed options.
404 % \begin{macrocode}
405 \clist_map_inline:nn
406 {
407 input-protect-tokens ,
408 input-quotient ,
409 output-product ,
410 quotient-mode
411 }
412 {
413 \keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
414 }
415 % \end{macrocode}
416 %
417 % Options for number processing: largely removals.
418 % \begin{macrocode}
419 \keys_define:nn { siunitx }
420 {
421 add-decimal-zero .choice: ,
422 add-decimal-zero / false .code:n =
423 {
424 \@@_option_deprecated:nn
425 { add-decimal-zero }
426 { minimum-decimal-digits~=~0 }
427 } ,
428 add-decimal-zero / true .code:n =
429 {
430 \@@_option_deprecated:nn
431 { add-decimal-zero }
432 { minimum-decimal-digits~=~1 }
433 } ,
434 add-decimal-zero .default:n = true ,
435 add-integer-zero .code:n =
436 {
437 \@@_option_deprecated:nn
438 { add-integer-zero }
439 { print-zero-integer }
440 } ,
441 close-bracket .code:n =
442 { \@@_option_removed:V \l_keys_key_str } ,
443 bracket-numbers .choice: ,
444 bracket-numbers / false .code:n =
445 {
446 \@@_option_deprecated:nn
447 { bracket-numbers }
448 { bracket-ambiguous-numbers~=~false }
449 } ,
450 bracket-numbers / true .code:n =
451 {
452 \@@_option_deprecated:nn
453 { bracket-numbers }
454 { bracket-ambiguous-numbers~=~true }
455 } ,
456 bracket-numbers .default:n = true ,
457 explicit-sign .code:n =
458 {
459 \str_if_eq:nnTF {#1} { + }
460 {
461 \@@_option_deprecated:nn
462 { explicit-sign }
463 { print-implicit-plus~=~true }
464 }
465 { \@@_option_removed:V \l_keys_key_str }
466 } ,
467 group-four-digits .choice: ,
468 group-four-digits / false .code:n =
469 {
470 \@@_option_deprecated:nn
471 { group-four-digits~=~false }
472 { group-minimum-digits~=~5 }
473 } ,
474 group-four-digits / true .code:n =
475 {
476 \@@_option_deprecated:nn
477 { group-four-digits~=~false }
478 { group-minimum-digits~=~4 }
479 } ,
480 bracket-numbers .default:n = true ,
481 omit-uncertainty .code:n =
482 {
483 \@@_option_deprecated:nnn
484 { omit-uncertainty }
485 { drop-uncertainty }
486 {#1}
487 } ,
488 omit-uncertainty .default:n = true ,
489 open-bracket .code:n =
490 { \@@_option_removed:V \l_keys_key_str } ,
491 retain-unity-mantissa .code:n =
492 {
493 \@@_option_deprecated:nnn
494 { retain-unity-mantissa }
495 { print-unity-mantissa }
496 {#1}
497 } ,
498 retain-unity-mantissa .default:n = true ,
499 retain-zero-exponent .code:n =
500 {
501 \@@_option_deprecated:nnn
502 { retain-zero-exponent }
503 { print-zero-exponent }
504 {#1}
505 } ,
506 retain-zero-exponent .default:n = true ,
507 round-integer-to-decimal .code:n =
508 { \@@_option_removed:V \l_keys_key_str } ,
509 scientific-notation .choice: ,
510 scientific-notation / engineering .code:n =
511 {
512 \@@_option_deprecated:nn
513 { scientific-notation~=~engineering }
514 { exponent-mode~=~engineering }
515 } ,
516 scientific-notation / fixed .code:n =
517 {
518 \@@_option_deprecated:nn
519 { scientific-notation~=~fixed }
520 { exponent-mode~=~fixed }
521 } ,
522 scientific-notation / false .code:n =
523 {
524 \@@_option_deprecated:nn
525 { scientific-notation~=~false }
526 { exponent-mode~=~input }
527 } ,
528 scientific-notation / true .code:n =
529 {
530 \@@_option_deprecated:nn
531 { scientific-notation~=~true }
532 { exponent-mode~=~scientific }
533 } ,
534 scientific-notation .default:n = true ,
535 zero-decimal-to-integer .code:n =
536 {
537 \@@_option_deprecated:nnn
538 { zero-decimal-to-integer }
539 { drop-zero-decimal }
540 {#1}
541 } ,
542 zero-decimal-to-integer .default:n = true
543 }
544 % \end{macrocode}
545 %
546 % \subsubsection{Table options}
547 %
548 % All straight-forward emulation.
549 % \begin{macrocode}
550 \keys_define:nn { siunitx }
551 {
552 table-align-text-post .code:n =
553 {
554 \@@_option_deprecated:nnn
555 { table-align-text-post }
556 { table-align-text-after }
557 {#1}
558 } ,
559 table-align-text-post .default:n = true ,
560 table-align-text-pre .code:n =
561 {
562 \@@_option_deprecated:nnn
563 { table-align-text-pre }
564 { table-align-text-before }
565 {#1}
566 } ,
567 table-align-text-pre .default:n = true ,
568 table-number-alignment / center-decimal-marker .code:n =
569 {
570 \msg_info:nnnn { siunitx } { option-deprecated }
571 { table-number-alignment~=~center-decimal-marker }
572 { table-alignment-mode~=~marker }
573 \keys_set:nn
574 { siunitx }
575 { table-alignment-mode = marker }
576 } ,
577 table-omit-exponent .code:n =
578 {
579 \msg_info:nnnn { siunitx } { option-deprecated }
580 { table-omit-exponent } { drop-exponent }
581 \str_if_eq:VnTF \l_keys_value_tl { true }
582 {
583 \keys_set:nn
584 { siunitx }
585 { drop-exponent = true , exponent-mode = fixed }
586 }
587 {
588 \keys_set:nn
589 { siunitx }
590 { drop-exponent = false }
591 }
592 } ,
593 table-omit-exponent .default:n = true ,
594 table-parse-only .code:n =
595 {
596 \msg_info:nnnn { siunitx } { option-deprecated }
597 { table-parse-only }
598 { table-alignment-mode~=~none }
599 \str_if_eq:VnTF \l_keys_value_tl { false }
600 {
601 \keys_set:nn
602 { siunitx }
603 { table-alignment-mode = marker }
604 }
605 {
606 \keys_set:nn
607 { siunitx }
608 { table-alignment-mode = none }
609 }
610 } ,
611 table-space-text-post .code:n =
612 {
613 \msg_info:nnnn { siunitx } { option-deprecated }
614 { table-space-text-post }
615 { table-format }
616 \tl_set:Nn \l_@@_table_after_model_tl {#1}
617 } ,
618 table-space-text-pre .code:n =
619 {
620 \msg_info:nnnn { siunitx } { option-deprecated }
621 { table-space-text-pre }
622 { table-format }
623 \tl_set:Nn \l_@@_table_before_model_tl {#1}
624 }
625 }
626 % \end{macrocode}
627 %
628 % \begin{macro}{\@@_option_table_format:n}
629 % \begin{macro}
630 % {
631 % \@@_option_table_comparator:nnnnnnn ,
632 % \@@_option_table_figures-decimal:nnnnnnnn ,
633 % \@@_option_table_figures-exponent:nnnnnnnn ,
634 % \@@_option_table_figures-integer:nnnnnnnn ,
635 % \@@_option_table_figures-uncertainty:nnnnnnnn ,
636 % \@@_option_table_sign-exponent:nnnnnnnn ,
637 % \@@_option_table_sign-mantissa:nnnnnnnn
638 % }
639 % \begin{macrocode}
640 \cs_new_protected:Npn \@@_option_table_format:n #1
641 {
642 \msg_info:nnnn { siunitx } { option-deprecated }
643 { table- #1 }
644 { table-format }
645 \tl_set:Ne \l_@@_table_format_tl
646 {
647 \cs:w @@_option_table_ #1 :nnnnnnnn
648 \exp_after:wN \exp_after:wN \exp_after:wN \cs_end:
649 \exp_after:wN \l_@@_table_format_tl
650 \exp_after:wN { \l_keys_value_tl }
651 }
652 \exp_after:wN \@@_table_generate_model:nnnnnnn
653 \l_@@_table_format_tl
654 }
655 \cs_new:Npn \@@_option_table_comparator:nnnnnnnn #1#2#3#4#5#6#7#8
656 { \exp_not:n { {#8} {#2} {#3} {#4} {#5} {#6} {#7} } }
657 \cs_new:cpn { @@_option_table_figures-decimal:nnnnnnnn }
658 #1#2#3#4#5#6#7#8
659 { \exp_not:n { {#1} {#2} {#3} {#8} {#5} {#6} {#7} } }
660 \cs_new:cpn { @@_option_table_figures-exponent:nnnnnnnn }
661 #1#2#3#4#5#6#7#8
662 { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#8} } }
663 \cs_new:cpn { @@_option_table_figures-integer:nnnnnnnn }
664 #1#2#3#4#5#6#7#8
665 { \exp_not:n { {#1} {#2} {#8} {#4} {#5} {#6} {#7} } }
666 \cs_new:cpn { @@_option_table_figures-uncertainty:nnnnnnnn }
667 #1#2#3#4#5#6#7#8
668 { \exp_not:n { {#1} {#2} {#3} {#4} { { S } {#8} } {#6} {#7} } }
669 \cs_new:cpn { @@_option_table_sign-exponent:nnnnnnnn }
670 #1#2#3#4#5#6#7#8
671 { \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#8} {#7} } }
672 \cs_new:cpn { @@_option_table_sign-mantissa:nnnnnnnn }
673 #1#2#3#4#5#6#7#8
674 { \exp_not:n { {#1} {#8} {#3} {#4} {#5} {#6} {#7} } }
675 % \end{macrocode}
676 % \end{macro}
677 % \end{macro}
678 %
679 % Options which all use the same emulation set up.
680 % \begin{macrocode}
681 \keys_define:nn { siunitx }
682 {
683 table-comparator .code:n =
684 { \@@_option_table_format:n { comparator } } ,
685 table-figures-decimal .code:n =
686 { \@@_option_table_format:n { figures-decimal } } ,
687 table-figures-exponent .code:n =
688 { \@@_option_table_format:n { figures-exponent } } ,
689 table-figures-integer .code:n =
690 { \@@_option_table_format:n { figures-integer } } ,
691 table-figures-uncertainty .code:n =
692 { \@@_option_table_format:n { figures-uncertainty } } ,
693 table-sign-exponent .code:n =
694 { \@@_option_table_format:n { sign-exponent } } ,
695 table-sign-mantissa .code:n =
696 { \@@_option_table_format:n { sign-mantissa } }
697 }
698 % \end{macrocode}
699 %
700 % \subsection{Unit options}
701 %
702 % \begin{macrocode}
703 \keys_define:nn { siunitx }
704 {
705 fraction-function .code:n =
706 {
707 \@@_option_deprecated:nnn
708 { fraction-function }
709 { fraction-command }
710 {#1}
711 } ,
712 literal-superscript-as-power .code:n =
713 { \@@_option_removed:V \l_keys_key_str } ,
714 power-font .code:n =
715 { \@@_option_removed:V \l_keys_key_str } ,
716 qualifier-mode / brackets .code:n =
717 {
718 \@@_option_deprecated:nn
719 { qualifier-mode~=~brackets }
720 { qualifier-mode~=~bracket }
721 } ,
722 qualifier-mode / space .code:n =
723 {
724 \msg_info:nnnn { siunitx } { option-deprecated }
725 { qualifier-mode~=~space }
726 { qualifier-mode~=~phrase"~plus~"qualifier-phrase=\ }
727 \keys_set:nn
728 { siunitx }
729 { qualifier-mode = phrase, qualifier-phrase = \ }
730 } ,
731 qualifier-mode / text .code:n =
732 {
733 \@@_option_deprecated:nn
734 { qualifier-mode~=~text }
735 { qualifier-mode~=~combine }
736 }
737 }
738 % \end{macrocode}
739 %
740 % The deprecated settings for |per-mode| have to be handled manually as
741 % |per-mode| is no longer a choice.
742 % \begin{macrocode}
743 \keys_define:nn { siunitx }
744 {
745 display-per-mode / reciprocal .code:n =
746 {
747 \@@_option_deprecated:nn
748 { per-mode~=~reciprocal }
749 { per-mode~=~power }
750 } ,
751 inline-per-mode / reciprocal .code:n =
752 {
753 \@@_option_deprecated:nn
754 { per-mode~=~reciprocal }
755 { per-mode~=~power }
756 } ,
757 display-per-mode / reciprocal-positive-first .code:n =
758 {
759 \@@_option_deprecated:nn
760 { per-mode~=~reciprocal-positive-first }
761 { per-mode~=~power-positive-first }
762 } ,
763 inline-per-mode / reciprocal-positive-first .code:n =
764 {
765 \@@_option_deprecated:nn
766 { per-mode~=~reciprocal-positive-first }
767 { per-mode~=~power-positive-first }
768 }
769 }
770 % \end{macrocode}
771 %
772 % \subsection{Quantity units}
773 %
774 % \begin{macrocode}
775 \keys_define:nn { siunitx }
776 {
777 allow-number-unit-breaks .code:n =
778 {
779 \@@_option_deprecated:nnn
780 { allow-number-unit-breaks }
781 { allow-quantity-breaks }
782 {#1}
783 } ,
784 allow-number-unit-breaks .default:n = true ,
785 exponent-to-prefix .choice: ,
786 exponent-to-prefix / false .code:n =
787 {
788 \@@_option_deprecated:nn
789 { exponent-to-prefix~=~false }
790 { prefix-mode~=~input }
791 } ,
792 exponent-to-prefix / true .code:n =
793 {
794 \@@_option_deprecated:nn
795 { exponent-to-prefix~=~true }
796 { prefix-mode~=~combine-exponent }
797 } ,
798 exponent-to-prefix .default:n = true ,
799 multi-part-units .choice: ,
800 multi-part-units / brackets . code:n =
801 {
802 \@@_option_deprecated:nn
803 { multi-part-units~=~brackets }
804 { separate-uncertainty-units~=~bracket }
805 } ,
806 multi-part-units / repeat . code:n =
807 {
808 \@@_option_deprecated:nn
809 { multi-part-units~=~repeat }
810 { separate-uncertainty-units~=~repeat }
811 } ,
812 multi-part-units / single . code:n =
813 {
814 \@@_option_deprecated:nn
815 { multi-part-units~=~single }
816 { separate-uncertainty-units~=~single }
817 } ,
818 number-unit-product .code:n =
819 {
820 \@@_option_deprecated:nnn
821 { number-unit-product }
822 { quantity-product }
823 {#1}
824 } ,
825 number-unit-separator .code:n =
826 {
827 \@@_option_deprecated:nnn
828 { number-unit-separator }
829 { quantity-product }
830 {#1}
831 } ,
832 prefixes-as-symbols .choice: ,
833 prefixes-as-symbols / false . code:n =
834 {
835 \@@_option_deprecated:nn
836 { prefixes-as-symbols~=~false }
837 { prefix-mode~=~extract-exponent }
838 } ,
839 prefixes-as-symbols / true . code:n =
840 {
841 \@@_option_deprecated:nn
842 { prefixes-as-symbols~=~true }
843 { prefix-mode~=~input }
844 } ,
845 prefixes-as-symbols .default:n = true
846 }
847 % \end{macrocode}
848 %
849 % \begin{macrocode}
850 %</options>
851 % \end{macrocode}
852 %
853 % \begin{macrocode}
854 %<*interfaces>
855 % \end{macrocode}
856 %
857 % \subsection{Unit commands}
858 %
859 % \begin{macro}{\@@_non_latin:n}
860 % A shortcut.
861 % \begin{macrocode}
862 \cs_new:Npn \@@_non_latin:n #1
863 { \codepoint_generate:nn {#1} { \char_value_catcode:n {#1} } }
864 % \end{macrocode}
865 % \end{macro}
866 %
867 % Units that have been removed: to avoid issues, we mark them as deprecated.
868 % \begin{macrocode}
869 \msg_new:nnn { siunitx } { unit-deprecated }
870 {
871 Unit~macro~#1~has~been~deprecated~in~this~release. \\ \\
872 The~BIPM~have~removed~this~unit~from~the~SI~Brochure.~
873 You~should~define~it~yourself~using~\token_to_str:N \DeclareSIUnit\ %
874 in~your~source.~The~current~definition~is\\ \\
875 \token_to_str:N \DeclareSIUnit #1 \{ #2 \}
876 }
877 \cs_set_protected:Npn \@@_tmp:w #1#2
878 {
879 \quark_if_recursion_tail_stop:N #1
880 \bool_new:c { g_@@_unit_warning_ \token_to_str:N #1 _bool }
881 \siunitx_declare_unit:Ne #1
882 {
883 \exp_not:N \bool_if:NF
884 \exp_not:c { g_@@_unit_warning_ \token_to_str:N #1 _bool }
885 {
886 \exp_not:N \bool_gset_true:N
887 \exp_not:c { g_@@_unit_warning_ \token_to_str:N #1 _bool }
888 \msg_warning:nnnn { siunitx } { unit-deprecated }
889 { \token_to_str:N #1 } {#2}
890 }
891 #2
892 }
893 \@@_tmp:w
894 }
895 \@@_tmp:w
896 \atomicmassunit { u }
897 \bar { bar }
898 \barn { b }
899 \bohr
900 {
901 \exp_not:N \text
902 { \exp_not:N \ensuremath { a } } \char_generate:nn { `\_ } { 8 } { 0 }
903 }
904 \clight
905 {
906 \exp_not:N \text
907 { \exp_not:N \ensuremath { c } } \char_generate:nn { `\_ } { 8 } { 0 }
908 }
909 \electronmass
910 {
911 \exp_not:N \text { \exp_not:N \ensuremath { m } }
912 \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { e } }
913 }
914 \elementarycharge { \text { \ensuremath { e } } }
915 \hartree
916 {
917 \exp_not:N \text { \exp_not:N \ensuremath { E } }
918 \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { h } }
919 }
920 \knot { kn }
921 \mmHg { mmHg }
922 \nauticalmile { M }
923 \planckbar
924 { \exp_not:N \text { \exp_not:N \ensuremath { \exp_not:N \hbar } } }
925 \q_recursion_tail { }
926 \q_recursion_stop
927 \@ifpackageloaded { fontspec }
928 {
929 \@@_tmp:w \angstrom { \@@_non_latin:n { "00C5 } }
930 }
931 {
932 \@@_tmp:w \angstrom
933 { \exp_not:N \text { \@@_non_latin:n { "00C5 } } }
934 }
935 \q_recursion_tail { }
936 \q_recursion_stop
937 % \end{macrocode}
938 %
939 % The above are always available, but past here are interfaces from
940 % version~2 only.
941 % \begin{macrocode}
942 \bool_if:NT \l_@@_disable_cmds_bool
943 { \file_input_stop: }
944 % \end{macrocode}
945 %
946 % \begin{macro}{\celsius}
947 % Deprecated but should work.
948 % \begin{macrocode}
949 \siunitx_declare_unit:Nn \celsius { \degreeCelsius }
950 % \end{macrocode}
951 % \end{macro}
952 %
953 % \subsection{Symbol commands}
954 %
955 % \begin{macro}
956 % {
957 % \SIUnitSymbolAngstrom ,
958 % \SIUnitSymbolArcminute ,
959 % \SIUnitSymbolArcsecond ,
960 % \SIUnitSymbolCelsius ,
961 % \SIUnitSymbolDegree ,
962 % \SIUnitSymbolMicro ,
963 % \SIUnitSymbolOhm
964 % }
965 % The same setup as elsewhere but localised to the emulation module
966 % \begin{macrocode}
967 \AtBeginDocument
968 {
969 \cs_new_protected:Npn \SIUnitSymbolArcminute
970 { \ensuremath { { } ' } }
971 \cs_new_protected:Npn \SIUnitSymbolArcsecond
972 { \ensuremath { { } '' } }
973 \@ifpackageloaded { fontspec }
974 {
975 \cs_new_protected:Npe \SIUnitSymbolAngstrom
976 { \@@_non_latin:n { "00C5 } }
977 \cs_new_protected:Npe \SIUnitSymbolDegree
978 { \@@_non_latin:n { "00B0 } }
979 \cs_new_protected:Npe \SIUnitSymbolCelsius
980 { \@@_non_latin:n { "00B0 } C }
981 }
982 {
983 \cs_new_protected:Npe \SIUnitSymbolAngstrom
984 {
985 \siunitx_print_text:n
986 { \@@_non_latin:n { "00C5 } }
987 }
988 \cs_new_protected:Npe \SIUnitSymbolCelsius
989 {
990 \siunitx_print_text:n
991 { \@@_non_latin:n { "00B0 } } C
992 }
993 \cs_new_protected:Npe \SIUnitSymbolDegree
994 {
995 \siunitx_print_text:n
996 { \@@_non_latin:n { "00B0 } }
997 }
998 }
999 \cs_new_protected:Npe \SIUnitSymbolMicro
1000 {
1001 \siunitx_print_text:n
1002 {
1003 \bool_lazy_or:nnTF
1004 { \sys_if_engine_luatex_p: }
1005 { \sys_if_engine_xetex_p: }
1006 { \@@_non_latin:n { "00B5 } }
1007 { \exp_not:N \textmu }
1008 }
1009 }
1010 \cs_new_protected:Npe \SIUnitSymbolOhm
1011 {
1012 \exp_not:N \TextOrMath
1013 {
1014 \siunitx_print_text:n
1015 {
1016 \bool_lazy_or:nnTF
1017 { \sys_if_engine_luatex_p: }
1018 { \sys_if_engine_xetex_p: }
1019 { \@@_non_latin:n { "03A9 } }
1020 { \exp_not:N \textohm }
1021 }
1022 }
1023 {
1024 \cs_if_exist:NTF \upOmega
1025 { \exp_not:N \upOmega }
1026 { \exp_not:N \Omega }
1027 }
1028 }
1029 }
1030 % \end{macrocode}
1031 % \end{macro}
1032 %
1033 % \subsection{Preamble commands}
1034 %
1035 % \begin{macro}{\DeclareBinaryPrefix}
1036 % We simply drop |#3|.
1037 % \begin{macrocode}
1038 \NewDocumentCommand \DeclareBinaryPrefix { +m m m }
1039 {
1040 \siunitx_declare_prefix:Nn #1 {#2}
1041 }
1042 % \end{macrocode}
1043 % \end{macro}
1044 %
1045 % \begin{macro}{\DeclareSIPrePower, \DeclareSIPostPower}
1046 % Simply use a throw-away command for the part we do not need: this can
1047 % be followed by some clean-up.
1048 % \begin{macrocode}
1049 \NewDocumentCommand \DeclareSIPrePower { +m m }
1050 {
1051 \siunitx_declare_power:NNn #1 \@@_tmp:w {#2}
1052 \seq_remove_all:Nn \l_siunitx_unit_symbolic_seq { \@@_tmp:w }
1053 }
1054 \NewDocumentCommand \DeclareSIPostPower { +m m }
1055 {
1056 \siunitx_declare_power:NNn \@@_tmp:w #1 {#2}
1057 \seq_remove_all:Nn \l_siunitx_unit_symbolic_seq { \@@_tmp:w }
1058 }
1059 % \end{macrocode}
1060 % \end{macro}
1061 %
1062 % \subsection{Document commands}
1063 %
1064 % \begin{macro}{\si}
1065 % A straight copy of \cs{unit}.
1066 % \begin{macrocode}
1067 \NewDocumentCommand \si { O { } > { \TrimSpaces } m }
1068 {
1069 \mode_leave_vertical:
1070 \group_begin:
1071 \siunitx_unit_options_apply:n {#2}
1072 \keys_set:nn { siunitx } {#1}
1073 \siunitx_unit_format:nN {#2} \l_@@_tmp_tl
1074 \siunitx_print_unit:V \l_@@_tmp_tl
1075 \group_end:
1076 }
1077 % \end{macrocode}
1078 % \end{macro}
1079 %
1080 % \begin{macro}{\SI}
1081 % Almost the same as \cs{qty}, but with the addition pre-unit.
1082 % \begin{macrocode}
1083 \NewDocumentCommand \SI { O { } m o > { \TrimSpaces } m }
1084 {
1085 \mode_leave_vertical:
1086 \group_begin:
1087 \siunitx_unit_options_apply:n {#4}
1088 \keys_set:nn { siunitx } {#1}
1089 \IfNoValueF {#3}
1090 {
1091 \siunitx_unit_format:nN {#3} \l_@@_tmp_tl
1092 \siunitx_print_unit:V \l_@@_tmp_tl
1093 \nobreak
1094 }
1095 \siunitx_quantity:nn {#2} {#4}
1096 \group_end:
1097 }
1098 % \end{macrocode}
1099 % \end{macro}
1100 %
1101 % \begin{macro}{\SIlist, \SIrange}
1102 % Straight copies.
1103 % \begin{macrocode}
1104 \NewDocumentCommand \SIlist
1105 { O { } > { \SplitList { ; } } m > { \TrimSpaces } m }
1106 {
1107 \mode_leave_vertical:
1108 \group_begin:
1109 \siunitx_unit_options_apply:n {#3}
1110 \keys_set:nn { siunitx } {#1}
1111 \siunitx_quantity_list:nn {#2} {#3}
1112 \group_end:
1113 }
1114 \NewDocumentCommand \SIrange { O { } m m > { \TrimSpaces } m }
1115 {
1116 \mode_leave_vertical:
1117 \group_begin:
1118 \siunitx_unit_options_apply:n {#4}
1119 \keys_set:nn { siunitx } {#1}
1120 \siunitx_quantity_range:nnn {#2} {#3} {#4}
1121 \group_end:
1122 }
1123 % \end{macrocode}
1124 % \end{macro}
1125 %
1126 % \subsection{Communication with \pkg{pgf}}
1127 %
1128 % \begin{macrocode}
1129 %<@@=siunitx_number>
1130 % \end{macrocode}
1131 %
1132 % \begin{macro}{\SendSettingsToPgf}
1133 % \begin{macrocode}
1134 \NewDocumentCommand \SendSettingsToPgf { }
1135 {
1136 \use:e
1137 {
1138 \exp_not:N \pgfqkeys { /pgf/number~format }
1139 {
1140 \str_if_eq:VnT \l_@@_round_mode_tl { figures }
1141 {
1142 fixed ,
1143 fixed~zerofill = true ,
1144 }
1145 precision = \int_use:N \l_@@_round_precision_int ,
1146 set~decimal~separator =
1147 \str_if_eq:VnTF \l_siunitx_number_output_decimal_tl { , }
1148 { \exp_not:N \mathord }
1149 { \use:n }
1150 { \exp_not:V \l_siunitx_number_output_decimal_tl } ,
1151 set~thousands~separator =
1152 set~decimal~separator =
1153 \str_if_eq:VnTF \l_@@_group_separator_tl { , }
1154 { \exp_not:N \mathord }
1155 { \use:n }
1156 { \exp_not:V \l_@@_group_separator_tl } ,
1157 min~exponent~for~1000~sep =
1158 \int_eval:n { \l_@@_group_minimum_int - 1 } ,
1159 \bool_lazy_or:nnF
1160 { \l_@@_group_decimal_bool }
1161 { \l_@@_group_integer_bool }
1162 { min~exponent~for~1000~sep = 999 , }
1163 showpos =
1164 \bool_if:NTF \l_@@_implicit_plus_bool
1165 { true }
1166 { false }
1167 }
1168 }
1169 }
1170 % \end{macrocode}
1171 % \end{macro}
1172 %
1173 % \begin{macrocode}
1174 %</interfaces>
1175 % \end{macrocode}
1176 %
1177 % \begin{macrocode}
1178 %</package>
1179 % \end{macrocode}
1180 %
1181 % \end{implementation}
1182 %
1183 % \PrintIndex