Advertisement
Niranjan_T

tipauni.sty

Feb 9th, 2022
1,423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 26.77 KB | None | 0 0
  1. %%
  2. %% This is file `tipauni.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% tipauni.dtx  (with options: `package')
  8. %%
  9. %% ---------------------------------------------------------------------------
  10. %% Package:      tipauni
  11. %% Author:       निरंजन
  12. %% Description:  For producing Unicode characters with TIPA commands.
  13. %% Repository:   https://git.gnu.org.ua/tipauni.git
  14. %% Bug tracker:  https://puszcza.gnu.org.ua/bugs/?group=tipauni
  15. %% License:      GPL v3.0+, GFDL 1.3+
  16. %% ---------------------------------------------------------------------------
  17. %%
  18. %% LaTeX Package tipauni v0.4.1
  19. %% Copyright © 2021 निरंजन
  20. %%
  21. %% This program is free software: you can redistribute it and/or modify
  22. %% it under the terms of the GNU General Public License as published by
  23. %% the Free Software Foundation, either version 3 of the License, or
  24. %% (at your option) any later version.
  25. %%
  26. %% This program is distributed in the hope that it will be useful,
  27. %% but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. %% GNU General Public License for more details.
  30. %%
  31. %% You should have received a copy of the GNU General Public License
  32. %% along with this program. If not, see <https://www.gnu.org/licenses/>.
  33. %%
  34. %% The current maintainers of this work are निरंजन.
  35. %%
  36. %% This work consists of the files tipauni.dtx
  37. %%                                 tipauni.ins
  38. %% and the derived file            tipauni.sty.
  39. %% ---------------------------------------------------------------------------
  40. %%
  41. \def\tipauniname{tipauni}
  42. \def\tipauniversion{0.4.1}
  43. \def\tipaunidate{2022-01-04}
  44. \def\tipaunidescription{For producing Unicode characters with TIPA commands}
  45. \ProvidesPackage{tipauni}[2021/12/16 v0.4
  46. Unicode characters with TIPA commands]
  47. \RequirePackage{xparse}
  48. \RequirePackage{fontspec}
  49. \RequirePackage{expkv-def,expkv-opt}
  50. \newif\iftipauni@charis@sil
  51. \newif\iftipauni@preserve@font
  52. \newif\iftipauni@document@font
  53. \newif\iftipauni@font@options
  54. \newif\iftipauni@nontipa@ignore
  55. \tipauni@document@fonttrue
  56. \tipauni@charis@siltrue
  57. \let\tipauni@font@options\@empty
  58. \ekvdefinekeys{tipauni}{
  59.  bool incompatible          = \iftipauni@nontipa@ignore,
  60.  noval preservefont         = {
  61.    \tipauni@document@fontfalse
  62.    \tipauni@charis@silfalse
  63.    \tipauni@preserve@fonttrue
  64.  },
  65.  code fontspecoptions       = {
  66.    \edef\tipauni@font@options{#1}
  67.    \ifx\tipauni@font@options\@empty
  68.    \else
  69.      \tipauni@font@optionstrue
  70.    \fi
  71.  },
  72.  noval resetfontspecoptions = {
  73.    \let\tipauni@font@options\@empty
  74.    \tipauni@font@optionsfalse
  75.  },
  76.  code documentfont          = {
  77.    \edef\tipauni@temp{#1}
  78.    \tipauni@preserve@fontfalse
  79.    \tipauni@charis@silfalse
  80.    \tipauni@document@fonttrue
  81.    \let\tipauni@font\tipauni@temp
  82.  },
  83.  new noval documentfont     = {
  84.    \PackageError{tipauni}{Empty `documentfont' option}{%
  85.       The `documentfont' option has no value. Your document will be compiled\MessageBreak
  86.       with the default font-family of (Xe/Lua)LaTeX, i.e., Latin Modern unless\MessageBreak
  87.       another font is set.%
  88.     }
  89.     \tipauni@document@fontfalse
  90.     \ifdefined\tipauni@font
  91.       \PackageWarningNoLine{tipauni}{%
  92.         A `documentfont' option has no value, but you have\MessageBreak
  93.         loaded another font with some tipauni-option, so that\MessageBreak
  94.         font will be used as the main font of this document\MessageBreak
  95.         unless another font is set. The font being currently\MessageBreak
  96.         loaded is: \tipauni@font
  97.       }
  98.       \tipauni@document@fonttrue
  99.     \else
  100.       \tipauni@document@fontfalse
  101.     \fi
  102.   },
  103.   noval recommendedfont      = {
  104.    \tipauni@document@fonttrue
  105.    \tipauni@charissiltrue
  106.  }
  107. }
  108. \ekvoProcessLocalOptions{tipauni}
  109. \iftipauni@charis@sil
  110.  \def\tipauni@font{CharisSIL}%% https://ctan.org/pkg/charissil
  111. \fi
  112. \iftipauni@document@font
  113.   \expandafter\setmainfont\expandafter
  114.   [\expandafter{\tipauni@font@options}]{\tipauni@font}
  115. \else
  116.  \iftipauni@font@options
  117.    \PackageWarningNoLine{tipauni}{%
  118.       An active font loaded with package fontspec is\MessageBreak
  119.       necessary for `fontspecoptions' to take effect.\MessageBreak
  120.       Please use the `documentfont'/`recommendedfont'\MessageBreak
  121.       option or load a font outside package `tipauni'\MessageBreak
  122.       to make your options active. Currently ignoring:\MessageBreak
  123.       [\tipauni@font@options]%
  124.     }%
  125.   \fi
  126. \fi
  127. \newif\iftipauni@nontipa
  128. \protected\def\tipauni@nontipatrue{\global\let\iftipauni@nontipa\iftrue}
  129. \protected\def\tipauni@nontipafalse{\global\let\iftipauni@nontipa\iffalse}
  130. \iftipauni@nontipa@ignore
  131.  \protected\def\tipauni@nontipatrue{}
  132. \fi
  133. \NewDocumentCommand\tipaunicmd{ m m }{%
  134.   \NewDocumentCommand#1{ }{\tipauni@nontipatrue #2}%
  135. }%
  136. \AtEndDocument{%
  137.   \iftipauni@nontipa
  138.   \PackageWarningNoLine{tipauni}{%
  139.     You have used a command(s) that is (are) not\MessageBreak
  140.     supported by package TIPA. Thus your current code is\MessageBreak
  141.     incompatible with that package. These commands are\MessageBreak
  142.     printed with a different Unicode font. Refer to the\MessageBreak
  143.     documentation of package tipauni for a list of\MessageBreak
  144.     commands that are not supported in TIPA%
  145.   }%
  146.   \else
  147.   \fi
  148. }%
  149. \DeclareTextCommand{\tipaunistar}{TU}[1]{{#1}}
  150. \DeclareTextAccentDefault{\tipaunistar}{TU}
  151. \DeclareTextCommand{\tipaunisemicolon}{TU}[1]{{#1}}
  152. \DeclareTextAccentDefault{\tipaunisemicolon}{TU}
  153. \DeclareTextCommand{\tipaunicolon}{TU}[1]{{#1}}
  154. \DeclareTextAccentDefault{\tipaunicolon}{TU}
  155. \DeclareTextCommand{\tipaunibang}{TU}[1]{{#1}}
  156. \DeclareTextAccentDefault{\tipaunibang}{TU}
  157. \DeclareTextCommand{\tipaunipipe}{TU}[2]{\@pipeshorthands{#1}{#2}}
  158. \DeclareTextAccentDefault{\tipaunipipe}{TU}
  159. %% Pulmonic consonants
  160. %%-- Stops
  161. %%--** Retroflex
  162. \DeclareTextSymbol{\textrtailt}{TU}{"0288}%% ʈ
  163. \DeclareTextComposite{\tipaunicolon}{TU}{t}{"288}
  164. \DeclareTextSymbol{\textrtaild}{TU}{"0256}%% ɖ
  165. \DeclareTextComposite{\tipaunicolon}{TU}{d}{"256}
  166. %%--** Palatal
  167. \DeclareTextSymbol{\textbardotlessj}{TU}{"25F}%% ɟ
  168. \DeclareTextComposite{\tipaunistar}{TU}{j}{"25F}
  169. %%--** Uvular
  170. \DeclareTextSymbol{\textscg}{TU}{"262}%% ɢ
  171. \DeclareTextComposite{\tipaunisemicolon}{TU}{G}{"262}
  172. %%--** Glottal
  173. \DeclareTextSymbol{\textglotstop}{TU}{"294}%% ʔ
  174. %%-- Nasals
  175. %%--** Labiodental
  176. \DeclareTextSymbol{\textltailm}{TU}{"271}%% ɱ
  177. %%--** Retroflex
  178. \DeclareTextSymbol{\textrtailn}{TU}{"273}%% ɳ
  179. \DeclareTextComposite{\tipaunicolon}{TU}{n}{"273}
  180. %%--** Palatal
  181. \DeclareTextSymbol{\textltailn}{TU}{"272}%% ɲ
  182. \DeclareTextComposite{\tipaunistar}{TU}{n}{"272}
  183. %%--** Uvular
  184. \DeclareTextSymbol{\textscn}{TU}{"274}%% ɴ
  185. \DeclareTextComposite{\tipaunisemicolon}{TU}{N}{"274}
  186. %%-- Trills
  187. %%--** Bilabial
  188. \DeclareTextSymbol{\textscb}{TU}{"299}%% ʙ
  189. \DeclareTextComposite{\tipaunisemicolon}{TU}{B}{"299}
  190. %%--** Uvular
  191. \DeclareTextSymbol{\textscr}{TU}{"280}%% ʀ
  192. \DeclareTextComposite{\tipaunisemicolon}{TU}{R}{"280}
  193. %%-- Taps or flaps
  194. %%-- Labiodental flap
  195. \tipaunicmd{\labdentflap}{ⱱ}%% tipauni-exclusive
  196. \DeclareTextComposite{\tipaunistar}{TU}{v}{"2C71}%% tipauni-exclusive
  197. %%--** Alveolar
  198. \DeclareTextSymbol{\textfishhookr}{TU}{"27E}%% ɾ
  199. %%--** Retroflex
  200. \DeclareTextSymbol{\textrtailr}{TU}{"27D}%% ɽ
  201. \DeclareTextComposite{\tipaunicolon}{TU}{r}{"27D}
  202. %%-- Fricatives
  203. %%--** Bilabial
  204. \DeclareTextSymbol{\textphi}{TU}{"278}%% ɸ
  205. \DeclareTextSymbol{\textbeta}{TU}{"3B2}%% β
  206. %%--** Dental
  207. \DeclareTextSymbol{\texttheta}{TU}{"3B8}%% θ
  208. %%--** Postalveolar
  209. \DeclareTextSymbol{\textesh}{TU}{"283}%% ʃ
  210. \DeclareTextSymbol{\textyogh}{TU}{"292}%% ʒ
  211. %%--** Retroflex
  212. \DeclareTextSymbol{\textrtails}{TU}{"282}%% ʂ
  213. \DeclareTextComposite{\tipaunicolon}{TU}{s}{"282}
  214. \DeclareTextSymbol{\textrtailz}{TU}{"290}%% ʐ
  215. \DeclareTextComposite{\tipaunicolon}{TU}{z}{"290}
  216. %%--** Palatal
  217. \DeclareTextSymbol{\textctj}{TU}{"29D}%% ʝ
  218. %%--** Velar
  219. \DeclareTextSymbol{\textgamma}{TU}{"263}%% ɣ
  220. %%--** Uvular
  221. \DeclareTextSymbol{\textchi}{TU}{"3C7}%% χ
  222. \DeclareTextSymbol{\textinvscr}{TU}{"281}%% ʁ
  223. %%--** Pharyngeal
  224. \DeclareTextSymbol{\textcrh}{TU}{"127}%% ħ
  225. \DeclareTextComposite{\tipaunistar}{TU}{h}{"127}
  226. \DeclareTextSymbol{\textrevglotstop}{TU}{"295}%% ʕ
  227. %%--** Glottal
  228. \DeclareTextSymbol{\texthth}{TU}{"266}%% ɦ
  229. %%-- Lateral fricatives
  230. %%--** Alveolar
  231. \DeclareTextSymbol{\textbeltl}{TU}{"26C}%% ɬ
  232. \DeclareTextComposite{\tipaunistar}{TU}{l}{"26C}
  233. \DeclareTextSymbol{\textlyoghlig}{TU}{"26E}%% ɮ
  234. \DeclareTextComposite{\tipaunistar}{TU}{z}{"26E}
  235. %%-- Approximants
  236. %%-- Labiodental approximant
  237. \tipaunicmd{\labdentapp}{ʋ}%% tipauni-exclusive
  238. %%--** Alveolar
  239. \DeclareTextSymbol{\textturnr}{TU}{"279}%% ɹ
  240. \DeclareTextComposite{\tipaunistar}{TU}{r}{"279}
  241. %%--** Retroflex
  242. \DeclareTextSymbol{\textturnrrtail}{TU}{"27B}%% ɻ
  243. \DeclareTextComposite{\tipaunicolon}{TU}{R}{"27B}
  244. %%--** Velar
  245. \DeclareTextSymbol{\textturnmrleg}{TU}{"270}%% ɰ
  246. \DeclareTextComposite{\tipaunistar}{TU}{m}{"270}
  247. %%-- Lateral approximants
  248. %%--** Retroflex
  249. \DeclareTextSymbol{\textrtaill}{TU}{"26D}%% ɭ
  250. \DeclareTextComposite{\tipaunicolon}{TU}{l}{"26D}
  251. \DeclareTextSymbol{\textturny}{TU}{"28E}%% ʎ
  252. \DeclareTextSymbol{\textscl}{TU}{"29F}%% ʟ
  253. \DeclareTextComposite{\tipaunisemicolon}{TU}{L}{"29F}
  254. %% Non-pulmonic consonants
  255. %%-- Clicks
  256. %%--** Bilabial
  257. \DeclareTextSymbol{\textbullseye}{TU}{"298}%% ʘ
  258. \DeclareTextComposite{\tipaunibang}{TU}{o}{"298}
  259. %%-- Postalveolar click
  260. \tipaunicmd{\pstalvclick}{ǃ}%% tipauni-exclusive
  261. %%--** Palato-alveolar
  262. \DeclareTextSymbol{\textdoublebarpipe}{TU}{"1C2}%% ǂ
  263. \DeclareTextComposite{\tipaunibang}{TU}{c}{"1C2}%% tipauni-exclusive
  264. %%--** Alveolar lateral
  265. \DeclareTextSymbol{\textdoublepipe}{TU}{"1C1}% ǁ
  266. %%-- Implosives
  267. %%--** Bilabial
  268. \DeclareTextSymbol{\texthtb}{TU}{"253}%% ɓ
  269. \DeclareTextComposite{\tipaunibang}{TU}{b}{"253}
  270. %%--** Dental
  271. \DeclareTextSymbol{\texthtd}{TU}{"257}%% ɗ
  272. \DeclareTextComposite{\tipaunibang}{TU}{d}{"257}
  273. %%--** Palatal
  274. \DeclareTextSymbol{\texthtbardotlessj}{TU}{"284}%% ʄ
  275. \DeclareTextComposite{\tipaunibang}{TU}{j}{"284}
  276. %%--** Velar
  277. \DeclareTextSymbol{\texthtg}{TU}{"260}%% ɠ
  278. \DeclareTextComposite{\tipaunibang}{TU}{g}{"260}
  279. %%--** Uvular
  280. \DeclareTextSymbol{\texthtscg}{TU}{"29B}%% ʛ
  281. \DeclareTextComposite{\tipaunibang}{TU}{G}{"29B}
  282. %% Other consonants
  283. \DeclareTextSymbol{\textturnw}{TU}{"28D}%% ʍ
  284. \DeclareTextSymbol{\textturnh}{TU}{"265}%% ɥ
  285. \DeclareTextSymbol{\textsch}{TU}{"29C}%% ʜ
  286. \DeclareTextSymbol{\textbarrevglotstop}{TU}{"2A2}%% ʢ
  287. \DeclareTextComposite{\tipaunistar}{TU}{1}{"2A2}%% tipauni-exclusive
  288. \DeclareTextSymbol{\textbarglotstop}{TU}{"2A1}%% ʡ
  289. \DeclareTextComposite{\tipaunistar}{TU}{2}{"2A1}%% tipauni-exclusive
  290. \DeclareTextSymbol{\textctc}{TU}{"255}%% ɕ
  291. \DeclareTextSymbol{\textctz}{TU}{"291}%% ʑ
  292. \DeclareTextComposite{\tipaunistar}{TU}{Z}{"291}%% tipauni-exclusive
  293. \DeclareTextSymbol{\textturnlonglegr}{TU}{"27A}%% ɺ
  294. \DeclareTextComposite{\tipaunibang}{TU}{r}{"27A}%% tipauni-exclusive
  295. \DeclareTextSymbol{\texththeng}{TU}{"267}%% ɧ
  296. \DeclareTextComposite{\tipaunistar}{TU}{3}{"267}%% tipauni-exclusive
  297. \DeclareTextComposite{\tipaunistar}{TU}{k}{"029E}% ʞ
  298. \DeclareTextComposite{\tipaunistar}{TU}{t}{"287}% ʇ
  299. \DeclareTextComposite{\tipaunistar}{TU}{w}{"28D}% ʍ
  300. \DeclareTextComposite{\tipaunisemicolon}{TU}{E}{"1D07}% ᴇ
  301. \DeclareTextComposite{\tipaunisemicolon}{TU}{J}{"1D0A}% ᴊ
  302. \DeclareTextComposite{\tipaunisemicolon}{TU}{A}{"1D00}% ᴀ
  303. \DeclareTextComposite{\tipaunisemicolon}{TU}{H}{"29C}% ʜ
  304. \DeclareTextComposite{\tipaunisemicolon}{TU}{U}{"1D1C}% ᴜ
  305. %% Vowels
  306. \DeclareTextSymbol{\textsci}{TU}{"26A}%% ɪ
  307. \DeclareTextSymbol{\textscy}{TU}{"28F}%% ʏ
  308. \DeclareTextSymbol{\textepsilon}{TU}{"25B}%% ɛ
  309. \DeclareTextSymbol{\textbari}{TU}{"268}%% ɨ
  310. \DeclareTextSymbol{\textbaru}{TU}{"289}%% ʉ
  311. \DeclareTextSymbol{\textupsilon}{TU}{"28A}%% ʊ
  312. \DeclareTextSymbol{\textreve}{TU}{"258}%% ɘ
  313. \DeclareTextSymbol{\textbaro}{TU}{"275}%% ɵ
  314. \DeclareTextSymbol{\textschwa}{TU}{"259}%% ə
  315. \DeclareTextSymbol{\textrevepsilon}{TU}{"25C}%% ɜ
  316. \DeclareTextSymbol{\textcloserevepsilon}{TU}{"25E}%% ɞ
  317. \DeclareTextSymbol{\textturna}{TU}{"250}%% ɐ
  318. \DeclareTextSymbol{\textturnm}{TU}{"26F}%% ɯ
  319. \DeclareTextSymbol{\textramshorns}{TU}{"264}%% ɤ
  320. \DeclareTextSymbol{\textturnv}{TU}{"28C}%% ʌ
  321. \DeclareTextSymbol{\textopeno}{TU}{"254}%% ɔ
  322. \DeclareTextSymbol{\textscripta}{TU}{"251}%% ɑ
  323. \DeclareTextSymbol{\textturnscripta}{TU}{"252}%% ɒ
  324. %% Independent diacritic marks
  325. %%-- Rhoticity
  326. \DeclareTextSymbol{\textrhoticity}{TU}{"2DE}%% ˞
  327. \tipaunicmd{\tr}{˞}
  328. %%-- Tie bar (below)
  329. \DeclareTextCommand{\tipaunitextbottomtiebar}{TU}[2]{#1\symbol{"035C}#2}
  330. \NewDocumentCommand\textbottomtiebar{ m }{\tipaunitextbottomtiebar#1}
  331. %%-- Tie bar (below) - standalone character
  332. \DeclareTextCommand{\tipaunits}{TU}[2]{#1\symbol{"203F}#2}
  333. \NewDocumentCommand\stdlnetiebar{ m }{\tipaunits#1}
  334. \NewDocumentCommand\ts{ m }{\tipaunits#1}
  335. %% No audible release
  336. \DeclareTextSymbol{\textcorner}{TU}{"31A}%% ̚
  337. \tipaunicmd{\tc}{̚}
  338. %% Syllabic
  339. \DeclareUnicodeAccent{\textsyllabic}{TU}{"0329}%% ̩
  340. \NewDocumentCommand\s{ m }{\textsyllabic{\textipa{#1}}\tipauni@nontipatrue}
  341. %% Non-syllabic
  342. \DeclareUnicodeAccent{\textsubarch}{TU}{"032F}%% ̯
  343. \NewDocumentCommand\ns{ m }{\textsubarch{\textipa{#1}}}
  344. %% Laminal
  345. \DeclareUnicodeAccent{\textsubsquare}{TU}{"033B}%% ̻
  346. \NewDocumentCommand\lmn{ m }{\textsubsquare{\textipa{#1}}\tipauni@nontipatrue}
  347. %% Other complex shorthand commands
  348. \DeclareTextCommand{\@pipeshorthands}{TU}[2]{%
  349.   \if #1[\tipaunisubbridge{\textipa{#2}}\else
  350.  \if #1]\tipauniinvsubbridge{\textipa{#2}}\else
  351.  \if #1(\tipaunisublhalfring{\textipa{#2}}\else
  352.  \if #1)\tipaunisubrhalfring{\textipa{#2}}\else
  353.  \if #1+\tipaunisubplus{\textipa{#2}}\else
  354.  \if #1'\tipauniraising{\textipa{#2}}\else
  355.  \if #1`\tipaunilowering{\textipa{#2}}\else
  356.  \if #1<\tipauniadvancing{\textipa{#2}}\else
  357.  \if #1>\tipauniretracting{\textipa{#2}}\else
  358.  \if #1x\tipauniovercross{\textipa{#2}}\else
  359.  \if #1m\tipauniseagull{\textipa{#2}}\else #1#2%
  360.   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  361. }%
  362. \DeclareTextAccentDefault{\@pipeshorthands}{TU}
  363. \ExplSyntaxOn
  364. \NewDocumentCommand \super { m }
  365.   {%
  366.     \str_case:nn {#1}
  367.      {
  368.        {h} {ʰ}
  369.        {w} {ʷ}
  370.        {j} {ʲ}
  371.        {ɣ} {ˠ}
  372.        {ʕ} {ˤ}
  373.        {n} {ⁿ}
  374.        {l} {ˡ}
  375.      }
  376.  }
  377. \seq_new:N \l__tipauni_remove_from_accents_seq
  378. \tl_new:N \l__tipauni_textipa_tl
  379. \seq_set_split:Nnn \l__tipauni_remove_from_accents_seq { , }
  380.  { \~, \=, \", \r, \v, \t }
  381. \iftipauni@nontipa@ignore
  382.  \cs_new_eq:NN \__tipauni_nontipa_search: \prg_do_nothing:
  383.  \cs_new_eq:NN \__tipauni_nontipa_search:n \use_none:n
  384. \else
  385.  \cs_new_protected:Npn \__tipauni_nontipa_search:
  386.    {
  387.      \unless\iftipauni@nontipa
  388.        \exp_args:No \__tipauni_nontipa_search:n \l__tipauni_textipa_tl
  389.      \fi
  390.    }
  391.  \cs_new_protected:Npn \__tipauni_nontipa_search:n #1
  392.    {
  393.      \str_if_in:nnT {#1} {} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  394.      \str_if_in:nnT {#1} {ɞ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  395.      \str_if_in:nnT {#1} {ɰ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  396.      \str_if_in:nnT {#1} {ǃ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  397.      \str_if_in:nnT {#1} {ǂ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  398.      \str_if_in:nnT {#1} {ʢ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  399.      \str_if_in:nnT {#1} {ɺ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  400.      \str_if_in:nnT {#1} {ʑ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  401.      \str_if_in:nnT {#1} {ɧ} { \tipauni@nontipatrue \use_none_delimit_by_s_stop:w }
  402.      \use_none:nnn \s_stop
  403.      \use:n { \cs_gset_eq:NN \__tipauni_nontipa_search: \prg_do_nothing: }
  404.    }
  405. \fi
  406. \NewDocumentCommand\textipa{ +m }%
  407.   {
  408.    \begingroup
  409.      \let\*\tipaunistar
  410.      \let\:\tipaunicolon
  411.      \let\;\tipaunisemicolon
  412.      \let\!\tipaunibang
  413.      \let\|\tipaunipipe
  414.      \let\t\tipaunit
  415.      \seq_map_inline:Nn \l__tipauni_remove_from_accents_seq
  416.      { \tl_remove_all:Nn \l_text_accents_tl {##1} }
  417.      \tl_set:Nx \l__tipauni_textipa_tl { \text_expand:n {#1} }
  418.      \use:x
  419.        {
  420.          \exp_not:n
  421.            {
  422.              \escapechar = `\\
  423.              \tl_set:Nx \l__tipauni_textipa_tl
  424.                { \exp_args:No \__tipauni_act:n \l__tipauni_textipa_tl }
  425.              \escapechar =
  426.            }
  427.          \int_use:N \escapechar
  428.        }
  429.      \exp_stop_f:
  430.      \l__tipauni_textipa_tl
  431.      \__tipauni_nontipa_search:
  432.    \endgroup
  433.  }
  434. \scan_new:N \s__tipauni_act_stop
  435. \cs_new:Npn \__tipauni_use_none_delimit_by_act_stop:w #1 \s__tipauni_act_stop {}
  436. \cs_new:Npn \__tipauni_act:n #1 { \__tipauni_act_loop:w #1 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
  437. \cs_new_eq:NN \__tipauni_act_output:n \exp_not:n
  438. \cs_new:Npn \__tipauni_act_loop:w { \__tipauni_act_loop:Nnw \use_none:nn {} }
  439. \cs_new:Npn \__tipauni_act_loop:Nnw #1#2#3 \s__tipauni_act_stop
  440.  {
  441.    \__tipauni_act_if_head_is_space:nTF {#3}
  442.      { \__tipauni_act_space:Nnw }
  443.      {
  444.        \tl_if_head_is_group:nTF {#3}
  445.          \__tipauni_act_group:Nnn
  446.          \__tipauni_act_normal:NnN
  447.      }
  448.      #1 {#2} #3 \s__tipauni_act_stop
  449.  }
  450. \group_begin:
  451.  \cs_set:Npn \__tipauni_tmp:n #1
  452.    {
  453.      \cs_new:Npn \__tipauni_act_if_head_is_space:nTF ##1
  454.        {
  455.          \__tipauni_act_if_head_is_space:w
  456.            \s__tipauni_act_stop ##1 \s__tipauni_act_stop
  457.            \__tipauni_act_if_head_is_space_true:w
  458.            \s__tipauni_act_stop #1 \s__tipauni_act_stop
  459.            \use_ii:nn
  460.        }
  461.      \cs_new:Npn \__tipauni_act_if_head_is_space:w
  462.          ##1 \s__tipauni_act_stop #1 ##2 \s__tipauni_act_stop
  463.        {}
  464.      \cs_new:Npn \__tipauni_act_if_head_is_space_true:w
  465.          \s__tipauni_act_stop #1 \s__tipauni_act_stop \use_ii:nn ##1 ##2
  466.        {##1}
  467.      \cs_new:Npn \__tipauni_act_space:Nnw ##1 ##2 #1
  468.        {
  469.          \token_if_eq_meaning:NNTF ##1 \__tipauni_act_macro:nn
  470.            { \__tipauni_act_space_macro:nn ##2 }
  471.            {
  472.              \cs_if_exist_use:cTF { __tipauni_act_char_mono_ \tl_to_str:n { ##2 } : }
  473.                { \__tipauni_act_output:n {~} }
  474.                { \__tipauni_act_output:n { ##2 ~ } }
  475.              \__tipauni_act_loop:w
  476.            }
  477.        }
  478.    }
  479.  \__tipauni_tmp:n {~}
  480. \group_end:
  481. \cs_new:Npn \__tipauni_act_space_macro:nn #1#2
  482.  { \__tipauni_act_loop:Nnw \__tipauni_act_macro:nn { {#1} { #2 ~ } } }
  483. \cs_new:Npn \__tipauni_act_group:Nnn #1#2#3
  484.  {
  485.    \__tipauni_use_none_delimit_by_act_stop:w
  486.      #3 \__tipauni_act_final:Nnw #1 {#2} \s__tipauni_act_stop
  487.    \token_if_eq_meaning:NNTF #1 \__tipauni_act_macro:nn
  488.      { \__tipauni_act_group_macro:nn {#2} {#3} }
  489.      {
  490.        \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #2 } : }
  491.          { \__tipauni_act_output:n {#2} }
  492.        { \__tipauni_act_loop:w #3 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
  493.      }
  494.    \__tipauni_act_loop:w
  495.  }
  496. \cs_new:Npn \__tipauni_act_final:Nnw
  497.    #1#2 \s__tipauni_act_stop #3 \__tipauni_act_loop:w #4 \s__tipauni_act_stop
  498.  {
  499.    \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #2 } : }
  500.      {
  501.        \token_if_eq_meaning:NNTF #1 \__tipauni_act_macro:nn
  502.          { \exp_args:No \__tipauni_act_output:n { \use:nn #2 } }
  503.          { \__tipauni_act_output:n {#2} }
  504.      }
  505.  }
  506. \cs_new:Npn \__tipauni_act_normal:NnN #1#2#3
  507.  {
  508.    \token_if_eq_meaning:NNTF #1 \use_none:nn
  509.      {
  510.        \cs_if_exist_use:cF { __tipauni_act_normal_ \tl_to_str:n {#3} :nw }
  511.          { \__tipauni_act_output:n }
  512.          {#3}
  513.      }
  514.      { #1 {#2} {#3} }
  515.    \__tipauni_act_loop:w
  516.  }
  517. \cs_new:Npn \__tipauni_act_macro:nn #1#2
  518.  {
  519.    \cs_if_exist_use:cF
  520.      { __tipauni_act_macro_ \exp_args:No \tl_to_str:n { \use_i:nn #1 / #2 } : }
  521.      { \exp_args:No \__tipauni_act_output:n { \use:nn #1 #2 } }
  522.  }
  523. \cs_new:Npn \__tipauni_act_group_macro:nn #1#2
  524.  {
  525.    \cs_if_exist_use:cF
  526.      { __tipauni_act_macro_ \exp_args:No \tl_to_str:n { \use_i:nn #1 / #2 } : }
  527.      {
  528.        \exp_args:No \__tipauni_act_output:n { \use:nn #1 }
  529.        { \__tipauni_act_loop:w #2 {\s__tipauni_act_stop} . \s__tipauni_act_stop }
  530.      }
  531.  }
  532. \cs_new:Npn \__tipauni_act_char:nn #1#2
  533.  {
  534.    \cs_if_exist_use:cF { __tipauni_act_char_bigraph_ \tl_to_str:n { #1/#2 } : }
  535.      {
  536.        \cs_if_exist_use:cF { __tipauni_act_char_mono_ \tl_to_str:n { #1 } : }
  537.          { \__tipauni_act_output:n {#1} }
  538.        \use_i:nn { \__tipauni_act_normal:NnN \use_none:nn {} {#2} }
  539.      }
  540.  }
  541. \cs_new_protected:Npn \__tipauni_new_macro_pair_bigraph:NNNn #1#2#3#4
  542.  {
  543.    \__tipauni_new_macro_bigraph:NNn #1 #3 {#4}
  544.    \__tipauni_new_macro_bigraph:NNn #2 #3 {#4}
  545.  }
  546. \cs_new_protected:Npn \__tipauni_new_macro_bigraph:NNn #1#2#3
  547.  {
  548.    \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
  549.      { \__tipauni_act_loop:Nnw \__tipauni_act_macro:nn { {##1} {} } }
  550.    \cs_gset:cpn { __tipauni_act_macro_ \tl_to_str:n { #1/#2 } : }
  551.      { \__tipauni_act_output:n {#3} }
  552.  }
  553. \cs_new_protected:Npn \__tipauni_new_char_bigraph:NNn #1#2#3
  554.  {
  555.    \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
  556.      { \__tipauni_act_loop:Nnw \__tipauni_act_char:nn {##1} }
  557.    \cs_gset:cpn { __tipauni_act_char_bigraph_ \tl_to_str:n { #1/#2 } : }
  558.      { \__tipauni_act_output:n {#3} }
  559.  }
  560. \cs_new_protected:Npn \__tipauni_new_char_mono:Nn #1#2
  561.  {
  562.    \cs_gset:cpn { __tipauni_act_normal_ \tl_to_str:n {#1} :nw } ##1##2 \__tipauni_act_loop:w
  563.      { \__tipauni_act_loop:Nnw \__tipauni_act_char:nn {##1} }
  564.    \cs_gset:cpn { __tipauni_act_char_mono_ \tl_to_str:n {#1} : }
  565.      { \__tipauni_act_output:n {#2} }
  566.  }
  567. \__tipauni_new_macro_pair_bigraph:NNNn \! \tipaunibang      G {ʛ}
  568. \__tipauni_new_macro_pair_bigraph:NNNn \! \tipaunibang      g {ɠ}
  569. \__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar      1 {ʢ}
  570. \__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar      2 {ʡ}
  571. \__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar      3 {ɧ}
  572. \__tipauni_new_macro_pair_bigraph:NNNn \* \tipaunistar      Z {ʑ}
  573. \__tipauni_new_macro_pair_bigraph:NNNn \: \tipaunicolon     R {ɻ}
  574. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon A {ᴀ}
  575. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon G {ɢ}
  576. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon B {ʙ}
  577. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon E {ᴇ}
  578. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon H {ʜ}
  579. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon J {ᴊ}
  580. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon L {ʟ}
  581. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon N {ɴ}
  582. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon R {ʀ}
  583. \__tipauni_new_macro_pair_bigraph:NNNn \; \tipaunisemicolon U {ᴜ}
  584. \__tipauni_new_char_bigraph:NNn || {ǁ}
  585. \__tipauni_new_char_bigraph:NNn "" {ˌ}
  586. \clist_map_inline:nn
  587.  {
  588.    {5}{ɐ}, {A}{ɑ}, {6}{ɒ}, {2}{ʌ}, {B}{β}, {C}{ɕ}, {D}{ð}, {9}{ɘ}, {E}{ɛ},
  589.    {3}{ɜ}, {g}{ɡ}, {G}{ɣ}, {7}{ɤ}, {H}{ɦ}, {L}{ʎ}, {4}{ɥ}, {1}{ɨ}, {I}{ɪ},
  590.    {J}{ʝ}, {M}{ɱ}, {W}{ɯ}, {N}{ŋ}, {8}{ɵ}, {O}{ɔ}, {F}{ɸ}, {R}{ɾ}, {K}{ʁ},
  591.    {S}{ʃ}, {T}{θ}, {0}{ʉ}, {U}{ʊ}, {V}{ʋ}, {X}{χ}, {Y}{ʏ}, {Z}{ʒ},
  592.    {P}{ʔ}, {Q}{ʕ},
  593.    {:}{ː}, {;}{ˑ}, {!}{ǃ}, {&}{ɞ}, {@}{ə}, {|}{ǀ}, {"}{ˈ}
  594.  }
  595.  { \__tipauni_new_char_mono:Nn #1 }
  596. \ExplSyntaxOff
  597. %%-- Dependent diacritic marks
  598. %%--** Voiceless
  599. \DeclareUnicodeAccent{\textsubring}{TU}{"0325}%% ̥
  600. \DeclareTextCommand{\r}{TU}{\tipaunisubring}
  601. \protected\def\tipaunisubring{\@ifstar{\TipaUniSubRing}{\TipaUniSubRing}}
  602. \NewDocumentCommand\TipaUniSubRing{ m }{\textsubring{\textipa{#1}}}
  603. %%--** Voiced
  604. \DeclareUnicodeAccent{\textsubwedge}{TU}{"032C}%% ̬
  605. \DeclareTextCommand{\v}{TU}{\tipaunisubwedge}
  606. \protected\def\tipaunisubwedge{\@ifstar{\TipaUniSubWedge}{\TipaUniSubWedge}}
  607. \NewDocumentCommand\TipaUniSubWedge{ m }{\textsubwedge{\textipa{#1}}}
  608. %%--** More rounded
  609. \DeclareUnicodeAccent{\textsubrhalfring}{TU}{"0339}%% ̹
  610. \NewDocumentCommand\tipaunisubrhalfring{ m }{\textsubrhalfring{\textipa{#1}}}
  611. %%--** Less rounded
  612. \DeclareUnicodeAccent{\textsublhalfring}{TU}{"031C}%% ̜
  613. \NewDocumentCommand\tipaunisublhalfring{ m }{\textsublhalfring{\textipa{#1}}}
  614. %%--** Advanced
  615. \DeclareUnicodeAccent{\textsubplus}{TU}{"031F}%% ̟
  616. \NewDocumentCommand\tipaunisubplus{ m }{\textsubplus{\textipa{#1}}}
  617. %%--** Retracted
  618. \DeclareUnicodeAccent{\textsubbar}{TU}{"0320}%% ̠
  619. \DeclareTextCommand{\=}{TU}{\tipaunisubbar}
  620. \protected\def\tipaunisubbar{\@ifstar{\TipaUniSubBar}{\TipaUniSubBar}}
  621. \NewDocumentCommand\TipaUniSubBar{ m }{\textsubbar{\textipa{#1}}}
  622. %%--** Mid-centralized
  623. \DeclareUnicodeAccent{\textovercross}{TU}{"033D}%% ̽
  624. \NewDocumentCommand\tipauniovercross{ m }{\textovercross{\textipa{#1}}}
  625. %%--** Breathy voiced
  626. \DeclareUnicodeAccent{\textsubumlaut}{TU}{"0324}%% ̤
  627. \DeclareTextCommand{\"}{TU}{\tipaunisubumlaut}
  628. \protected\def\tipaunisubumlaut{\@ifstar{\TipaUniSubUmlaut}{\TipaUniSubUmlaut}}
  629. \NewDocumentCommand\TipaUniSubUmlaut{ m }{\textsubumlaut{\textipa{#1}}}
  630. %%--** Creaky voiced
  631. \DeclareUnicodeAccent{\textsubtilde}{TU}{"0330}%% ̰
  632. \DeclareTextCommand{\~}{TU}{\tipaunisubtilde}
  633. \protected\def\tipaunisubtilde{\@ifstar{\TipaUniSubTilde}{\TipaUniSubTilde}}
  634. \NewDocumentCommand\TipaUniSubTilde{ m }{\textsubtilde{\textipa{#1}}}
  635. %%--** Linguo-labialized
  636. \DeclareUnicodeAccent{\textseagull}{TU}{"033C}%% ̼
  637. \NewDocumentCommand\tipauniseagull{ m }{\textseagull{#1}}
  638. %%--** Velarized
  639. \DeclareUnicodeAccent{\textsuperimposetilde}{TU}{"0334}%% ̴
  640. \NewDocumentCommand\tipaunisuperimposetilde{ m }{\textsuperimposetilde{#1}}
  641. \NewDocumentCommand\vl{ m }{\textsuperimposetilde{\textipa{#1}}}
  642. %%--** Raised
  643. \DeclareUnicodeAccent{\textraising}{TU}{"031D}%% ̝
  644. \NewDocumentCommand{\tipauniraising}{m}{\textraising{#1}}
  645. %%--** Lowered
  646. \DeclareUnicodeAccent{\textlowering}{TU}{"031E}%% ̞
  647. \NewDocumentCommand{\tipaunilowering}{m}{\textlowering{#1}}
  648. %%%--** Advanced tongue root
  649. \DeclareUnicodeAccent{\textadvancing}{TU}{"0318}%% ̘
  650. \NewDocumentCommand{\tipauniadvancing}{m}{\textadvancing{#1}}
  651. %%--** Retracted tongue root
  652. \DeclareUnicodeAccent{\textretracting}{TU}{"0319}%% ̙
  653. \NewDocumentCommand{\tipauniretracting}{m}{\textretracting{#1}}
  654. %%--** Dental
  655. \DeclareUnicodeAccent{\textsubbridge}{TU}{"032A}%% ̪
  656. \NewDocumentCommand\tipaunisubbridge{ m }{\textsubbridge{#1}}
  657. %%--** Apical
  658. \DeclareUnicodeAccent{\textinvsubbridge}{TU}{"033A}%% ̺
  659. \NewDocumentCommand\tipauniinvsubbridge{ m }{\textinvsubbridge{#1}}
  660. %%--** Tie bar (above)
  661. \DeclareTextCommand{\tipaunitexttoptiebar}{TU}[2]{#1\symbol{"0361}#2}
  662. \NewDocumentCommand\texttoptiebar{ m }{\tipaunitexttoptiebar#1}
  663. \DeclareTextCommand{\tipaunit}{TU}{\@ifstar{\textbottomtiebar}{\texttoptiebar}}
  664. \NewDocumentEnvironment{IPA}{+b}{\textipa{#1}}{}
  665. \endinput
  666. %%
  667. %% End of file `tipauni.sty'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement