summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tipauni
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-08-11 20:15:57 +0000
committerKarl Berry <karl@freefriends.org>2021-08-11 20:15:57 +0000
commit78a278be7587c8b6321671f24a56203a546533f6 (patch)
tree76174091613e8886253acfdf56ea20ac3b7d8c7a /Master/texmf-dist/tex/latex/tipauni
parent3327e9d91f2fa85e634543a2769202bddc83018a (diff)
tipauni (11aug21)
git-svn-id: svn://tug.org/texlive/trunk@60220 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tipauni')
-rw-r--r--Master/texmf-dist/tex/latex/tipauni/tipauni.sty313
1 files changed, 227 insertions, 86 deletions
diff --git a/Master/texmf-dist/tex/latex/tipauni/tipauni.sty b/Master/texmf-dist/tex/latex/tipauni/tipauni.sty
index d324bbebb77..1a3d8e58bd2 100644
--- a/Master/texmf-dist/tex/latex/tipauni/tipauni.sty
+++ b/Master/texmf-dist/tex/latex/tipauni/tipauni.sty
@@ -8,15 +8,15 @@
%%
%% ---------------------------------------------------------------------------
%% Package: tipauni
-%% Author: Niranjan
+%% Author: निरंजन
%% Description: For producing Unicode characters with TIPA commands.
%% Repository: https://gitlab.com/niruvt/tipauni
%% Bug tracker: https://gitlab.com/niruvt/tipauni/-/issues
%% License: GPL v3.0+
%% ---------------------------------------------------------------------------
%%
-%% LaTeX Package tipauni v0.1
-%% © 2021 Niranjan
+%% LaTeX Package tipauni v0.2
+%% © 2021 निरंजन
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see <https://www.gnu.org/licenses/>.
%%
-%% The current maintainers of this work are Niranjan.
+%% The current maintainers of this work are निरंजन.
%%
%% This work consists of the files tipauni.dtx
%% tipauni.ins
@@ -39,16 +39,14 @@
%% ---------------------------------------------------------------------------
%%
\def\tipauniname{tipauni}
-\def\tipauniversion{0.1}
-\def\tipaunidate{2021/04/27}
+\def\tipauniversion{0.2}
+\def\tipaunidate{2021-08-07}
\def\tipaunidescription{For producing Unicode characters with TIPA commands}
\ProvidesPackage{tipauni}[2021/04/27 v0.1
Unicode characters with TIPA commands]
\RequirePackage{xparse}
\RequirePackage{fontspec}
-\RequirePackage{environ}
\RequirePackage{xkeyval}
-\RequirePackage{ifthen}
\setmainfont{CharisSIL} %% https://ctan.org/pkg/charissil
\DeclareOptionX{documentfont}{\setmainfont{#1}}
\newif\ifnontipaignore
@@ -290,96 +288,239 @@ Unicode characters with TIPA commands]
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}%
\DeclareTextAccentDefault{\@pipeshorthands}{TU}
-\NewDocumentCommand\super{ m }{%
- \ifthenelse{\equal{#1}{h}}{ʰ}{\relax}%
- \ifthenelse{\equal{#1}{w}}{ʷ}{\relax}%
- \ifthenelse{\equal{#1}{j}}{ʲ}{\relax}%
- \ifthenelse{\equal{#1}{ɣ}}{ˠ}{\relax}%
- \ifthenelse{\equal{#1}{ʕ}}{ˤ}{\relax}%
- \ifthenelse{\equal{#1}{n}}{ⁿ}{\relax}%
- \ifthenelse{\equal{#1}{l}}{ˡ}{\relax}%
-}%
\ExplSyntaxOn
-\seq_new:N \l__tipauni_replace_maps_seq
+\NewDocumentCommand \super { m }
+ {%
+ \str_case:nn {#1}
+ {
+ {h} {ʰ}
+ {w} {ʷ}
+ {j} {ʲ}
+ {ɣ} {ˠ}
+ {ʕ} {ˤ}
+ {n} {ⁿ}
+ {l} {ˡ}
+ }
+ }
\seq_new:N \l__tipauni_remove_from_accents_seq
\tl_new:N \l__tipauni_textipa_tl
-\seq_set_split:Nnn \l_tmpa_seq { , }
+\seq_set_split:Nnn \l__tipauni_remove_from_accents_seq { , }
+ { \~, \=, \", \r, \v, \t }
+\ifnontipaignore
+ \cs_new_eq:NN \__tipauni_nontipa_search: \prg_do_nothing:
+ \cs_new_eq:NN \__tipauni_nontipa_search:n \use_none:n
+\else
+ \cs_new_protected:Npn \__tipauni_nontipa_search:
+ {
+ \unless\ifnontipa
+ \exp_args:No \__tipauni_nontipa_search:n \l__tipauni_textipa_tl
+ \fi
+ }
+ \cs_new_protected:Npn \__tipauni_nontipa_search:n #1
+ {
+ \str_if_in:nnT {#1} {ⱱ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ɞ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ɰ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ǃ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ǂ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ʢ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ɺ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ʑ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \str_if_in:nnT {#1} {ɧ} { \nontipatrue \use_none_delimet_by_s_stop:w }
+ \use_none:nnn \s_stop
+ \use:n { \cs_gset_eq:NN \__tipauni_nontipa_search: \prg_do_nothing: }
+ }
+\fi
+\NewDocumentCommand\textipa{ +m }%
{
- % sequence (with some escaping of the characters which aren't alpha-numeric):
- { \c{\! | tipaunibang } G }{ʛ},
- { \c{\! | tipaunibang } g }{ɠ},
- { \c{\* | tipaunistar } 1 }{ʢ},
- { \c{\* | tipaunistar } 2 }{ʡ},
- { \c{\* | tipaunistar } 3 }{ɧ},
- { \c{\* | tipaunistar } Z }{ʑ},
- { \c{\: | tipaunicolon } R }{ɻ},
- { \c{\; | tipaunisemicolon} A }{ᴀ},
- { \c{\; | tipaunisemicolon} G }{ɢ},
- { \c{\; | tipaunisemicolon} B }{ʙ},
- { \c{\; | tipaunisemicolon} E }{ᴇ},
- { \c{\; | tipaunisemicolon} H }{ʜ},
- { \c{\; | tipaunisemicolon} J }{ᴊ},
- { \c{\; | tipaunisemicolon} L }{ʟ},
- { \c{\; | tipaunisemicolon} N }{ɴ},
- { \c{\; | tipaunisemicolon} R }{ʀ},
- { \c{\; | tipaunisemicolon} U }{ᴜ},
- {\|\|}{ǁ}, {\"\"}{ˌ},
- {5}{ɐ}, {A}{ɑ}, {6}{ɒ}, {2}{ʌ}, {B}{β}, {C}{ɕ}, {D}{ð}, {9}{ɘ}, {E}{ɛ},
- {3}{ɜ}, {g}{ɡ}, {G}{ɣ}, {7}{ɤ}, {H}{ɦ}, {L}{ʎ}, {4}{ɥ}, {1}{ɨ}, {I}{ɪ},
- {J}{ʝ}, {M}{ɱ}, {W}{ɯ}, {N}{ŋ}, {8}{ɵ}, {O}{ɔ}, {F}{ɸ}, {R}{ɾ}, {K}{ʁ},
- {S}{ʃ}, {T}{θ}, {0}{ʉ}, {U}{ʊ}, {V}{ʋ}, {X}{χ}, {Y}{ʏ}, {Z}{ʒ},
- {P}{ʔ}, {Q}{ʕ},
- {\:}{ː}, {\;}{ˑ}, {\!}{ǃ}, {\&}{ɞ}, {\@}{ə}, {\|}{ǀ}, {\"}{ˈ}
+ \begingroup
+ \let\*\tipaunistar
+ \let\:\tipaunicolon
+ \let\;\tipaunisemicolon
+ \let\!\tipaunibang
+ \let\|\tipaunipipe
+ \let\t\tipaunit
+ \seq_map_inline:Nn \l__tipauni_remove_from_accents_seq
+ { \tl_remove_all:Nn \l_text_accents_tl {##1} }
+ \tl_set:Nx \l__tipauni_textipa_tl { \text_expand:n {#1} }
+ \use:x
+ {
+ \exp_not:n
+ {
+ \escapechar = `\\
+ \tl_set:Nx \l__tipauni_textipa_tl
+ { \exp_args:No \__tipauni_act:n \l__tipauni_textipa_tl }
+ \escapechar =
+ }
+ \int_use:N \escapechar
+ }
+ \exp_stop_f:
+ \l__tipauni_textipa_tl
+ \__tipauni_nontipa_search:
+ \endgroup
}
-\seq_clear:N \l__tipauni_replace_maps_seq
-\seq_map_inline:Nn \l_tmpa_seq
+\scan_new:N \s__tipauni_act_stop
+\cs_new:Npn \__tipauni_use_none_delimit_by_act_stop:w #1 \s__tipauni_act_stop {}
+\cs_new:Npn \__tipauni_act:n #1 { \__tipauni_act_loop:w #1 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
+\cs_new_eq:NN \__tipauni_act_output:n \exp_not:n
+\cs_new:Npn \__tipauni_act_loop:w { \__tipauni_act_loop:Nnw \use_none:nn {} }
+\cs_new:Npn \__tipauni_act_loop:Nnw #1#2#3 \s__tipauni_act_stop
{
- \exp_args:Nco \regex_const:Nn
- { c__tipauni_ \exp_args:No \tl_to_str:n { \use_i:nn #1 } _regex }
- { \use_i:nn #1 }
- \seq_put_right:Nx \l__tipauni_replace_maps_seq
+ \__tipauni_act_if_head_is_space:nTF {#3}
+ { \__tipauni_act_space:Nnw }
{
- \exp_not:c
- { c__tipauni_ \exp_args:No \tl_to_str:n { \use_i:nn #1 } _regex }
- { \exp_not:o { \use_ii:nn #1 } }
+ \tl_if_head_is_group:nTF {#3}
+ \__tipauni_act_group:Nnn
+ \__tipauni_act_normal:NnN
}
+ #1 {#2} #3 \s__tipauni_act_stop
}
-\seq_set_split:Nnn \l__tipauni_remove_from_accents_seq { , }
- { \~, \=, \", \r, \v, \t }
-\cs_new_protected:Npn \__tipauni_nontipa_search:n #1
+\group_begin:
+ \cs_set:Npn \__tipauni_tmp:n #1
+ {
+ \cs_new:Npn \__tipauni_act_if_head_is_space:nTF ##1
+ {
+ \__tipauni_act_if_head_is_space:w
+ \s__tipauni_act_stop ##1 \s__tipauni_act_stop
+ \__tipauni_act_if_head_is_space_true:w
+ \s__tipauni_act_stop #1 \s__tipauni_act_stop
+ \use_ii:nn
+ }
+ \cs_new:Npn \__tipauni_act_if_head_is_space:w
+ ##1 \s__tipauni_act_stop #1 ##2 \s__tipauni_act_stop
+ {}
+ \cs_new:Npn \__tipauni_act_if_head_is_space_true:w
+ \s__tipauni_act_stop #1 \s__tipauni_act_stop \use_ii:nn ##1 ##2
+ {##1}
+ \cs_new:Npn \__tipauni_act_space:Nnw ##1 ##2 #1
+ {
+ \token_if_eq_meaning:NNTF ##1 \__tipauni_act_macro:nn
+ { \__tipauni_act_space_macro:nn ##2 }
+ {
+ \cs_if_exist_use:cTF { __tipauni_act_char_mono_ \tl_to_str:n { ##2 } : }
+ { \__tipauni_act_output:n {~} }
+ { \__tipauni_act_output:n { ##2 ~ } }
+ \__tipauni_act_loop:w
+ }
+ }
+ }
+ \__tipauni_tmp:n {~}
+\group_end:
+\cs_new:Npn \__tipauni_act_space_macro:nn #1#2
+ { \__tipauni_act_loop:Nnw \__tipauni_act_macro:nn { {#1} { #2 ~ } } }
+\cs_new:Npn \__tipauni_act_group:Nnn #1#2#3
{
- \regex_match:nnT {ⱱ} {#1} \nontipatrue
- \regex_match:nnT {ɞ} {#1} \nontipatrue
- \regex_match:nnT {ɰ} {#1} \nontipatrue
- \regex_match:nnT {ǃ} {#1} \nontipatrue
- \regex_match:nnT {ǂ} {#1} \nontipatrue
- \regex_match:nnT {ʢ} {#1} \nontipatrue
- \regex_match:nnT {ɺ} {#1} \nontipatrue
- \regex_match:nnT {ʑ} {#1} \nontipatrue
- \regex_match:nnT {ɧ} {#1} \nontipatrue
+ \__tipauni_use_none_delimit_by_act_stop:w
+ #3 \__tipauni_act_final:Nnw #1 {#2} \s__tipauni_act_stop
+ \token_if_eq_meaning:NNTF #1 \__tipauni_act_macro:nn
+ { \__tipauni_act_group_macro:nn {#2} {#3} }
+ {
+ \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #2 } : }
+ { \__tipauni_act_output:n {#2} }
+ { \__tipauni_act_loop:w #3 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
+ }
+ \__tipauni_act_loop:w
}
-\cs_generate_variant:Nn \__tipauni_nontipa_search:n { o }
-\NewDocumentCommand\textipa{ +m }%
+\cs_new:Npn \__tipauni_act_final:Nnw
+ #1#2 \s__tipauni_act_stop #3 \__tipauni_act_loop:w #4 \s__tipauni_act_stop
{
- \begingroup
- \let\*\tipaunistar
- \let\:\tipaunicolon
- \let\;\tipaunisemicolon
- \let\!\tipaunibang
- \let\|\tipaunipipe
- \let\t\tipaunit
- \catcode`\&=11
- \seq_map_inline:Nn \l__tipauni_remove_from_accents_seq
- { \tl_remove_all:Nn \l_text_accents_tl {##1} }
- \tl_set:Nx \l__tipauni_textipa_tl { \text_expand:n {#1} }
- \seq_map_inline:Nn \l__tipauni_replace_maps_seq
- { \regex_replace_all:NnN ##1 \l__tipauni_textipa_tl }
- \l__tipauni_textipa_tl
- \unless\ifnontipa
- \__tipauni_nontipa_search:o \l__tipauni_textipa_tl
- \fi
- \endgroup
+ \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #2 } : }
+ {
+ \token_if_eq_meaning:NNTF #1 \__tipauni_act_macro:nn
+ { \exp_args:No \__tipauni_act_output:n { \use:nn #2 } }
+ { \__tipauni_act_output:n {#2} }
+ }
+ }
+\cs_new:Npn \__tipauni_act_normal:NnN #1#2#3
+ {
+ \token_if_eq_meaning:NNTF #1 \use_none:nn
+ {
+ \cs_if_exist_use:cF { __tipauni_act_normal_ \tl_to_str:n {#3} :nw }
+ { \__tipauni_act_output:n }
+ {#3}
+ }
+ { #1 {#2} {#3} }
+ \__tipauni_act_loop:w
+ }
+\cs_new:Npn \__tipauni_act_macro:nn #1#2
+ {
+ \cs_if_exist_use:cF
+ { __tipauni_act_macro_ \exp_args:No \tl_to_str:n { \use_i:nn #1 / #2 } : }
+ { \exp_args:No \__tipauni_act_output:n { \use:nn #1 #2 } }
+ }
+\cs_new:Npn \__tipauni_act_group_macro:nn #1#2
+ {
+ \cs_if_exist_use:cF
+ { __tipauni_act_macro_ \exp_args:No \tl_to_str:n { \use_i:nn #1 / #2 } : }
+ {
+ \exp_args:No \__tipauni_act_output:n { \use:nn #1 }
+ { \__tipauni_act_loop:w #2 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
+ }
+ }
+\cs_new:Npn \__tipauni_act_char:nn #1#2
+ {
+ \cs_if_exist_use:cF { __tipauni_act_char_bigraph_ \tl_to_str:n { #1/#2 } : }
+ {
+ \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #1 } : }
+ { \__tipauni_act_output:n {#1} }
+ \use_i:nn { \__tipauni_act_normal:NnN \use_none:nn {} {#2} }
+ }
+ }
+\cs_new_protected:Npn \__tipauni_new_macro_pair_bigraph:NNNn #1#2#3#4
+ {
+ \__tipauni_new_macro_bigraph:NNn #1 #3 {#4}
+ \__tipauni_new_macro_bigraph:NNn #2 #3 {#4}
+ }
+\cs_new_protected:Npn \__tipauni_new_macro_bigraph:NNn #1#2#3
+ {
+ \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
+ { \__tipauni_act_loop:Nnw \__tipauni_act_macro:nn { {##1} {} } }
+ \cs_gset:cpn { __tipauni_act_macro_ \tl_to_str:n { #1/#2 } : }
+ { \__tipauni_act_output:n {#3} }
+ }
+\cs_new_protected:Npn \__tipauni_new_char_bigraph:NNn #1#2#3
+ {
+ \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
+ { \__tipauni_act_loop:Nnw \__tipauni_act_char:nn {##1} }
+ \cs_gset:cpn { __tipauni_act_char_bigraph_ \tl_to_str:n { #1/#2 } : }
+ { \__tipauni_act_output:n {#3} }
+ }
+\cs_new_protected:Npn \__tipauni_new_char_mono:Nn #1#2
+ {
+ \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
+ { \__tipauni_act_loop:Nnw \__tipauni_act_char:nn {##1} }
+ \cs_gset:cpn { __tipauni_act_char_mono_ \tl_to_str:n {#1} : }
+ { \__tipauni_act_output:n {#2} }
+ }
+\__tipauni_new_macro_pair_bigraph:NNNn \! \tipaunibang G {ʛ}
+\__tipauni_new_macro_pair_bigraph:NNNn \! \tipaunibang g {ɠ}
+\__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar 1 {ʢ}
+\__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar 2 {ʡ}
+\__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar 3 {ɧ}
+\__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar Z {ʑ}
+\__tipauni_new_macro_pair_bigraph:NNNn \: \tipaunicolon R {ɻ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon A {ᴀ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon G {ɢ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon B {ʙ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon E {ᴇ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon H {ʜ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon J {ᴊ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon L {ʟ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon N {ɴ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon R {ʀ}
+\__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon U {ᴜ}
+\__tipauni_new_char_bigraph:NNn || {ǁ}
+\__tipauni_new_char_bigraph:NNn "" {ˌ}
+\clist_map_inline:nn
+ {
+ {5}{ɐ}, {A}{ɑ}, {6}{ɒ}, {2}{ʌ}, {B}{β}, {C}{ɕ}, {D}{ð}, {9}{ɘ}, {E}{ɛ},
+ {3}{ɜ}, {g}{ɡ}, {G}{ɣ}, {7}{ɤ}, {H}{ɦ}, {L}{ʎ}, {4}{ɥ}, {1}{ɨ}, {I}{ɪ},
+ {J}{ʝ}, {M}{ɱ}, {W}{ɯ}, {N}{ŋ}, {8}{ɵ}, {O}{ɔ}, {F}{ɸ}, {R}{ɾ}, {K}{ʁ},
+ {S}{ʃ}, {T}{θ}, {0}{ʉ}, {U}{ʊ}, {V}{ʋ}, {X}{χ}, {Y}{ʏ}, {Z}{ʒ},
+ {P}{ʔ}, {Q}{ʕ},
+ {:}{ː}, {;}{ˑ}, {!}{ǃ}, {&}{ɞ}, {@}{ə}, {|}{ǀ}, {"}{ˈ}
}
+ { \__tipauni_new_char_mono:Nn #1 }
\ExplSyntaxOff
%%-- Dependent diacritic marks
%%--** Voiceless
@@ -447,7 +588,7 @@ Unicode characters with TIPA commands]
\DeclareTextCommand{\tipaunitexttoptiebar}{TU}[2]{#1\symbol{"0361}#2}
\NewDocumentCommand\texttoptiebar{ m }{\tipaunitexttoptiebar#1}
\DeclareTextCommand{\tipaunit}{TU}{\@ifstar{\textbottomtiebar}{\texttoptiebar}}
-\NewEnviron{IPA}{\textipa{\BODY}}
+\NewDocumentEnvironment{IPA}{+b}{\textipa{#1}}{}
\endinput
%%
%% End of file `tipauni.sty'.