summaryrefslogtreecommitdiff
path: root/language/japanese/plautopatch/plsiunitx.sty
blob: f4041287d5fa26b03d0effc591b9bc5efd3847d0 (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
%
% plsiunitx.sty
% written by Hironobu Yamashita (@aminophen)
%
% This package is part of the plautopatch bundle.
% https://github.com/aminophen/plautopatch
% (mostly based on lltjp-siunitx.sty 2019-06-06)
%
% This package is expected to be compatible with
%   * siunitx.sty
%     (????/??/?? v?.?? -- 2018/05/17 v2.7s)
%   * plarray.sty in platex-tools
%     (2018/03/01 v0.1d -- 2018/10/27 v0.1h)
%

%% package declaration
\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{plsiunitx}
  [2019/06/06 v0.3 siunitx package for pLaTeX/upLaTeX]
\RequirePackageWithOptions{siunitx}
\RequirePackage{plarray}% siunitx requires array

\ExplSyntaxOn

%% patching internal code for siunitx.sty
%
%% inhibit JFM glue around tabular cell components (pLaTeX2e 2018/03/09)
\@ifl@t@r{\pfmtversion}{2017/07/29}{\@firstofone}{\@gobble}
{% = for pLaTeX2e 2017/07/29 or newer
%
%% new table column: S and s
\bool_new:N \l__platpc_siunitx_table_collect_relax_bool
\cs_set_protected:Npn \__siunitx_table_collect_begin_s: {
  \bool_set_false:N \l__platpc_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:
}
%
\@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__platpc_siunitx_table_collect_relax_bool {
          \__siunitx_table_collect_not_braced_aux_i:N #1
        } {
          \bool_set_true:N \l__platpc_siunitx_table_collect_relax_bool
        }
      } {
        \token_if_eq_meaning:NNF #1 \pltx@next@inhibitglue {
        \token_if_eq_meaning:NNF #1 \removejfmglue {
        \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:
    }
  }
%
}% =
%
%% done

\ExplSyntaxOff

\endinput