%% %% `huaz.sty' %% %% Automatic Hungarian definite articles %% %% Copyright 2022-2024 by Tibor Tómács %% %% 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 Tómács. %% \NeedsTeXFormat{LaTeX2e}[2021/10/10] \ProvidesPackage{huaz}[2024/04/28 v2.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}{% % % Accent commands will be considered as one syntax unit \let\"\relax\let\'\relax\let\`\relax\let\~\relax\let\^\relax\let\=\relax\let\.\relax% \let\b\relax\let\B\relax\let\c\relax\let\d\relax\let\H\relax\let\k\relax\let\r\relax\let\u\relax\let\v\relax% % % Change letter commands \def\AA{a}\def\aa{a}\def\AE{a}\def\ae{a}\def\IJ{ij}\def\ij{ij}% \def\l{l}\def\NG{N}\def\ng{n}\def\O{o}\def\o{o}\def\OE{oe}\def\oe{oe}% \def\SS{s}\def\ss{s}\def\TH{th}\def\th{th}% \def\DJ{dj}\def\dj{dj}\def\DH{dh}\def\dh{dh}% % % Change sign commands to period \def\&{.}\def\#{.}\def\%{.}\def\_{.}% % % Ignore commands \def\usefont#1#2#3#4{}% \def\fontsize#1#2{}% \def\fontencoding#1{}% \def\fontfamily#1{}% \def\fontseries#1{}% \def\fontshape#1{}% \def\selectfont{}% \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#1#{\@gobble}% \textcolor[...]{...}{text} and \textcolor{...}{text} --> text \def\color#1#{\@gobble}% \color[...]{...}text and \color{...}text --> text \def\mbox{}\def\fbox{}% \def\makebox#1#{}% \makebox{text} and \makebox[opt]{text} --> text \def\framebox#1#{}% \framebox{text} and \framebox[opt]{text} --> text \def\textqq{}% \def\enquote#1#{}% \enquote{text} and \enquote*{text} --> text \def\told{}% % % Expandable cross-references commands \def\ref#1#{\getrefnumber}% \ref{...} and \ref*{...} --> \getrefnumber{...} \def\pageref#1#{\getpagerefnumber}% \pageref{...} and \pageref*{...} --> \getpagerefnumber{...} \def\eqref#1#{\getrefnumber}% \eqref{...} (amsmath) and \eqref*{...} (!!) --> \getrefnumber{...} \def\refeq#1#{\getrefnumber}% \refeq{...} (mathtools) and \refeq*{...} (!!) --> \getrefnumber{...} \def\cite{\huaz@cite}% } %================================================= % % \huazignorecmd[option]{\command} % option: 0,1,...,9 % % \huazignorecmd{\foo} = \AddToHook{huaz}{\def\foo{}} % ignored: \foo % for example: \huazignorecmd{\rmfamily} % \rmfamily text --> text % % \huazignorecmd[0]{\foo} = \AddToHook{huaz}{\def\foo#1#{}} % ignored: \foo, \foo*, \foo[...], \foo*[...] % for example: \huazignorecmd{\textrm} % \textrm{text} --> text % \huazignorecmd{\makebox} % \makebox[5cm]{text} --> text % % \huazignorecmd[1]{\foo} = \AddToHook{huaz}{\def\foo#1#{\@gobble}} % ignored: \foo{...}, \foo[...]{...}, \foo*[...]{...} % for example: \huazignorecmd{\textcolor} % \textcolor[RGB]{0,255,0}{text} --> text % % \huazignorecmd[2]{\foo} = \AddToHook{huaz}{\def\foo#1#{\huaz@gobble@ii}} % ignored: \foo{...}{...}, \foo[...]{...}{...}, \foo*[...]{...}{...} % for example: \huazignorecmd{\fontsize} % \fontsize{12pt}{12pt}text --> text % %================================================= \newcommand{\huaz@gobble@ii}[2]{} \newcommand{\huaz@gobble@iii}[3]{} \newcommand{\huaz@gobble@iv}[4]{} \newcommand{\huaz@gobble@v}[5]{} \newcommand{\huaz@gobble@vi}[6]{} \newcommand{\huaz@gobble@vii}[7]{} \newcommand{\huaz@gobble@viii}[8]{} \newcommand{\huaz@gobble@ix}[9]{} \def\huaz@check@opt#1{% \def\huaz@opt{#1}% \huaz@temp@if@false% \@for\huaz@list:={,0,1,2,3,4,5,6,7,8,9,10}% \do{\IfStrEq{\huaz@opt}{\huaz@list}{\huaz@temp@if@true}{}}% \IfStrEq{\huaz@opt}{}{\def\huaz@opt{10}}{}% \ifhuaz@temp@if@\else \def\huaz@opt{10}% \PackageWarning{huaz}{Valid options for \string\huazignorecmd: 0,1,...,9. The '[#1]' has been removed.}\fi} \NewDocumentCommand{\huazignorecmd}{>{\TrimSpaces}O{10}m}{% \huaz@check@opt{#1}% \ifcase\huaz@opt% \AddToHook{huaz}{\def#2##1##{}}\or \AddToHook{huaz}{\def#2##1##{\@gobble}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@ii}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@iii}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@iv}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@v}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@vi}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@vii}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@viii}}\or \AddToHook{huaz}{\def#2##1##{\huaz@gobble@ix}}\or \AddToHook{huaz}{\def#2{}}\fi} %================================================= % % \huazrefcmd{\foo} = \AddToHook{huaz}{\def\foo#1#{\getrefnumber}} % --> \foo{...}, \foo[...]{...}, \foo*[...]{...} --> \getrefnumber{...} % % \huazpagerefcmd{\foo} = \AddToHook{huaz}{\def\foo#1#{\getpagerefnumber}} % --> \foo{...}, \foo[...]{...}, \foo*[...]{...} --> \getpagerefnumber{...} % % \huazdefcmd{...} = \AddToHook{huaz}{...} %================================================= \NewDocumentCommand{\huazrefcmd}{m}{\AddToHook{huaz}{\def#1##1##{\getrefnumber}}} \NewDocumentCommand{\huazpagerefcmd}{m}{\AddToHook{huaz}{\def#1##1##{\getpagerefnumber}}} \NewDocumentCommand{\huazdefcmd}{m}{\AddToHook{huaz}{#1}} %================================================= % % \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 e,u,i,o,a,E,U,I,O,A,5 \StrChar{#1}{1}[\huaz@temp]% \@for\huaz@list:={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:={\",\',\`,\~,\^,\=,\.,\b,\B,\c,\d,\H,\k,\r,\u,\v}% \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@temp@if@true}{}}% \ifhuaz@temp@if@% \StrChar{#1}{2}[\huaz@temp]% \@for\huaz@list:={e,u,i,o,a,E,U,I,O,A}% \do{\IfStrEq{\huaz@temp}{\huaz@list}{\huaz@must@z@true}{}}% \fi% \fi% % % 1. character in \huaz@list@A \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,s,r,x,y,F,L,M,N,S,R,X,Y,\huaz@list@X 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,s,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,s,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:={\",\',\`,\~,\^,\=,\.,\b,\B,\c,\d,\H,\k,\r,\u,\v}% \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,\huaz@list@X 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@collect@roman{<...>} % Collecting the characters i,v,x,l,c,d,m,I,V,X,L,C,D,M from the beginning of <...> % "XIII" --> result string is "XIII" % "xiii.x" --> result string is "xiii" % "x ii.x" --> result string is "x" % "VB" --> result string is "V" % "XIV6" --> result string is "XIV" % "aXIII" --> result string is "" % If the result string = <...>, then \huaz@collect@roman@result := result string % \huaz@collect@roman{XIII}\huaz@collect@roman@result --> "XIII" % If the result string is not empty and the first character after it is a punctuation mark or space in <...> , then \huaz@collect@roman@result := result string % \huaz@collect@roman{xiii.x}\huaz@collect@roman@result --> "xiii" % \huaz@collect@roman{x ii.x}\huaz@collect@roman@result --> "x" % If the result string is not empty and the first character after it is a letter or digit in <...> , then \huaz@collect@roman@result := "" % \huaz@collect@roman{VB}\huaz@collect@roman@result --> "" % \huaz@collect@roman{XIV6}\huaz@collect@roman@result --> "" % If the result string is empty then \huaz@collect@roman@result := "" % \huaz@collect@roman{aXIII}\huaz@collect@roman@result --> "" % %================================================= \NewDocumentCommand{\huaz@collect@roman}{m}{% \begingroup% \exploregroups% \UseHook{huaz}% \StrLen{#1}[\huaz@temp]% \setcounter{huaz@temp@count}{\huaz@temp}% \setcounter{huaz@temp@count@}{1}% \gdef\huaz@collect@roman@result{}% \loop% \StrChar{#1}{\thehuaz@temp@count@}[\huaz@temp]% \IfSubStr{ivxlcdmIVXLCDM}{\huaz@temp} {\expandafter\g@addto@macro\expandafter\huaz@collect@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% \IfStrEq{\huaz@collect@roman@result}{}{}{% \huaz@temp@if@false% \StrBehind{#1}{\huaz@collect@roman@result}[\huaz@tempa]% \StrChar{\huaz@tempa}{1}[\huaz@tempb]% \@for\huaz@list:={;,`,',",+,!,/,=,(,),<,>,@,.,?,:,-,*,{,},{ },{},\unskip,\kern}% \kern, \unskip for active characters \do{\IfStrEq{\huaz@tempb}{\huaz@list}{\huaz@temp@if@true}{}}% \ifhuaz@temp@if@\else\gdef\huaz@collect@roman@result{}\fi}% \endgroup} %================================================= % % \aznotshow % %================================================= \def\aznotshow{\huaz@show@false} %================================================= % % \azseparator % %================================================= \def\azseparator#1{\def\huaz@sep{#1}} \def\huaz@sep{~} %================================================= % % \huaz@text % %================================================= \NewDocumentCommand{\huaz@text}{st{=}m}{% \huaz@collect@roman{#3}% \huaz@temp@if@true% \edef\huaz@temp{\huaz@romantoarabic{\huaz@collect@roman@result}}% \IfStrEq{\huaz@temp}{0}{\huaz@temp@if@false}{}% \IfStrEq{\huaz@temp}{-1}{\huaz@temp@if@false}{}% \IfBooleanTF{#2}{\huaz@z{#3}}{% \ifhuaz@temp@if@% \huaz@z{\huaz@romantoarabic{\huaz@collect@roman@result}}% \else% \huaz@z{#3}% \fi}% \IfBooleanF{#1}{\ifhuaz@show@\huaz@sep{#3}\fi}% \huaz@show@true} %================================================= % % \az \Az \azv \Azv \azsaved % %================================================= \DeclareDocumentCommand{\az}{s>{\TrimSpaces}m}{% \ifhuaz@show@ a\fi \IfBooleanTF{#1}{\huaz@text*{#2}}{\huaz@text{#2}}% \IfBlankT{#2}{\PackageWarning{huaz}{Argument of \string\az\space is empty}\textup{(?)}}% \xdef\azsaved{a\huaz@save}} \DeclareDocumentCommand{\Az}{s>{\TrimSpaces}m}{% \ifhuaz@show@ A\fi \IfBooleanTF{#1}{\huaz@text*{#2}}{\huaz@text{#2}}% \IfBlankT{#2}{\PackageWarning{huaz}{Argument of \string\Az\space is empty}\textup{(?)}}% \xdef\azsaved{A\huaz@save}} \DeclareDocumentCommand{\azv}{s>{\TrimSpaces}m}{% \ifhuaz@show@ a\fi \IfBooleanTF{#1}{\huaz@text*={#2}}{\huaz@text={#2}}% \IfBlankT{#2}{\PackageWarning{huaz}{Argument of \string\azv\space is empty}\textup{(?)}}% \xdef\azsaved{a\huaz@save}} \DeclareDocumentCommand{\Azv}{s>{\TrimSpaces}m}{% \ifhuaz@show@ A\fi \IfBooleanTF{#1}{\huaz@text*={#2}}{\huaz@text={#2}}% \IfBlankT{#2}{\PackageWarning{huaz}{Argument of \string\Azv\space is empty}\textup{(?)}}% \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}{m}{\az{\eqref{#1}}} \DeclareDocumentCommand{\Aeqref}{m}{\Az{\eqref{#1}}} \DeclareDocumentCommand{\aveqref}{m}{\azv{\eqref{#1}}} \DeclareDocumentCommand{\Aveqref}{m}{\Azv{\eqref{#1}}} %================================================= % % \arefeq \Arefeq \avrefeq \Avrefeq % %================================================= \DeclareDocumentCommand{\arefeq}{m}{\az{\refeq{#1}}} \DeclareDocumentCommand{\Arefeq}{m}{\Az{\refeq{#1}}} \DeclareDocumentCommand{\avrefeq}{m}{\azv{\refeq{#1}}} \DeclareDocumentCommand{\Avrefeq}{m}{\Azv{\refeq{#1}}} %================================================= % % \acite \Acite \avcite \Avcite % %================================================= \DeclareDocumentCommand{\acite}{om}{\IfNoValueTF{#1}{\az{\cite{#2}}}{\az{\cite[#1]{#2}}}} \DeclareDocumentCommand{\Acite}{om}{\IfNoValueTF{#1}{\Az{\cite{#2}}}{\Az{\cite[#1]{#2}}}} \DeclareDocumentCommand{\avcite}{om}{\IfNoValueTF{#1}{\azv{\cite{#2}}}{\azv{\cite[#1]{#2}}}} \DeclareDocumentCommand{\Avcite}{om}{\IfNoValueTF{#1}{\Azv{\cite{#2}}}{\Azv{\cite[#1]{#2}}}} %================================================= % % \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