diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/unicode-alphabets/unicode-alphabets.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/unicode-alphabets/unicode-alphabets.sty | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/unicode-alphabets/unicode-alphabets.sty b/Master/texmf-dist/tex/latex/unicode-alphabets/unicode-alphabets.sty new file mode 100644 index 00000000000..147336e2d73 --- /dev/null +++ b/Master/texmf-dist/tex/latex/unicode-alphabets/unicode-alphabets.sty @@ -0,0 +1,109 @@ +\ProvidesPackage{unicode-alphabets}[2019/07/17 Unicode alphabets in the Private Use Area] + +% License: CC-BY-4.0 +% Author: Mikkel Eide Eriksen <mikkel.eriksen@gmail.com> + +\RequirePackage{pgfkeys} +\RequirePackage{pgfopts} + +\RequirePackage{etoolbox} +\RequirePackage{xparse} + +\RequirePackage{csvsimple} + +\include{csvsimple.tmp.patch} + +\makeatletter + +\newcommand\alph@keys[1]{\pgfkeys{/unicode-alphabets/.cd,#1}} + +\newif\ifalph@noentitymacros +\alph@keys{ + fonts/.code={\alph@keys{fonts/.cd,#1}}, +% disable entity macros/.is if=alph@noentitymacros, +% disable entity macros=false, + disableentitymacros/.is if=alph@noentitymacros, + disableentitymacros=false, +} + +\newcommand\alph@setup[2]{ + \edef\temp{% + \noexpand\alph@keys{ + fonts/#1/.store in=\unexpanded\expandafter{\csname alph@font@#2\endcsname}, + }% + }\temp% + \alph@keys{ + #1/.default={#2}, + #1/.code={\alph@make@set{#2}{##1}}, + } +} +\alph@setup{CYFI}{cyfi} +\alph@setup{MUFI}{mufi} +\alph@setup{SIL}{sil} +\alph@setup{TITUS}{titus} +\alph@setup{UNZ}{unz} +\alph@keys{ + LINCUA/.style={CYFI,MUFI,TITUS} +} + +\newcommand\alph@make@set[2]{% + % #1 = character set + % #2 = macro name + \alph@make@main{#1}{#2}% + \csvloop{ + file={unicode-alphabets.#1.tsv}, + separator=tab, + head to column names, + head to column names prefix=alph@, + command={ + \csxdef{alph@#1@\alph@name}{\alph@codepoint}% + %\csshow{alph@entity}% + \ifcsdef{alph@entity}{% + \ifcsempty{alph@entity}{}{% + \csxdef{alph@#1@\alph@entity}{\alph@codepoint}% + \ifalph@noentitymacros\relax\else% + \expanded{\unexpanded{\alph@make@character}{#1}{#2}{\alph@entity}{\alph@codepoint}}% + \fi% + }% + }{}% + }% + }% +} +\newcommand\alph@make@main[2]{% + % #1 = character set + % #2 = macro name + \expandafter\NewDocumentCommand\csname#2\endcsname { s m } {% + % #1 = star + % #2 = character name + {% + \IfBooleanF{##1}{% + \csuse{alph@font@#1}% + }% + %!\csuse{alph@#1@##2}!% + \ifcsdef{alph@#1@##2}{% + \symbol{"\csuse{alph@#1@##2}}% + }{% + \symbol{"##2}% + }% + }% + }% +} +\newcommand\alph@make@character[4]{% + % #1 = character set + % #2 = macro name + % #3 = character name + % #4 = code point + \expandafter\ProvideDocumentCommand\csname#3\endcsname { s } {% + {% + \IfBooleanTF{##1}{% + \csuse{#2}*{#4}% + }{% + \csuse{#2}{#4}% + }% + }% + }% +} + +\makeatother + +\ProcessPgfPackageOptions{/unicode-alphabets}
\ No newline at end of file |