summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/xelatex/xecjk/xunicode-symbols.tex
blob: 1c8d79797a0d236e27be21348d3fabd70c60dadc (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
%%
%% This is file `xunicode-symbols.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xeCJK.dtx  (with options: `xunicode-symbols')
%% 
\documentclass[a4paper]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{fontspec}
\usepackage{xunicode-addon}
\usepackage{longtable,tabu,booktabs}
\usepackage{zref-base}

\setmainfont{FreeSerif}
\newfontfamily\falllbackfont{Segoe UI Symbol}

\makeatletter
\ExplSyntaxOn
\cs_new_protected_nopar:Npx \__xunsym_restore_catcode:
  { \char_set_catcode:nn { 0 } { \char_value_catcode:n { 0 } } }
\file_if_exist:nTF { xunicode-commands.tex }
  { \char_set_catcode_comment:n { 0 } }
  { \char_set_catcode_ignore:n { 0 } }
^^@ \tl_new:N \l__xunsym_command_tl
^^@ \int_new:N \l__xunsym_command_int
^^@ \iow_new:N \g__xunsym_command_iow
^^@ \iow_new:N \g__xunsym_combine_mark_iow
^^@ \ior_new:N \g__xunsym_unicode_ior
^^@ \prop_new:N \l__xunsym_command_prop
^^@ \prop_new:N \l__xunsym_combine_mark_prop
^^@ \prop_new:N \l__xunsym_combine_marks_prop
^^@ \cs_new_protected_nopar:Npn \SaveUTFCommands
^^@   {
^^@     \group_begin:
^^@     \__xunsym_restore_catcode:
^^@     \cs_set_eq:NN \DeclareTextAccent \use_none:nnn
^^@     \cs_set_eq:NN \DeclareUTFComposite \use_none:n
^^@     \cs_set_eq:NN \DeclareUTFEncodedAccent \use_none:nnn
^^@     \cs_set_eq:NN \DeclareUTFDoubleEncodedAccent \use_none:nnn
^^@     \cs_set_eq:NN \DeclareUTFDoubleEncodedSymbol \use_none:nnn
^^@     \cs_set_eq:NN \DeclareUTFCommand \use_none:nn
^^@     \cs_set_eq:NN \DeclareUTFTIPACommand \use_none:n
^^@     \cs_set_eq:NN \DeclareUTFCompositeCommand \use_none:nnn
^^@     \cs_set_eq:NN \DeclareUTFSymbol \__xunsym_save_UTF_command:Nn
^^@     \cs_set_eq:NN \DeclareUTFCompositeSymbol \__xunsym_save_UTF_command:Nnn
^^@     \cs_set_eq:NN \DeclareEncodedCompositeCharacter \__xunsym_save_combine_mark:nnnn
^^@     \cs_set_eq:NN \DeclareEncodedCompositeAccents \__xunsym_save_combine_marks:nnnn
^^@     \DeclareDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m }
^^@       { \__xunsym_save_UTF_command:NNn \l__xunsym_command_prop {##3} {##2} }
^^@     \DeclareDocumentCommand \DeclareUTFcomposite { O { \UTFencname } m m m }
^^@       { \__xunsym_save_UTF_command:NNnn \l__xunsym_command_prop {##3} {##4} {##2} }
^^@     \ReloadXunicode { \UTFencname }
^^@     \ior_open:NnTF \g__xunsym_unicode_ior { UnicodeData.txt }
^^@       {
^^@         \iow_open:Nn \g__xunsym_command_iow { xunicode-commands.tex }
^^@         \iow_open:Nn \g__xunsym_combine_mark_iow { xunicode-combine-marks.tex }
^^@         \ior_map_inline:Nn \g__xunsym_unicode_ior { \__xunsym_make_table:w ##1 \q_stop }
^^@         \__xunsym_write_combine_marks:
^^@         \ior_close:N \g__xunsym_unicode_ior
^^@         \iow_close:N \g__xunsym_command_iow
^^@         \iow_close:N \g__xunsym_combine_mark_iow
^^@         \group_end:
^^@       }
^^@       {
^^@         \group_end:
^^@         \msg_fatal:nn { __xunsym } { UnicodeData }
^^@       }
^^@   }
^^@ \msg_new:nnn { __xunsym } { UnicodeData }
^^@   { File~`UnicodeData.txt`~not~found. }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_command:Nn
^^@   { \__xunsym_save_UTF_command:NNn \l__xunsym_command_prop }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_command:Nnn
^^@   { \__xunsym_save_UTF_command:NNnn \l__xunsym_command_prop }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_command:NNn #1#2#3
^^@   { \__xunsym_save_UTF_text_command:Nxx #1 { \use_none:n #3 } { \token_to_str:N #2 } }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_command:NNnn #1#2#3#4
^^@   {
^^@     \__xunsym_save_UTF_text_command:Nxx #1 { \use_none:n #4 }
^^@       {
^^@         \token_to_str:N #2 \c_left_brace_str
^^@         \tl_if_single:nTF {#3} { \token_to_str:N #3 } { \tl_to_str:n {#3} }
^^@         \c_right_brace_str
^^@       }
^^@   }
^^@ \cs_new_protected:Npn \__xunsym_save_combine_mark:nnnn #1#2#3#4
^^@   { \__xunsym_save_UTF_text_command:Nxx \l__xunsym_combine_mark_prop {#3} { \token_to_str:N #2 } }
^^@ \cs_new_protected:Npn \__xunsym_save_combine_marks:nnnn #1#2#3#4
^^@   { \__xunsym_save_UTF_text_command:Nxx \l__xunsym_combine_marks_prop { { "#4 } { "#3 } } { \token_to_str:N #2 } }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_text_command:Nxx #1#2#3
^^@   { \use:x { \__xunsym_save_UTF_text_command:Nnn \exp_not:N #1 {#2} {#3} } }
^^@ \cs_new_protected:Npn \__xunsym_save_UTF_text_command:Nnn #1#2#3
^^@   {
^^@     \prop_get:NnNTF #1 {#2} \l__xunsym_command_tl
^^@       { \prop_put:Nno #1 {#2} { \l__xunsym_command_tl , #3 } }
^^@       { \prop_put:Nnn #1 {#2} {#3} }
^^@   }
^^@ \cs_new_protected:Npn \__xunsym_make_table:w #1 ; #2 ; #3 \q_stop
^^@   {
^^@     \prop_get:NnNT \l__xunsym_command_prop {#1} \l__xunsym_command_tl
^^@       {
^^@         \iow_now:Nx \g__xunsym_command_iow
^^@           { \token_to_str:N \UnicodeTextSymbol { "#1 } { \l__xunsym_command_tl } {#2} }
^^@       }
^^@     \prop_get:NnNT \l__xunsym_combine_mark_prop {#1} \l__xunsym_command_tl
^^@       {
^^@         \iow_now:Nx \g__xunsym_combine_mark_iow
^^@           { \token_to_str:N \UnicodeCombineMark { "#1 } { \l__xunsym_command_tl } {#2} }
^^@       }
^^@   }
^^@ \cs_new_protected:Npn \__xunsym_write_combine_marks:
^^@   {
^^@     \prop_map_inline:Nn \l__xunsym_combine_marks_prop
^^@       {
^^@         \iow_now:Nx \g__xunsym_combine_mark_iow
^^@           { \token_to_str:N \UnicodeCombineMarks ##1 {##2} }
^^@       }
^^@   }
^^@ \ExplSyntaxOff
^^@ \SaveUTFCommands
^^@ \ExplSyntaxOn
\__xunsym_restore_catcode:
\int_new:N \g__xunsym_symbol_int
\int_new:N \g__xunsym_table_int
\DeclareDocumentCommand \UnicodeTextSymbol { m v m }
  {
    \int_gincr:N \g__xunsym_symbol_int
    \use_none:n #1 &
    \scan_stop:
    \reverse_if:N \tex_iffontchar:D \tex_font:D #1 \exp_stop_f: \falllbackfont \fi:
    \tex_char:D #1 \exp_stop_f: &
    \tl_set:Nn \l_tmpa_clist {#2}
    \clist_use:Nn \l_tmpa_clist { \par }
    \strut
    & #3 \\
  }
\cs_set_eq:NN \UnicodeCombineMark \UnicodeTextSymbol
\DeclareDocumentCommand \UnicodeCombineMarks { m m v }
  {
    \int_gincr:N \g__xunsym_symbol_int
    \use_none:n #1 ~ \use_none:n #2 &
    \tex_char:D #1 \exp_stop_f: \tex_char:D #2 \exp_stop_f: &
    \tl_set:Nn \l_tmpa_clist {#3}
    \clist_use:Nn \l_tmpa_clist { \par }
    \strut \\
  }
\DeclareDocumentCommand \UTFTABLE { m m }
  {
    \int_gincr:N \g__xunsym_table_int
    \exp_args:Nx \__xunsym_make_table:nnn { UTFTABLE - \int_use:N \g__xunsym_table_int } {#1} {#2}
  }
\cs_new_protected_nopar:Npn \__xunsym_make_table:nnn #1#2#3
  {
    \section{#2~(\zref@extractdefault{#1}{default}{0})}
    \zref@refused{#1}
    \noindent
    \begin{longtabu} to \linewidth {>{\ttfamily\footnotesize}rc>{\ttfamily\footnotesize}X>{\tiny}X}
      \toprule\rowfont{\normalfont\normalsize}
      \multicolumn1c{USV} & Symbol & Macro(s) & Description \\
      \midrule \endhead
      \bottomrule \endfoot
      \int_gzero:N \g__xunsym_symbol_int
      \input{#3}
    \end{longtabu}
    \group_begin:
      \zref@setcurrent{default}{\int_use:N\g__xunsym_symbol_int}
      \zref@wrapper@immediate{\zref@labelbyprops{#1}{default}}
    \group_end:
  }
\cs_generate_variant:Nn \__xunsym_make_table:nnn { x }
\ExplSyntaxOff

\begin{document}

\UTFTABLE{Symbols}{xunicode-commands.tex}

\UTFTABLE{Combining Marks}{xunicode-combine-marks.tex}

\end{document}
%% 
%%
%% End of file `xunicode-symbols.tex'.