summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx')
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx42
1 files changed, 29 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
index 21a8fa3be9b..af0b882c947 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
@@ -66,7 +66,7 @@
% assumptions concerning \LaTeXe{} commands in the submodule beyond those in the
% core number and unit submodules.
%
-% \begin{function}{\siunitx_complex_number:n}
+% \begin{function}{\siunitx_complex_number:n, \siunitx_complex_number:x}
% \begin{syntax}
% \cs{siunitx_complex_number:n} \Arg{number}
% \end{syntax}
@@ -93,7 +93,12 @@
% \cs{siunitx_complex_number:n}.
% \end{function}
%
-% \begin{function}{\siunitx_complex_quantity:nn, \siunitx_complex_quantity:nnn}
+% \begin{function}
+% {
+% \siunitx_complex_quantity:nn ,
+% \siunitx_complex_quantity:xn ,
+% \siunitx_complex_quantity:nnn
+% }
% \begin{syntax}
% \cs{siunitx_complex_quantity:nn} \Arg{number} \Arg{units}
% \cs{siunitx_complex_quantity:nnn} \Arg{magnitude} \Arg{angle} \Arg{units}
@@ -686,9 +691,9 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\siunitx_complex_number:n}
+% \begin{macro}{\siunitx_complex_number:n, \siunitx_complex_number:x}
% \begin{macro}{\siunitx_complex_number:nn, \@@_number:nn}
-% \begin{macro}{\siunitx_complex_quantity:nn}
+% \begin{macro}{\siunitx_complex_quantity:nn, \siunitx_complex_quantity:xn}
% \begin{macro}{\siunitx_complex_quantity:nnn, \@@_quantity:nnn}
% The work here is pretty trivial: only conversion between forms makes
% things a bit more intricate.
@@ -717,6 +722,7 @@
}
}
}
+\cs_generate_variant:Nn \siunitx_complex_number:n { x }
\cs_new_protected:Npn \siunitx_complex_number:nn #1#2
{
\bool_lazy_or:nnTF
@@ -734,7 +740,7 @@
{ \l_@@_force_cartesian_bool }
{ \l_siunitx_number_parse_bool }
{
- \exp_args:Ne \siunitx_complex_number:n
+ \siunitx_complex_number:x
{ \@@_convert_cartesian:nn {#1} {#2} }
}
{
@@ -764,6 +770,7 @@
{ \siunitx_quantity:nn {#1} {#2} }
}
}
+\cs_generate_variant:Nn \siunitx_complex_quantity:nn { x }
\cs_new_protected:Npn \siunitx_complex_quantity:nnn #1#2#3
{
\bool_lazy_or:nnTF
@@ -781,7 +788,7 @@
{ \l_@@_force_cartesian_bool }
{ \l_siunitx_number_parse_bool }
{
- \exp_args:Ne \siunitx_complex_quantity:nn
+ \siunitx_complex_quantity:xn
{ \@@_convert_cartesian:nn {#1} {#2} }
{#3}
}
@@ -1053,7 +1060,7 @@
\siunitx_print_number:V \l_@@_tmp_tl
\bool_if:NT \l_@@_polar_degree_bool
{
- \exp_args:NV \siunitx_unit_format:nN \l_@@_symbol_degree_tl \l_@@_tmp_tl
+ \siunitx_unit_format:VN \l_@@_symbol_degree_tl \l_@@_tmp_tl
\nobreak
\siunitx_print_unit:V \l_@@_tmp_tl
}
@@ -1087,14 +1094,18 @@
% \subsection{Conversion}
%
% \begin{macro}[EXP]
-% {\@@_convert_cartesian:nn, \@@_convert_cartesian_aux:nn}
+% {
+% \@@_convert_cartesian:nn ,
+% \@@_convert_cartesian_aux:nn ,
+% \@@_convert_cartesian_aux:ee
+% }
% \begin{macro}[EXP]{\@@_convert_cartesian_aux:w}
% Conversion to Cartesian form is easy as we have two inputs and need to
% do no parsing here at all.
% \begin{macrocode}
\cs_new:Npn \@@_convert_cartesian:nn #1#2
{
- \exp_args:Nee \@@_convert_cartesian_aux:nn
+ \@@_convert_cartesian_aux:ee
{
\fp_to_tl:n
{ (#1) * cos \bool_if:NT \l_@@_polar_degree_bool { d } (#2) }
@@ -1108,6 +1119,7 @@
{
\@@_convert_cartesian_aux:w #1 e e \q_mark #2 e e \q_stop
}
+\cs_generate_variant:Nn \@@_convert_cartesian_aux:nn { ee }
\cs_new:Npn \@@_convert_cartesian_aux:w
#1 e #2 e #3 \q_mark #4 e #5 e #6 \q_stop
{
@@ -1132,8 +1144,10 @@
% \begin{macro}[EXP]{\@@_convert_polar_auxiv:nnw}
% \begin{macro}[EXP]{\@@_convert_polar_auxv:nnw}
% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnn}
-% \begin{macro}[EXP]{\@@_convert_polar_auxvii:nnn}
-% \begin{macro}[EXP]{\@@_convert_polar_auxviii:nn}
+% \begin{macro}[EXP]
+% {\@@_convert_polar_auxvii:nnn, \@@_convert_polar_auxvii:eee}
+% \begin{macro}[EXP]
+% {\@@_convert_polar_auxviii:nn, \@@_convert_polar_auxviii:ee}
% A simplified parser for complex numbers which works by expansion,
% then converts to polar form.
% \begin{macrocode}
@@ -1181,21 +1195,23 @@
}
\cs_new:Npn \@@_convert_polar_auxvi:nnn #1#2#3
{
- \exp_args:Neee \@@_convert_polar_auxvii:nnn
+ \@@_convert_polar_auxvii:eee
{ \tl_if_blank:nTF {#1} { 0 } {#1} }
{ \tl_if_blank:nTF {#2} { 0 } {#2} }
{ \tl_if_blank:nF {#3} { e#3 } }
}
\cs_new:Npn \@@_convert_polar_auxvii:nnn #1#2#3
{
- \exp_args:Nee \@@_format_polar_auxviii:nn
+ \@@_format_polar_auxviii:ee
{ \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } }
{
\fp_eval:n
{ atan \bool_if:NT \l_@@_polar_degree_bool { d } (#2 , #1) }
}
}
+\cs_generate_variant:Nn \@@_convert_polar_auxvii:nnn { eee }
\cs_new:Npn \@@_format_polar_auxviii:nn #1#2 { {#1} {#2} }
+\cs_generate_variant:Nn \@@_format_polar_auxviii:nn { ee }
% \end{macrocode}
% \end{macro}
% \end{macro}