summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-15 22:16:48 +0000
committerKarl Berry <karl@freefriends.org>2016-05-15 22:16:48 +0000
commit4f080f1e6b8bb62696c07e145f7409340531f24e (patch)
treef32f753eb85bd701f92c7253489b58fd36ae963d /Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
parent0268f77d41324e2fcc74e3d36cec0039fef41151 (diff)
churchslavonic (15may16)
git-svn-id: svn://tug.org/texlive/trunk@41167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty')
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty196
1 files changed, 196 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty b/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
new file mode 100644
index 00000000000..212b58886b0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
@@ -0,0 +1,196 @@
+\ProvidesPackage{cu-util}[2016/03/31 v1.0 CU Util]
+
+\RequirePackage{etoolbox}
+%
+% Some ideas taken from:
+% http://tex.stackexchange.com/questions/33197/parsing-a-macro-argument-character-by-character-for-conditional-execution
+%
+\def\cu@declare@accent#1{%
+ \def\cu@@declare@accent##1##2\relax{%
+ \@namedef{cu@accent@\detokenize{##2}}{\relax}%
+ }%
+ \cu@@declare@accent#1\relax
+}%
+%
+\newcommand\cu@tokenizeletter[1]{%
+ \bgroup
+ \def\@accum{}%
+ \def\cu@collectworker{%
+ \cu@ifnextaccent{%
+ \cu@collectworker@one
+ }{%
+ \expandafter \egroup \expandafter #1\expandafter {\@accum}%
+ }%
+ }%
+ \def\cu@collectworker@one##1{%
+ \edef\@accum{\@accum ##1}%
+ \cu@collectworker
+ }%
+ \def\cu@collectworker@two##1##2{%
+ \edef\@accum{\@accum ##1##2}%
+ \cu@collectworker
+ }%
+ \cu@ifnextbgroup{\egroup #1}{%
+ \cu@ifnextdigraph{\cu@collectworker@two}{\cu@collectworker@one}%
+ }%
+}%
+%
+\newrobustcmd\cu@ifnextletter[2]{%
+ \bgroup
+ \def\cu@worker{%
+ \ifcat\noexpand\@let@token a%
+ \expandafter\egroup\expandafter\@firstoftwo
+ \else
+ \expandafter\egroup\expandafter\@secondoftwo
+ \fi
+ {#1}{#2}%
+ }%
+ \futurelet\@let@token\cu@worker
+}
+%
+\newrobustcmd\cu@ifnextaccent[2]{%
+ \bgroup
+ \def\cu@letter@i{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false
+ }{%
+ \cu@letter@ii
+ }%
+ }%
+ \def\cu@letter@ii##1{%
+ \ifcsdef{cu@accent@\detokenize{##1}}{%
+ \egroup #1##1% true
+ }{%
+ \egroup #2##1% false
+ }%
+ }%
+ \futurelet\@let@token\cu@letter@i
+}%
+%
+% Detect Oy and oy digraphs
+% kv command colors just one letter with all accents if any
+\def\cu@declare@digraph#1#2\relax{%
+ \@namedef{cu@digraph@start@\detokenize{#1}}{\relax}%
+ \@namedef{cu@digraph@end@\detokenize{#2}}{\relax}%
+}%
+%
+\cu@declare@digraph оу\relax
+\cu@declare@digraph Оу\relax
+\cu@declare@digraph ᲂу\relax
+%
+\newrobustcmd{\cu@ifnextdigraph}[2]{%
+ \bgroup
+ \def\cu@digraph@i{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false!
+ }{%
+ \cu@digraph@ii
+ }%
+ }%
+ \def\cu@digraph@ii##1{%
+ \ifcsdef{cu@digraph@start@\detokenize{##1}}{%
+ \edef\@accum{\@accum##1}%
+ \futurelet\@let@token\cu@digraph@iii
+ }{%
+ \egroup #2##1% false!
+ }%
+ }%
+ \def\cu@digraph@iii##1{%
+ \ifcsdef{cu@digraph@end@\detokenize{##1}}{%
+ \expandafter \egroup \expandafter #1\@accum ##1% true!
+ }{%
+ \expandafter \egroup \expandafter #2\@accum ##1% false!
+ }%
+ }%
+ \def\@accum{}%
+ \futurelet\@let@token\cu@digraph@i
+}%
+%
+\newrobustcmd{\cu@ifnextbgroup}[2]{%
+ \bgroup
+ \def\cu@bgroup{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false!
+ }{%
+ \egroup\@ifnextchar\bgroup{#1}{#2}%
+ }%
+ }%
+ \futurelet\@let@token\cu@bgroup
+}%
+%
+\def\cu@test@tokenizeletter#1#2{%
+ \bgroup
+ \def\cu@testframe##1##2\@nnil{%
+ \edef\@aa{##1-##2}%
+ }%
+ \cu@tokenizeletter\cu@testframe #1\@nnil
+ \def\@bb{#2}%
+ \ifx\@aa\@bb\else
+ \errmessage{TEST FAILED: #1: "\@aa" expected "\@bb"}%
+ \fi
+ \egroup
+}%
+%
+% List all accents
+%
+%% declare all possible combineres (generated by make_declare_accents)
+\cu@declare@accent{◌̀}
+\cu@declare@accent{◌́}
+\cu@declare@accent{◌̑}
+\cu@declare@accent{◌̈}
+\cu@declare@accent{◌҆}
+\cu@declare@accent{◌̆}
+\cu@declare@accent{◌̾}
+\cu@declare@accent{◌꙽}
+\cu@declare@accent{◌꙼}
+\cu@declare@accent{◌̇}
+\cu@declare@accent{◌̏}
+\cu@declare@accent{◌҃}
+\cu@declare@accent{◌҇}
+\cu@declare@accent{◌ⷠ}
+\cu@declare@accent{◌ⷡ}
+\cu@declare@accent{◌ⷢ}
+\cu@declare@accent{◌ⷣ}
+\cu@declare@accent{◌ⷤ}
+\cu@declare@accent{◌ⷥ}
+\cu@declare@accent{◌ⷦ}
+\cu@declare@accent{◌ⷧ}
+\cu@declare@accent{◌ⷨ}
+\cu@declare@accent{◌ⷩ}
+\cu@declare@accent{◌ⷪ}
+\cu@declare@accent{◌ⷫ}
+\cu@declare@accent{◌ⷬ}
+\cu@declare@accent{◌ⷭ}
+\cu@declare@accent{◌ⷮ}
+\cu@declare@accent{◌ⷯ}
+\cu@declare@accent{◌ⷰ}
+\cu@declare@accent{◌ⷱ}
+\cu@declare@accent{◌ⷲ}
+\cu@declare@accent{◌ⷳ}
+\cu@declare@accent{◌ⷴ}
+\cu@declare@accent{◌ⷵ}
+\cu@declare@accent{◌ⷶ}
+\cu@declare@accent{◌ⷷ}
+\cu@declare@accent{◌ⷸ}
+\cu@declare@accent{◌ⷹ}
+\cu@declare@accent{◌ⷺ}
+\cu@declare@accent{◌ⷻ}
+\cu@declare@accent{◌ⷼ}
+\cu@declare@accent{◌ⷽ}
+\cu@declare@accent{◌ⷾ}
+\cu@declare@accent{◌ⷿ}
+\cu@declare@accent{◌ꙴ}
+\cu@declare@accent{◌ꙵ}
+\cu@declare@accent{◌ꙶ}
+\cu@declare@accent{◌ꙷ}
+\cu@declare@accent{◌ꙸ}
+\cu@declare@accent{◌ꙹ}
+\cu@declare@accent{◌ꙺ}
+\cu@declare@accent{◌ꙻ}
+\cu@declare@accent{◌꙼}
+\cu@declare@accent{◌꙽}
+\cu@declare@accent{◌҆}
+\cu@declare@accent{◌҅}
+%% end of generated block
+
+\endinput