summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/huaz/huaz.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/huaz/huaz.sty')
-rw-r--r--macros/latex/contrib/huaz/huaz.sty519
1 files changed, 519 insertions, 0 deletions
diff --git a/macros/latex/contrib/huaz/huaz.sty b/macros/latex/contrib/huaz/huaz.sty
new file mode 100644
index 0000000000..c6b40e6f14
--- /dev/null
+++ b/macros/latex/contrib/huaz/huaz.sty
@@ -0,0 +1,519 @@
+%%
+%% `huaz.sty'
+%%
+%% Automatic Hungarian definite articles
+%%
+%% Copyright 2022 by Tibor Tomacs
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Tibor Tomacs.
+%%
+\NeedsTeXFormat{LaTeX2e}[2021/10/10]
+\ProvidesPackage{huaz}[2022/10/16 v1.0 Automatic Hungarian definite articles]
+
+\RequirePackage{xstring,refcount,iftex}
+
+\newif\ifhuaz@must@z@\huaz@must@z@false
+\newif\ifhuaz@must@oneunit@\huaz@must@oneunit@false
+\newif\ifhuaz@temp@if@\huaz@temp@if@false
+\newif\ifhuaz@show@\huaz@show@true
+
+\newcounter{huaz@temp@count}
+\newcounter{huaz@temp@count@}
+
+%=================================================
+%
+% utf8:
+% \huaz@list@A = ö,ü,ó,ő,ú,é,á,ű,í,Ö,Ü,Ó,Ő,Ú,É,Á,Ű,Í,Ä,À,Ã,Â,Ă,Å,Ą,Æ,ä,à,ã,â,ă,å,ą,æ,Ë,È,Ê,Ě,Ę,ë,è,ê,ě,ę,Ï,Í,Ì,Î,ï,ì,î,Ò,Õ,Ô,Ø,OE,ò,õ,ô,ø,Ù,Û,Ů,ù,û,ů
+% \huaz@list@X = Ĺ,Ł,ļ,ĺ,ł,Ņ,Ń,Ñ,Ň,Ŋ,ń,ñ,ň,ŋ,Ŗ,Ŕ,Ř,ŗ,ŕ,ř,Ş,Ș,Ś,Š,ş,ș,ś,š,Ÿ,Ý,ÿ,ý
+%
+% latin2:
+% \huaz@list@A = Ą,ą,Á,Â,Ă,Ä,É,Ę,Ë,Ě,Í,Î,Ó,Ô,Ő,Ö,Ů,Ú,Ű,Ü,á,â,ă,ä,é,ę,ë,ě,í
+% \huaz@list@X = Ľ,Ś,Š,Ş,ś,š,ş,Ŕ,Ĺ,Ń,Ň,Ř,Ý,ĺ
+%
+%=================================================
+
+\ifpdftex
+ \def\huaz@utfviii{utf8}
+ \ifx\inputencodingname\huaz@utfviii
+ \def\huaz@list@A{^^c3^^b6,^^c3^^bc,^^c3^^b3,^^c5^^91,^^c3^^ba,^^c3^^a9,^^c3^^a1,^^c5^^b1,^^c3^^ad,^^c3^^96,^^c3^^9c,^^c3^^93,^^c5^^90,^^c3^^9a,^^c3^^89,^^c3^^81,^^c5^^b0,^^c3^^8d,^^c3^^84,^^c3^^80,^^c3^^83,^^c3^^82,^^c4^^82,^^c3^^85,^^c4^^84,^^c3^^86,^^c3^^a4,^^c3^^a0,^^c3^^a3,^^c3^^a2,^^c4^^83,^^c3^^a5,^^c4^^85,^^c3^^a6,^^c3^^8b,^^c3^^88,^^c3^^8a,^^c4^^9a,^^c4^^98,^^c3^^ab,^^c3^^a8,^^c3^^aa,^^c4^^9b,^^c4^^99,^^c3^^8f,^^c3^^8d,^^c3^^8c,^^c3^^8e,^^c3^^af,^^c3^^ac,^^c3^^ae,^^c3^^92,^^c3^^95,^^c3^^94,^^c3^^98,^^4f^^45,^^c3^^b2,^^c3^^b5,^^c3^^b4,^^c3^^b8,^^c3^^99,^^c3^^9b,^^c5^^ae,^^c3^^b9,^^c3^^bb,^^c5^^af}
+ \def\huaz@list@X{^^c4^^b9,^^c5^^81,^^c4^^bc,^^c4^^ba,^^c5^^82,^^c5^^85,^^c5^^83,^^c3^^91,^^c5^^87,^^c5^^8a,^^c5^^84,^^c3^^b1,^^c5^^88,^^c5^^8b,^^c5^^96,^^c5^^94,^^c5^^98,^^c5^^97,^^c5^^95,^^c5^^99,^^c5^^9e,^^c8^^98,^^c5^^9a,^^c5^^a0,^^c5^^9f,^^c8^^99,^^c5^^9b,^^c5^^a1,^^c5^^b8,^^c3^^9d,^^c3^^bf,^^c3^^bd}
+ \huaz@must@oneunit@false
+ \fi
+ \def\huaz@latinii{latin2}
+ \ifx\inputencodingname\huaz@latinii
+ \def\huaz@list@A{^^a1,^^b1,^^c1,^^c2,^^c3,^^c4,^^c9,^^ca,^^cb,^^cc,^^cd,^^ce,^^d3,^^d4,^^d5,^^d6,^^d9,^^da,^^db,^^dc,^^e1,^^e2,^^e3,^^e4,^^e5,^^e9,^^ea,^^eb,^^ec,^^ed,^^ee,^^f3,^^f4,^^f5,^^f6,^^f9,^^fa,^^fb,^^fc}
+ \def\huaz@list@X{^^a3,^^a5,^^a6,^^a9,^^aa,^^b3,^^b6,^^b9,^^ba,^^c0,^^c5,^^d1,^^d2,^^d8,^^dd,^^df,^^e0,^^f1,^^f2,^^f8,^^fd}
+ \huaz@must@oneunit@true
+ \fi
+ \ifx\inputencodingname\huaz@utfviii\else
+ \ifx\inputencodingname\huaz@latinii\else
+ \PackageError{huaz}{You should use utf8 or latin2 inputenc}{}
+ \fi
+ \fi
+\else
+ \def\huaz@list@A{^^^^00f6,^^^^00fc,^^^^00f3,^^^^0151,^^^^00fa,^^^^00e9,^^^^00e1,^^^^0171,^^^^00ed,^^^^00d6,^^^^00dc,^^^^00d3,^^^^0150,^^^^00da,^^^^00c9,^^^^00c1,^^^^0170,^^^^00cd,^^^^00c4,^^^^00c0,^^^^00c3,^^^^00c2,^^^^0102,^^^^00c5,^^^^0104,^^^^00c6,^^^^00e4,^^^^00e0,^^^^00e3,^^^^00e2,^^^^0103,^^^^00e5,^^^^0105,^^^^00e6,^^^^00cb,^^^^00c8,^^^^00ca,^^^^011a,^^^^0118,^^^^00eb,^^^^00e8,^^^^00ea,^^^^011b,^^^^0119,^^^^00cf,^^^^00cd,^^^^00cc,^^^^00ce,^^^^00ef,^^^^00ec,^^^^00ee,^^^^00d2,^^^^00d5,^^^^00d4,^^^^00d8,^^^^004f,^^^^0045,^^^^00f2,^^^^00f5,^^^^00f4,^^^^00f8,^^^^00d9,^^^^00db,^^^^016e,^^^^00f9,^^^^00fb,^^^^016f}
+ \def\huaz@list@X{^^^^0139,^^^^0141,^^^^013c,^^^^013a,^^^^0142,^^^^0145,^^^^0143,^^^^00d1,^^^^0147,^^^^014a,^^^^0144,^^^^00f1,^^^^0148,^^^^014b,^^^^0156,^^^^0154,^^^^0158,^^^^0157,^^^^0155,^^^^0159,^^^^015e,^^^^0218,^^^^015a,^^^^0160,^^^^015f,^^^^0219,^^^^015b,^^^^0161,^^^^0178,^^^^00dd,^^^^00ff,^^^^00fd}
+ \huaz@must@oneunit@true
+\fi
+
+%=================================================
+%
+% \NewHook{huaz}
+%
+%=================================================
+
+\NewHook{huaz}
+
+\AddToHook{huaz}{% In \StrChar, these commands will be considered as one syntax unit.
+ \let\"\relax\let\'\relax\let\H\relax\let\`\relax\let\~\relax\let\^\relax\let\v\relax\let\u\relax%
+ \let\=\relax\let\k\relax\let\.\relax\let\AA\relax\let\aa\relax\let\AE\relax\let\ae\relax\let\&\relax%
+ \let\#\relax\let\_\relax}
+
+\def\huaz@y@#1#{\@gobble}
+\def\huaz@deloptparam{\huaz@y@\relax}% \def\textcolor{\huaz@deloptparam} --> \textcolor[RGB]{0,255,0}{text} --> text; \textcolor{red}{text} --> text
+
+\AddToHook{huaz}{% Ignored commands
+ \def\textrm{}\def\rmfamily{}%
+ \def\textsf{}\def\sffamily{}%
+ \def\texttt{}\def\ttfamily{}%
+ \def\textnormal{}\def\normalfont{}%
+ \def\textbf{}\def\bfseries{}%
+ \def\textmd{}\def\mdseries{}%
+ \def\textit{}\def\itshape{}%
+ \def\textsl{}\def\slshape{}%
+ \def\textsc{}\def\scshape{}%
+ \def\textup{}\def\upshape{}%
+ \def\textulc{}\def\ulcshape{}%
+ \def\textsw{}\def\swshape{}%
+ \def\textssc{}\def\sscshape{}%
+ \def\emph{}\def\em{}%
+ \def\underline{}%
+ \def\tiny{}\def\scriptsize{}\def\footnotesize{}\def\small{}\def\normalsize{}%
+ \def\large{}\def\Large{}\def\LARGE{}\def\huge{}\def\Huge{}%
+ \def\uppercase{}\def\lowercase{}\def\MakeUppercase{}\def\MakeLowercase{}%
+ \def\textcolor{\huaz@deloptparam}\def\color{\huaz@deloptparam}%
+ \def\mbox{}\def\fbox{}}
+
+\AddToHook{huaz}{% Expandable cross-references commands
+ \def\ref#1{\getrefnumber{#1}}%
+ \def\eqref#1{\getrefnumber{#1}}%
+ \def\pageref#1{\getpagerefnumber{#1}}%
+ \def\cite{\huaz@cite}}
+
+%=================================================
+%
+% \huaz@z{<...>} --> "z", if the definite article of <...> is "az"
+% E.g. \huaz@z{asztal} --> "z" ("az asztal")
+% \huaz@z{szék} --> "" ("a szék")
+%
+%=================================================
+
+\NewDocumentCommand{\huaz@z}{m}{%
+ \begingroup%
+ \exploregroups%
+ \UseHook{huaz}%
+ \huaz@must@z@false%
+ %
+ % 1. syntax unit \AA,\aa,\AE,\ae,e,u,i,o,a,E,U,I,O,A,5
+ \StrChar{#1}{1}[\huaz@temp]%
+ \@for\huaz@list:={\AA,\aa,\AE,\ae,e,u,i,o,a,E,U,I,O,A,5}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ %
+ % 1. syntax unit accent command and 2. character e,u,i,o,a,E,U,I,O,A (e.g. "\'A")
+ \ifhuaz@must@z@\else%
+ \huaz@temp@if@false%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \@for\huaz@list:={\",\',\H,\`,\~,\^,\v,\u,\=,\k}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}%
+ \ifhuaz@temp@if@%
+ \StrChar{#1}{2}[\huaz@temp]%
+ \@for\huaz@list:={e,u,i,a,E,U,I,O,A}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \fi%
+ \fi%
+ %
+ % 1. character ö,ü,ó,ő,ú,é,á,ű,í,Ö,Ü,Ó,Ő,Ú,É,Á,Ű,Í,...
+ \ifhuaz@must@z@\else%
+ \ifhuaz@must@oneunit@\StrLeft{#1}{1}[\huaz@tempa]\else\StrLeft{#1}{2}[\huaz@tempa]\fi% in pdflatex(utf8) Ő is two syntax units; in pdflatex(latin2)/xelatex/lualatex Ő is one syntax unit
+ \@for\huaz@list:=\huaz@list@A%
+ \do{\StrLeft{\huaz@list}{2}[\huaz@tempb]%
+ \IfStrEq{\huaz@tempa}{\huaz@tempb}{\huaz@must@z@true}{}}%
+ \fi%
+ %
+ % 1. character f,l,m,n,r,x,y,F,L,M,N,S,R,X,Y and the 2. character is not letter (e.g. "M-10")
+ \ifhuaz@must@z@\else%
+ \huaz@temp@if@false%
+ \StrChar{#1}{2}[\huaz@temp]%
+ \@for\huaz@list:={;,`,',",+,!,/,=,(,),<,>,@,.,?,:,-,*,0,1,2,3,4,5,6,7,8,9,{,},{ },{},\&,\#,\_,\unskip,\kern}% \kern, \unskip for active characters
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}%
+ \ifhuaz@temp@if@%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \@for\huaz@list:={f,l,m,n,r,x,y,F,L,M,N,S,R,X,Y}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \ifhuaz@must@oneunit@%
+ \ifhuaz@must@z@\else%
+ \@for\huaz@list:=\huaz@list@X% in pdflatex(latin2)/xelatex/lualatex Š is one syntax unit
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % 1. syntax unit accent command, 2. character f,l,m,n,r,x,y,F,L,M,N,S,R,X,Y and the 3. character is not letter (e.g. "\^Y.")
+ \ifhuaz@must@z@\else%
+ \huaz@temp@if@false%
+ \StrChar{#1}{3}[\huaz@temp]%
+ \@for\huaz@list:={;,`,',",+,!,/,=,(,),<,>,@,.,?,:,-,*,0,1,2,3,4,5,6,7,8,9,{,},{ },{},\&,\#,\_,\unskip,\kern}% \kern, \unskip for active characters
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}%
+ \ifhuaz@temp@if@%
+ \huaz@temp@if@false%
+ \StrChar{#1}{2}[\huaz@temp]%
+ \@for\huaz@list:={f,l,m,n,r,x,y,F,L,M,N,S,R,X,Y}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}%
+ \ifhuaz@temp@if@%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \@for\huaz@list:={\",\',\H,\`,\~,\^,\v,\u,\=,\k}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % first two characters ly,Ly,LY,ny,Ny,NY,sz,Sz,SZ,... and the 3. character is not letter (e.g. "NY" or "SZ-2")
+ \ifhuaz@must@z@\else%
+ \huaz@temp@if@false%
+ \StrChar{#1}{3}[\huaz@temp]%
+ \@for\huaz@list:={;,`,',",+,!,/,=,(,),<,>,@,.,?,:,-,*,0,1,2,3,4,5,6,7,8,9,{,},{ },{},\&,\#,\_,\unskip,\kern}% \kern, \unskip for active characters
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}%
+ \ifhuaz@temp@if@%
+ \StrLeft{#1}{2}[\huaz@temp]%
+ \@for\huaz@list:={ly,Ly,LY,ny,Ny,NY,sz,Sz,SZ}%
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \ifhuaz@must@oneunit@\else%
+ \ifhuaz@must@z@\else%
+ \@for\huaz@list:=\huaz@list@X% in pdflatex(utf8) Š is two syntax units
+ \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % 1. character 1 and the 2. character is not number (e.g. "1H")
+ \ifhuaz@must@z@\else%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \IfStrEq{\huaz@temp}{1}{%
+ \StrChar{#1}{2}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{}{\huaz@must@z@true}%
+ }{}%
+ \fi%
+ %
+ % 1000,...,1999 and the 5. character is not number ("ezer...")
+ \ifhuaz@must@z@\else%
+ \StrLen{#1}[\huaz@temp]%
+ \setcounter{huaz@temp@count}{\huaz@temp}%
+ \ifnum\value{huaz@temp@count}>3%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \IfStrEq{\huaz@temp}{1}{%
+ \StrMid{#1}{2}{4}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{%
+ \StrChar{#1}{5}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{}{\huaz@must@z@true}%
+ }{}%
+ }{}%
+ \fi%
+ \fi%
+ %
+ % 1000000,...,1999999 and the 8. character is not number ("egymillió...")
+ \ifhuaz@must@z@\else%
+ \StrLen{#1}[\huaz@temp]%
+ \setcounter{huaz@temp@count}{\huaz@temp}%
+ \ifnum\value{huaz@temp@count}>6%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \IfStrEq{\huaz@temp}{1}{%
+ \StrMid{#1}{2}{7}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{%
+ \StrChar{#1}{8}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{}{\huaz@must@z@true}%
+ }{}%
+ }{}%
+ \fi%
+ \fi%
+ %
+ % 1000000000,...,1999999999 and the 11. character is not number ("egymilliárd...")
+ \ifhuaz@must@z@\else%
+ \StrLen{#1}[\huaz@temp]%
+ \setcounter{huaz@temp@count}{\huaz@temp}%
+ \ifnum\value{huaz@temp@count}>9%
+ \StrChar{#1}{1}[\huaz@temp]%
+ \IfStrEq{\huaz@temp}{1}{%
+ \StrMid{#1}{2}{10}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{%
+ \StrChar{#1}{11}[\huaz@temp]%
+ \IfInteger{\huaz@temp}{}{\huaz@must@z@true}%
+ }{}%
+ }{}%
+ \fi%
+ \fi%
+ %
+ \gdef\huaz@save{}%
+ \ifhuaz@must@z@\gdef\huaz@save{z}\ifhuaz@show@ z\fi\fi%
+ \endgroup}
+
+%=================================================
+%
+% \huaz@romantoarabic{<...>}
+% If <...> is a roman number, then it will be converted to arabic.
+% If <...> is not a roman number, then the result is -1.
+% If <...> is empty, then the result is 0.
+% E.g. \huaz@\romantoarabic{xiv} --> "14"
+% \huaz@\romantoarabic{aaaa} --> "-1"
+% \huaz@\romantoarabic{} --> "0"
+%
+%=================================================
+
+\ExplSyntaxOn
+\NewExpandableDocumentCommand{\huaz@romantoarabic}{m}
+ {
+ \int_from_roman:f { #1 }
+ }
+\cs_generate_variant:Nn \int_from_roman:n { f }
+\ExplSyntaxOff
+
+%=================================================
+%
+% \huaz@try@roman{<...>}
+% Collect the characters i,v,x,l,c,d,m,I,V,X,L,C,D,M from the beginning of <...>.
+% This string is saved into \huaz@try@roman@result.
+% If this string is empty, then \huaz@try@roman@result is <...>. E.g.
+% \huaz@try@roman{XIV.6}\huaz@try@roman@result --> "XIV"
+% \huaz@try@roman{xiii.x}\huaz@try@roman@result --> "xiii"
+% \huaz@try@roman{d.xiii}\huaz@try@roman@result --> "d"
+% \huaz@try@roman{a.xiii}\huaz@try@roman@result --> "a.xiii"
+% \huaz@try@roman{XIii}\huaz@try@roman@result --> "XIii"
+% \huaz@try@roman{aXIIII}\huaz@try@roman@result --> "aXIIII"
+%
+%=================================================
+
+\NewDocumentCommand{\huaz@try@roman}{m}{%
+ \begingroup%
+ \exploregroups%
+ \UseHook{huaz}%
+ \StrLen{#1}[\huaz@temp]%
+ \setcounter{huaz@temp@count}{\huaz@temp}%
+ \setcounter{huaz@temp@count@}{1}%
+ \gdef\huaz@try@roman@result{}%
+ \loop%
+ \huaz@temp@if@false%
+ \StrChar{#1}{\thehuaz@temp@count@}[\huaz@temp]%
+ \IfSubStr{ivxlcdmIVXLCDM}{\huaz@temp}{%
+ \expandafter\g@addto@macro\expandafter\huaz@try@roman@result\expandafter{\huaz@temp}}
+ {\setcounter{huaz@temp@count@}{\value{huaz@temp@count}}}%
+ \ifnum\value{huaz@temp@count@}<\value{huaz@temp@count}\stepcounter{huaz@temp@count@}%
+ \repeat%
+ \ifx\huaz@try@roman@result\@empty\gdef\huaz@try@roman@result{#1}\fi%
+ \endgroup}
+
+%=================================================
+%
+% \aznotshow
+%
+%=================================================
+
+\def\aznotshow{\huaz@show@false}
+
+%=================================================
+%
+% \huaz@text
+%
+%=================================================
+
+\NewDocumentCommand{\huaz@text}{st{=}m}{%
+ \huaz@try@roman{#3}%
+ \def\huaz@tempa{-1}%
+ \edef\huaz@tempb{\huaz@romantoarabic{\huaz@try@roman@result}}%
+ \IfBooleanTF{#2}{\huaz@z{#3}}{%
+ \ifx\huaz@tempb\huaz@tempa%
+ \huaz@z{#3}%
+ \else%
+ \huaz@z{\huaz@romantoarabic{\huaz@try@roman@result}}%
+ \fi}%
+ \IfBooleanF{#1}{\ifhuaz@show@~#3\fi}%
+ \huaz@show@true}
+
+%=================================================
+%
+% \az \Az \azv \Azv \azsaved
+%
+%=================================================
+
+\DeclareDocumentCommand{\az}{sm}{\ifhuaz@show@ a\fi\IfBooleanTF{#1}{\huaz@text*{#2}}{\huaz@text{#2}}\xdef\azsaved{a\huaz@save}}
+\DeclareDocumentCommand{\Az}{sm}{\ifhuaz@show@ A\fi\IfBooleanTF{#1}{\huaz@text*{#2}}{\huaz@text{#2}}\xdef\azsaved{A\huaz@save}}
+\DeclareDocumentCommand{\azv}{sm}{\ifhuaz@show@ a\fi\IfBooleanTF{#1}{\huaz@text*={#2}}{\huaz@text={#2}}\xdef\azsaved{a\huaz@save}}
+\DeclareDocumentCommand{\Azv}{sm}{\ifhuaz@show@ A\fi\IfBooleanTF{#1}{\huaz@text*={#2}}{\huaz@text={#2}}\xdef\azsaved{A\huaz@save}}
+
+%=================================================
+%
+% \aref \Aref \avref \Avref
+%
+%=================================================
+
+\DeclareDocumentCommand{\aref}{sm}{\IfBooleanTF{#1}{\az*{\ref{#2}}}{\az{\ref{#2}}}}
+\DeclareDocumentCommand{\Aref}{sm}{\IfBooleanTF{#1}{\Az*{\ref{#2}}}{\Az{\ref{#2}}}}
+\DeclareDocumentCommand{\avref}{sm}{\IfBooleanTF{#1}{\azv*{\ref{#2}}}{\azv{\ref{#2}}}}
+\DeclareDocumentCommand{\Avref}{sm}{\IfBooleanTF{#1}{\Azv*{\ref{#2}}}{\Azv{\ref{#2}}}}
+
+%=================================================
+%
+% \apageref \Apageref \avpageref \Avpageref
+%
+%=================================================
+
+\DeclareDocumentCommand{\apageref}{sm}{\IfBooleanTF{#1}{\az*{\pageref{#2}}}{\az{\pageref{#2}}}}
+\DeclareDocumentCommand{\Apageref}{sm}{\IfBooleanTF{#1}{\Az*{\pageref{#2}}}{\Az{\pageref{#2}}}}
+\DeclareDocumentCommand{\avpageref}{sm}{\IfBooleanTF{#1}{\azv*{\pageref{#2}}}{\azv{\pageref{#2}}}}
+\DeclareDocumentCommand{\Avpageref}{sm}{\IfBooleanTF{#1}{\Azv*{\pageref{#2}}}{\Azv{\pageref{#2}}}}
+
+%=================================================
+%
+% \aeqref \Aeqref \aveqref \Aveqref
+%
+%=================================================
+
+\DeclareDocumentCommand{\aeqref}{sm}{\IfBooleanTF{#1}{\az*{\eqref{#2}}}{\az{\eqref{#2}}}}
+\DeclareDocumentCommand{\Aeqref}{sm}{\IfBooleanTF{#1}{\Az*{\eqref{#2}}}{\Az{\eqref{#2}}}}
+\DeclareDocumentCommand{\aveqref}{sm}{\IfBooleanTF{#1}{\azv*{\eqref{#2}}}{\azv{\eqref{#2}}}}
+\DeclareDocumentCommand{\Aveqref}{sm}{\IfBooleanTF{#1}{\Azv*{\eqref{#2}}}{\Azv{\eqref{#2}}}}
+
+%=================================================
+%
+% \acite \Acite \avcite \Avcite
+%
+%=================================================
+
+\DeclareDocumentCommand{\acite}{som}{%
+ \IfBooleanTF{#1}{%
+ \IfNoValueTF{#2}{%
+ \az*{\cite{#3}}%
+ }{%
+ \az*{\cite[#2]{#3}}%
+ }%
+ }{%
+ \IfNoValueTF{#2}{%
+ \az{\cite{#3}}%
+ }{%
+ \az{\cite[#2]{#3}}%
+ }%
+ }}
+
+\DeclareDocumentCommand{\Acite}{som}{%
+ \IfBooleanTF{#1}{%
+ \IfNoValueTF{#2}{%
+ \Az*{\cite{#3}}%
+ }{%
+ \Az*{\cite[#2]{#3}}%
+ }%
+ }{%
+ \IfNoValueTF{#2}{%
+ \Az{\cite{#3}}%
+ }{%
+ \Az{\cite[#2]{#3}}%
+ }%
+ }}
+
+\DeclareDocumentCommand{\avcite}{som}{%
+ \IfBooleanTF{#1}{%
+ \IfNoValueTF{#2}{%
+ \azv*{\cite{#3}}%
+ }{%
+ \azv*{\cite[#2]{#3}}%
+ }%
+ }{%
+ \IfNoValueTF{#2}{%
+ \azv{\cite{#3}}%
+ }{%
+ \azv{\cite[#2]{#3}}%
+ }%
+ }}
+
+\DeclareDocumentCommand{\Avcite}{som}{%
+ \IfBooleanTF{#1}{%
+ \IfNoValueTF{#2}{%
+ \Azv*{\cite{#3}}%
+ }{%
+ \Azv*{\cite[#2]{#3}}%
+ }%
+ }{%
+ \IfNoValueTF{#2}{%
+ \Azv{\cite{#3}}%
+ }{%
+ \Azv{\cite[#2]{#3}}%
+ }%
+ }}
+
+%=================================================
+%
+% \huaz@cite
+%
+%=================================================
+
+\def\huaz@x@#1#{\huaz@citelist}
+\def\huaz@cite{\huaz@x@\relax}
+\def\huaz@citelist#1{\huaz@@citelist#1,\relax,}
+\def\huaz@@citelist#1,{\ifx#1\relax\else\@nameuse{huaz@bib@#1},\expandafter\huaz@@citelist\fi}%
+
+\AddToHook{begindocument/before}{
+ %
+ \def\huaz@bibparam{}
+ %
+ \@ifpackageloaded{natbib}{
+ \ifNAT@numbers\def\huaz@bibparam#1#2#3{#1}\else\def\huaz@bibparam#1#2#3{#3}\fi}{}
+ %
+ \@ifpackageloaded{babel}{
+ \let\huaz@old@bbl@bibcite\bbl@bibcite
+ \def\bbl@bibcite#1#2{\global\@namedef{huaz@bib@#1}{\huaz@bibparam#2}\huaz@old@bbl@bibcite{#1}{#2}}}{}
+ %
+ \@ifpackageloaded{hyperref}{
+ \let\huaz@old@Hy@bibcite\Hy@bibcite
+ \def\Hy@bibcite#1#2{\global\@namedef{huaz@bib@#1}{\huaz@bibparam#2}\huaz@old@Hy@bibcite{#1}{#2}}}{}
+ %
+ \let\huaz@old@bibcite\bibcite
+ \def\bibcite#1#2{\global\@namedef{huaz@bib@#1}{\huaz@bibparam#2}\huaz@old@bibcite{#1}{#2}}
+ %
+ \@ifpackageloaded{biblatex}{
+ \def\huaz@biblatexlabel{}
+ \ifx\blx@opt@eldt@style\@empty\ifx\blx@opt@eldt@citestyle\@empty\def\huaz@biblatexlabel{\strfield{labelnumber}}\fi\fi
+ \def\huaz@temp{numeric}
+ \ifx\blx@opt@eldt@style\huaz@temp\def\huaz@biblatexlabel{\csfield{labelnumber}}\fi
+ \ifx\blx@opt@eldt@citestyle\huaz@temp\def\huaz@biblatexlabel{\csfield{labelnumber}}\fi
+ \def\huaz@temp{numeric-verb}
+ \ifx\blx@opt@eldt@style\huaz@temp\def\huaz@biblatexlabel{\csfield{labelnumber}}\fi
+ \ifx\blx@opt@eldt@citestyle\huaz@temp\def\huaz@biblatexlabel{\csfield{labelnumber}}\fi
+ \def\huaz@temp{alphabetic}
+ \ifx\blx@opt@eldt@style\huaz@temp\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \ifx\blx@opt@eldt@citestyle\huaz@temp\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \def\huaz@temp{alphabetic-verb}
+ \ifx\blx@opt@eldt@style\huaz@temp\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \ifx\blx@opt@eldt@citestyle\huaz@temp\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \def\huaz@temp{authoryear}
+ \ifx\blx@opt@eldt@style\huaz@temp\settoggle{blx@labelalpha}{true}\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \ifx\blx@opt@eldt@citestyle\huaz@temp\settoggle{blx@labelalpha}{true}\def\huaz@biblatexlabel{\strfield{labelalpha}}\fi
+ \ifx\huaz@biblatexlabel\@empty\else
+ \AtEveryBibitem{\protected@write\@auxout{}{\string\global\string\@namedef{huaz@bib@\strfield{entrykey}}{\huaz@biblatexlabel}}}
+ \fi}{}}
+
+%=================================================
+%
+% end
+%
+%=================================================
+
+\endinput \ No newline at end of file