%%
%% This is file `lwarp-siunitx-v2.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx  (with options: `siunitx-v2')
%% This is a generated file.
%% Copyright 2016-2022 Brian Dunn
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.

\RequirePackage{xcolor}% for \convertcolorspec

\LWR@ProvidesPackagePass{siunitx}[=v2]% 2021-04-17

\AtBeginDocument{% in case textcomp was not loaded
    \DeclareSIUnit\bohr{\textit{a}\textsubscript{0}}
    \DeclareSIUnit\clight{\textit{c}\textsubscript{0}}
    \DeclareSIUnit\elementarycharge{\textit{e}}
    \DeclareSIUnit\electronmass{\textit{m}\textsubscript{e}}
    \DeclareSIUnit\hartree{\textit{E}\textsubscript{h}}
    \DeclareSIUnit\planckbar{\LWR@siunitx@textplanckbar}
}% AtBeginDocument

\AtBeginDocument{
\HTMLnewcolumntype{S}[1][]{>{\begingroup\sisetup{#1}}c<{\endgroup}}
\HTMLnewcolumntype{s}[1][]{>{\begingroup\sisetup{#1}}c<{\endgroup}}
}


\ExplSyntaxOn
\AtBeginDocument{
\cs_set_protected:Npn \__siunitx_print_text:
  {
    \LetLtxMacro\@ensuredmath\LWR@origensuredmath%          lwarp
    \tl_replace_all:Nnn \l__siunitx_print_arg_tl { - }
      { \textminus }
    \__siunitx_print_text_aux:
    \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \mp }
      { \ensuremath { \mp } }
    \tl_remove_all:Nn \l__siunitx_print_arg_tl { \mathord }
    \cs_set_eq:NN \PrintSubscript   \__siunitx_print_text_sub:n
    \cs_set_eq:NN \PrintSuperscript \__siunitx_print_text_super:n
    \__siunitx_print_text_aux:NnN
      _ { math_subscript }   \__siunitx_print_text_sub:n
      _ { active }           \__siunitx_print_text_sub:n
      ^ { math_superscript } \__siunitx_print_text_super:n
      ^ { active }           \__siunitx_print_text_super:n
      \q_recursion_tail ?  ?
      \q_recursion_stop
    \l__siunitx_print_arg_tl
  }
}
\cs_new_protected:Npn \LWR@HTML@__siunitx_print_aux:
  {
    \text
      {
        \__siunitx_ensure_ltr:n
          {
            \color@begingroup
            \__siunitx_print_color:
            \__siunitx_font_shape:
            \__siunitx_font_weight:
            \use:c
              {
                __siunitx_ \l__siunitx_print_type_tl _
                text \l__siunitx_font_family_tl :
              }
               {
                    \LWR@findcurrenttextcolor% lwarp
                    \ifdefstring{\LWR@tempcolor}{000000}% lwarp
                        {\__siunitx_print_text:}% lwarp
                        {% lwarp
                            \LWR@textcurrentcolor{% lwarp
                                \__siunitx_print_text:
                            }% lwarp
                        }% lwarp
               }
            \color@endgroup
          }
      }
  }
\LWR@formatted{__siunitx_print_aux:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_set_math_fam:n #1 {
  \group_begin:
        \ensuremath
          {
            \use:c { math #1 }
              {
                \int_const:cn { c__siunitx_math #1 _int } { \fam }
              }
          }
  \group_end:
}
\LWR@formatted{__siunitx_set_math_fam:n}

\cs_new_protected:Npn \LWR@HTML@__siunitx_combined_output:n #1 {
    \group_begin:% lwarp
  \bool_if:NTF \l__siunitx_number_parse_bool
    {
      \tl_clear:N \l__siunitx_number_out_tl
      \bool_set_false:N \l__siunitx_number_compound_bool
      \__siunitx_number_output_parse:n {#1}
    }
    {
        \__siunitx_unit_output_pre_print:
        \begingroup%                            lwarp
            \boolfalse{mathjax}%                lwarp
            \LWR@subsingledollar%       lwarp
                {%  alt text
                    \textbackslash( % space
                    \LWR@HTMLsanitizedetokenized{%
                        \detokenize{#1}%
                    } \textbackslash)%          lwarp
                }
                {siunitx}%  addl hashing
                {%
                    \__siunitx_print:nn { number } {%
                        \LWR@origensuredmath{#1}%
                    }%
                }%                              lwarp
        \endgroup%                              lwarp
        \__siunitx_unit_output_print:
    }
   \group_end:% lwarp
}
\LWR@formatted{__siunitx_combined_output:n}
\cs_new_protected:Npn \LWR@HTML@__siunitx_range_numbers_aux:n #1
  {
    \bool_if:NTF \l__siunitx_number_parse_bool
      {
        \tl_clear:N \l__siunitx_number_out_tl
        \tl_clear:N \l__siunitx_number_out_saved_tl
        \bool_set_false:N \l__siunitx_number_compound_bool
        \__siunitx_number_output_parse:n {#1}
        \bool_if:NT \l__siunitx_number_compound_bool
          { \msg_error:nnx { siunitx } { multi-part-range } {#1} }
      }
      {
        \__siunitx_unit_output_pre_print:
        \begingroup%    lwarp
            \boolfalse{mathjax}%                        lwarp
                \LWR@subsingledollar%                   lwarp
                    {%  alt text
                        \textbackslash( % space
                        \LWR@HTMLsanitizedetokenized{%
                            \detokenize{#1}%
                        } \textbackslash)%              lwarp
                    }%
                    {siunitx}%  addl hashing
                    {%
                        \__siunitx_print:nn { number } {%
                            \LWR@origensuredmath{#1}%
                        } %                             lwarp
                    }%                                  lwarp
        \endgroup%                                      lwarp
        \__siunitx_unit_output_print:
      }
  }
\LWR@formatted{__siunitx_range_numbers_aux:n}
\cs_new_protected:Npn \LWR@HTML@__siunitx_angle_print_direct_aux:nn #1#2 {
  \tl_if_empty:nF {#1}
    {
      \tl_set:Nn \l__siunitx_unit_tl {#2}
        \begingroup%                                    lwarp
            \boolfalse{mathjax}%                        lwarp
                \LWR@subsingledollar{%                  lwarp
                    \textbackslash( % space
                    \LWR@HTMLsanitizedetokenized{%
                        \detokenize{#1}%
                    } \textbackslash)%                  lwarp
                }%
                {siunitx}%
                {%
                    \__siunitx_print:nn { number } {
                        \LWR@origensuredmath{#1}%
                    }%                                  lwarp
                }%                                      lwarp
        \endgroup%                                      lwarp
      \__siunitx_unit_output_print:
    }
}
\LWR@formatted{__siunitx_angle_print_direct_aux:nn}
\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_quotient_fraction: {
  \bool_set_true:N \l__siunitx_number_compound_bool
  \__siunitx_number_output_quotient_aux_i:
  \tl_set_eq:NN \l__siunitx_number_out_tl
    \l__siunitx_number_numerator_tl
  \tl_put_right:NV \l__siunitx_number_out_tl \l__siunitx_output_quotient_tl
  \tl_put_right:NV \l__siunitx_number_out_tl
    \l__siunitx_number_denominator_tl
  \__siunitx_number_output_single_aux:
}
\LWR@formatted{__siunitx_number_output_quotient_fraction:}
\cs_new_protected:Npn \LWR@HTML@__siunitx_unit_format_fraction_fraction: {
  \__siunitx_unit_format_fraction_symbol_aux:
  \int_compare:nNnT { \l__siunitx_unit_denominator_int } > { 1 }
    {
      \bool_if:NT \l__siunitx_unit_denominator_bracket_bool
        {
          \tl_put_left:NV \l__siunitx_unit_denominator_tl \l__siunitx_bracket_open_tl
          \tl_put_right:NV \l__siunitx_unit_denominator_tl \l__siunitx_bracket_close_tl
        }
    }
  \tl_set_eq:NN \l__siunitx_unit_tl \l__siunitx_unit_numerator_tl
  \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_per_symbol_tl
  \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_unit_denominator_tl
}
\LWR@formatted{__siunitx_unit_format_fraction_fraction:}
\cs_new_protected:Npn \LWR@HTML@__siunitx_angle_print_astronomy_aux: {
  \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-integer }
    \l__siunitx_tmpa_tl
    { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl }
 \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp
 {% lateximage
  \hbox_set:Nn \l__siunitx_angle_marker_box
    {
      \__siunitx_print:nn { number } { { \l__siunitx_output_decimal_tl } }
    }
  \hbox_set:Nn \l__siunitx_angle_unit_box
    {
      \__siunitx_print:nV { unit } \l__siunitx_unit_tl
      \skip_horizontal:n { -\scriptspace }
    }
  \__siunitx_angle_print_astronomy_aux:n { marker }
  \__siunitx_angle_print_astronomy_aux:n { unit }
  \hbox_set:Nn \l__siunitx_angle_marker_box
    {
      \box_use:N \l__siunitx_angle_marker_box
      \box_use:N \l__siunitx_angle_unit_box
    }
  \dim_compare:nNnTF
    { \l__siunitx_angle_marker_dim } > { \l__siunitx_angle_unit_dim }
    { \__siunitx_angle_print_astronomy_marker: }
    { \__siunitx_angle_print_astronomy_unit: }
 }% lateximage
 {% not a lateximage
      \__siunitx_print:nn { number } { { \l__siunitx_output_decimal_tl } }
      \__siunitx_print:nV { unit } \l__siunitx_unit_tl
 }% not a lateximage
  \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-decimal }
    \l__siunitx_tmpa_tl
    { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl }
}
\LWR@formatted{__siunitx_angle_print_astronomy_aux:}
\cs_new_protected:Npn \LWR@HTML@__siunitx_textsuperscript:n #1 {\textsuperscript{#1}}
\LWR@formatted{__siunitx_textsuperscript:n}

\cs_new_eq:NN \LWR@HTML@__siunitx_print_text_super:n \textsuperscript
\LWR@formatted{__siunitx_print_text_super:n}

\cs_new_eq:NN \LWR@HTML@__siunitx_print_text_sub:n \textsubscript
\LWR@formatted{__siunitx_print_text_sub:n}

\cs_new_protected:Npn \LWR@HTML@__siunitx_number_format_final_exponent: {
  \prop_get:NnN \l__siunitx_number_out_prop { exponent }
    \l__siunitx_tmpa_tl
  \tl_if_empty:NTF \l__siunitx_output_exponent_tl
    {
      \tl_set:Nx \l__siunitx_tmpa_tl
       { ^ { \exp_not:V \l__siunitx_tmpa_tl } }
      \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_exponent_base_tl
    }
    {
      \tl_set:Nx  \l__siunitx_tmpa_tl
        {
          \LWR@origensuredmath{%    lwarp
            \exp_not:V \l__siunitx_output_exponent_tl
          }%                        lwarp
          \exp_not:N \mathord
          \exp_not:V  \l__siunitx_tmpa_tl
        }
    }
  \prop_put:NnV \l__siunitx_number_out_prop { exponent-result }
    \l__siunitx_tmpa_tl
}
\LWR@formatted{__siunitx_number_format_final_exponent:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_number_format_final_combined: {
  \__siunitx_number_format_brackets:n { mantissa }
  \prop_get:NnN \l__siunitx_number_out_prop { mantissa-result }
    \l__siunitx_tmpa_tl
  \tl_if_empty:NT \l__siunitx_output_exponent_tl
    {
      \tl_put_right:Nx \l__siunitx_tmpa_tl
        {
          \exp_not:N \LWR@origensuredmath%       lwarp
            {
              \bool_if:NTF \l__siunitx_tight_bool
                { {  \exp_not:V \l__siunitx_exponent_product_tl } }
                { { } \exp_not:V \l__siunitx_exponent_product_tl { } }
            }
        }
    }
  \prop_get:NnN \l__siunitx_number_out_prop { exponent-result }
    \l__siunitx_tmpb_tl
  \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl
  \prop_put:NnV \l__siunitx_number_out_prop { result }
    \l__siunitx_tmpa_tl
  \prop_put:Nnn \l__siunitx_number_out_prop
    { result-bracket-exponent } { true }
}
\LWR@formatted{__siunitx_number_format_final_combined:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_parts_aux: {
  \bool_if:NTF \l__siunitx_multi_repeat_bool
    {
      \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result }
        {
          \__siunitx_number_output_parts_aux:n { mantissa }
          \__siunitx_number_output_parts_aux:n { complex }
        }
      \prop_get:NnNT \l__siunitx_number_out_prop { exponent-result }
        \l__siunitx_tmpa_tl
        {
          \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result }
            {
              \tl_put_left:Nx \l__siunitx_tmpa_tl
                {
                  \exp_not:N \LWR@origensuredmath
                    {
                      \bool_if:NTF \l__siunitx_tight_bool
                        { {  \exp_not:V \l__siunitx_exponent_product_tl } }
                        { { } \exp_not:V \l__siunitx_exponent_product_tl { } }
                    }
                }
              \prop_put:NnV \l__siunitx_number_out_prop { exponent }
                \l__siunitx_tmpa_tl
            }
          \__siunitx_number_output_parts_print:n { exponent }
        }
    }
    { \__siunitx_number_output_single: }
}
\LWR@formatted{__siunitx_number_output_parts_aux:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_unit_output_print: {
  \int_compare:nNnF { \l__siunitx_unit_prefix_int } = { 0 }
    {
      \tl_set:Nx \l__siunitx_tmpa_tl
        {
          \bool_if:NTF \l__siunitx_tight_bool
            {
              \exp_not:N \LWR@origensuredmath%      lwarp
                { { \exp_not:V \l__siunitx_exponent_product_tl } }
            }
            {
              \exp_not:N \LWR@origensuredmath%      lwarp
                { { } \exp_not:V \l__siunitx_exponent_product_tl { } }
            }
          \int_use:N \l__siunitx_unit_prefix_base_int
          ^ { \int_use:N \l__siunitx_unit_prefix_int }
        }
      \__siunitx_print:nV { number } \l__siunitx_tmpa_tl
    }
  \tl_if_empty:NF \l__siunitx_unit_tl
    {
      \__siunitx_unit_output_number_sep:
      \__siunitx_print:nV { unit } \l__siunitx_unit_tl
    }
}
\LWR@formatted{__siunitx_unit_output_print:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_range_exponent:
  {
    \bool_if:NT \l__siunitx_process_fixed_bool
      {
        \tl_set_eq:NN \l__siunitx_tmpa_tl \l__siunitx_exponent_product_tl
        \bool_if:NT \l__siunitx_tight_bool
          {
            \tl_set:Nx \l__siunitx_tmpa_tl
              { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpa_tl }
          }
        \tl_set:Nx \l__siunitx_tmpa_tl
          {
            \exp_not:N \LWR@origensuredmath {%      lwarp
                { } \exp_not:o \l__siunitx_tmpa_tl  { }
            }
            10 \exp_not:N \PrintSuperscript
              { \int_use:N \l__siunitx_process_fixed_int }
          }
        \__siunitx_print:nV { number } \l__siunitx_tmpa_tl
      }
  }
\LWR@formatted{__siunitx_range_exponent:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_table_print_S_reserved_exponent_product:
  {
    \tl_set_eq:NN \l__siunitx_tmpb_tl \l__siunitx_exponent_product_tl
    \bool_if:NT \l__siunitx_tight_bool
      {
        \tl_set:Nx \l__siunitx_tmpb_tl
          { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpb_tl }
      }
    \tl_set:Nx \l__siunitx_tmpa_tl
      {
        \exp_not:N \LWR@origensuredmath { { } \exp_not:o \l__siunitx_tmpb_tl  { } }
        \exp_not:o \l__siunitx_tmpa_tl
      }
  }
\LWR@formatted{__siunitx_table_print_S_reserved_exponent_product:}

\cs_new_protected:Npn \LWR@HTML@__siunitx_number_output_product_aux: {
  \bool_set_true:N \l__siunitx_number_compound_bool
  \__siunitx_number_preprocess:V \l__siunitx_number_arg_tl
  \bool_if:NF \l__siunitx_error_bool
    {
      \tl_if_empty:NTF \l__siunitx_number_multi_tl
        { \__siunitx_number_output_parse_aux: }
        { \__siunitx_number_output_quotient: }
      \tl_if_empty:NF \l__siunitx_number_next_tl
        {
          \bool_if:NTF \l__siunitx_tight_bool
            {
              \__siunitx_print:nn { number }
                { \LWR@origensuredmath { \l__siunitx_output_product_tl } }
            }
            {
              \__siunitx_print:nn  { number }
                { \LWR@origensuredmath { { } \l__siunitx_output_product_tl { } } }
            }
          \__siunitx_number_output_parse:V \l__siunitx_number_next_tl
        }
    }
}
\LWR@formatted{__siunitx_number_output_product_aux:}

\cs_set_protected:Npn \__siunitx_set_math_fam:n #1 {
  \group_begin:
    \hbox_set:Nn \l__siunitx_tmp_box
      {
        \LWR@origensuredmath%       lwarp
          {
            \use:c { math #1 }
              {
                \int_const:cn { c__siunitx_math #1 _int } { \fam }
              }
          }
      }
  \group_end:
}

\cs_set_protected:Npn \__siunitx_range_numbers:nn #1#2
  {
    \__siunitx_range_numbers_aux:n {#1}
    \text{\l__siunitx_range_phrase_tl}%     lwarp
    \__siunitx_range_numbers_aux:n {#2}
  }

\cs_set_protected:Npn \__siunitx_range_unit:nnnn #1#2#3#4 {
  \__siunitx_unit_parse_options:nn {#1} {#2}
  \bool_if:NTF \l__siunitx_range_repeat_bool
    {
      \__siunitx_unit_in:nn {#1} {#2}
      \__siunitx_range_numbers_aux:n {#3}
      \text{\l__siunitx_range_phrase_tl}%       lwarp
      \__siunitx_range_numbers_aux:n {#4}
    }
    {
      \bool_if:NT \l__siunitx_process_fixed_bool
        { \bool_set_true:N \l__siunitx_process_drop_exponent_bool }
      \bool_if:NT \l__siunitx_range_brackets_bool
        { \__siunitx_print:nV { number } \l__siunitx_bracket_open_tl }
      \__siunitx_range_numbers:nn {#3} {#4}
      \bool_if:NT \l__siunitx_range_brackets_bool
        { \__siunitx_print:nV { number } \l__siunitx_bracket_close_tl }
      \__siunitx_range_exponent:
      \__siunitx_unit_output_number_sep:
      \__siunitx_unit_output:nn {#1} {#2}
    }
}

\ExplSyntaxOff

\AtBeginDocument{
\sisetup{
    detect-mode=true,
    per-mode=symbol,    % fraction is not seen by pdftotext
    text-celsius = {\LWR@siunitx@textcelsius},
    text-degree = {\LWR@siunitx@textdegree},
    text-arcminute = {\LWR@siunitx@textprime} ,
    text-arcsecond = {\LWR@siunitx@textdblprime} ,
}
}

\LWR@origRequirePackage{lwarp-common-mathjax-siunitx}

\AtBeginDocument{
\CustomizeMathJax{\def\LWRsiunitxrangephrase{\unicode{x2013}}}
}


\endinput
%%
%% End of file `lwarp-siunitx-v2.sty'.
