summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty
blob: c6bebc36cde322dddbf86e2bec50af1dffd266c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
%
% lltjp-siunitx.sty 2019-06-06
%

\NeedsTeXFormat{LaTeX2e}

\RequirePackage{siunitx}
\makeatletter
\ExplSyntaxOn
\cs_generate_variant:Nn \tl_if_in:NnT { coT }
\cs_new:Nn \__ltj_siunix_patch_inner:n {
  \cs_if_exist:cT { #1_tl } {
    \tl_if_in:coT { #1_tl } { \tex_char:D } {
	  \tl_replace_all:cnn { #1_tl } { \tex_char:D } { \ltjalchar }
	}
  }
}
\cs_new:Nn \__ltj_siunix_patch_inner_math:n {
   \__ltj_siunix_patch_inner:n { l__siunitx_#1_math }
   \__ltj_siunix_patch_inner:n { l__siunitx_#1_text }
}
\AtBeginDocument {
  \__ltj_siunix_patch_inner:n { c__siunitx_minus }
  \__ltj_siunix_patch_inner:n { c__siunitx_mu }
  \__ltj_siunix_patch_inner_math:n { angstrom }
  \__ltj_siunix_patch_inner_math:n { arcminute }
  \__ltj_siunix_patch_inner_math:n { arcsecond }
  \__ltj_siunix_patch_inner_math:n { ohm }
}

%%%% new table column: S and s
\bool_new:N \l__ltj_siunitx_table_collect_relax_bool
\cs_set_protected:Npn \__siunitx_table_collect_begin_s: {
  \bool_set_false:N \l__ltj_siunitx_table_collect_relax_bool
  \cs_set_eq:NN \__siunitx_table_collect_token:N
    \__siunitx_table_collect_token_s:N
  \cs_set_eq:NN \__siunitx_table_print: \__siunitx_table_print_s:
  \__siunitx_table_collect_init_s:
  \__siunitx_table_collect_get:
}

\cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1
  {
	\token_if_eq_meaning:NNTF #1 \tex_relax:D {
      \bool_if:NTF \l__ltj_siunitx_table_collect_relax_bool {
		\__siunitx_table_collect_not_braced_aux_i:N #1
	  } {
	    \bool_set_true:N \l__ltj_siunitx_table_collect_relax_bool
	  }
	} {
    \token_if_eq_meaning:NNF #1 \ltjfakeboxbdd {
    \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue {
    \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
      {
        \token_if_eq_meaning:NNF #1 \tex_unskip:D
          { \__siunitx_table_collect_not_braced_aux_i:N #1 }
      }
	}}}
    \__siunitx_table_collect_next:
  }

\AtBeginDocument
  {
    \@ifpackageloaded { mdwtab }
      {
        \cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1
          { 
	        \token_if_eq_meaning:NNTF #1 \tex_relax:D {
              \bool_if:NTF \l__ltj_siunitx_table_collect_relax_bool {
		        \__siunitx_table_collect_not_braced_aux_i:N #1
	          } {
	            \bool_set_true:N \l__ltj_siunitx_table_collect_relax_bool
	          }
	        } {
            \token_if_eq_meaning:NNF #1 \ltjfakeboxbdd {
            \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue {
            \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
              {
                \token_if_eq_meaning:NNF #1 \tex_unskip:D
                  {
                    \token_if_eq_meaning:NNF #1 \tab@setcr
                      {
                        \token_if_eq_meaning:NNF #1 \@maybe@unskip
                          { \__siunitx_table_collect_not_braced_aux_i:N #1 }
                      }
                  }
              }
            }}}
            \__siunitx_table_collect_next:
          }
      }
      { }
  }

\ExplSyntaxOff
\endinput