From f2f8682275de571d4f555c6ab1590f56a63611db Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 19 Nov 2015 22:42:22 +0000 Subject: nevelok (18nov15) git-svn-id: svn://tug.org/texlive/trunk@38899 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/nevelok/nevelok.sty | 156 ++++++++++++++---------- 1 file changed, 94 insertions(+), 62 deletions(-) (limited to 'Master/texmf-dist/tex/latex/nevelok') diff --git a/Master/texmf-dist/tex/latex/nevelok/nevelok.sty b/Master/texmf-dist/tex/latex/nevelok/nevelok.sty index e19f9f6acd2..b6d8f3a3bba 100644 --- a/Master/texmf-dist/tex/latex/nevelok/nevelok.sty +++ b/Master/texmf-dist/tex/latex/nevelok/nevelok.sty @@ -15,94 +15,126 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{nevelok} - [2015/09/10 v1.00 LaTeX package for automatic definite articles for Hungarian] + [2015/11/17 v1.01 LaTeX package for automatic definite articles for Hungarian] \RequirePackage{xstring} %% -\newcommand{\aaz}[1]{% - \z@aaz{#1}{a}{az}{(}{)}% -} +\def\ifUnDefinedCs#1{\expandafter\ifx\csname#1\endcsname\relax}% %% %% -\newcommand{\Aaz}[1]{% - \z@aaz{#1}{A}{Az}{(}{)}% -} +\DeclareRobustCommand{\aaz}[1]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{\ref{#1}}{a}{az}{}{}% + \fi% +}% %% %% +\DeclareRobustCommand{\Aaz}[1]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{#1}{A}{Az}{}{}% + \fi% +}% +%% +%% +\DeclareRobustCommand{\aazx}[3]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{\ref{#1}}{a}{az}{#2}{#3}% + \fi% +}% +%% +%% +\DeclareRobustCommand{\Aazx}[3]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{#1}{A}{Az}{#2}{#3}% + \fi% +}% +%% +%% +\DeclareRobustCommand{\aazt}[1]{% + \z@aaz{#1}{a}{az}{}{}% +}% +%% +%% +\DeclareRobustCommand{\Aazt}[1]{% + \z@aaz{#1}{A}{Az}{}{}% +}% +%% +%% +\newcount\nev@ind% +\newcount\nev@vege% +\newcount\nev@eppme% +\newcount\nev@az% +%% \newcommand{\z@aaz}[5]{% - \def\param{#1}% the first (reference) parameter - \def\kezd{}\relax% the symbols to be put before the output - \def\veg{}\relax% the symbols to be put after the output - \IfBeginWith{\param}{#4}{% if starts with round parantheses, - % we remove it from both sides; - % the parameter changes - \StrPosition{\param}{#5}[\vegz]% - \newcount\ind% - \ind = \vegz% - \advance \ind by -1% - \StrMid{\param}{2}{\ind}[\param]% - \def\kezd{#4}% - \def\veg{#5}% - }{}\relax% - \IfBeginWith{\param}{1}{% if the reference starts with 1, - % special care is required - \StrLen{\param}[\hossz]% - \newcount\ind% - \newcount\vege% - \ind = \hossz% - \vege = 0% + \begingroup% + \IfBeginWith{#1}{1}{% if the reference starts with 1, + % special care is required + \StrLen{#1}[\nev@hossz]% + \nev@ind=\nev@hossz% + \nev@vege=0% \loop% loops while it does not find a digit at the end % (in \ref-s, strangely, an \hbox {} appears at the end; % this loop was actually written to remove these) - \StrChar{\param}{\ind}[\kar]% - \IfSubStr{1234567890}{\kar}{\vege=1}{}\relax% - \ifnum \vege = 0% - \advance \ind by -1% + \StrChar{#1}{\nev@ind}[\nev@kar]% + \IfSubStr{1234567890}{\nev@kar}{\nev@vege=1}{}\relax% + \ifnum\nev@vege=0% + \advance\nev@ind by -1% \repeat% - \StrLeft{\param}{\ind}[\paramuj]% \paramuj will contain the - % ``cleaned'' parameter - \StrPosition[1]{\paramuj}{.}[\elsopontpozicioja]% - \StrLen{\paramuj}[\hossz]% - \newcount\eppme% position of the first dot minus 1 - \eppme = \elsopontpozicioja% - \advance \eppme by -1% - \ifnum \elsopontpozicioja = 0% - \StrLeft{\paramuj}{\hossz}[\prefix]% + \StrLeft{#1}{\nev@ind}[\nev@paramuj]% \paramuj will contain the + % ``cleaned'' parameter + \StrPosition[1]{\nev@paramuj}{.}[\nev@elsopontpozicioja]% + \StrLen{\nev@paramuj}[\nev@hossz]% + \nev@eppme=\nev@elsopontpozicioja% + \advance\nev@eppme by -1% + \ifnum\nev@elsopontpozicioja=0% + \StrLeft{\nev@paramuj}{\nev@hossz}[\nev@prefix]% \else% - \StrLeft{\paramuj}{\eppme}[\prefix]% + \StrLeft{\nev@paramuj}{\nev@eppme}[\nev@prefix]% \fi% - \StrLen{\prefix}[\elsohossz]% - \ifnum \elsohossz = 1% 1 + \StrLen{\nev@prefix}[\nev@elsohossz]% + \ifnum\nev@elsohossz=1% 1 #3% - \else\ifnum \elsohossz = 2% 10 + \else\ifnum\nev@elsohossz=2% 10 #2% - \else\ifnum \elsohossz = 3% 100 + \else\ifnum\nev@elsohossz=3% 100 #2% - \else\ifnum \elsohossz = 4% 1000 + \else\ifnum\nev@elsohossz=4% 1000 #3% \fi\fi\fi\fi% }{% - \StrChar{\param}{1}[\kar]% - \newcount\az% - \az = 0% - \IfSubStr{2346789}{\kar}{% digits that require ``a''; - % this is redundant, but was kept for some reasons - \az = 0% + \StrChar{#1}{1}[\nev@kar]% + \nev@az=0% + \IfSubStr{2346789}{\nev@kar}{% digits that require ``a''; + % this is redundant, but was kept for some reasons + \nev@az=0% }{% - \IfSubStr{5AEIOUFLMNRSaeiouflmnrs}{\kar}{% digits and letters - % that require ``az'' - \az = 1% + \IfSubStr{5AEIOUFLMNRSaeiouflmnrs}{\nev@kar}{% digits and letters + % that require ``az'' + \nev@az=1% }{% - \az = 0% - }\relax% - }\relax% - \ifnum \az = 1% + \nev@az=0% + }% + }% + \ifnum\nev@az=1% #3% \else% #2% \fi% }% - \ \kezd\param\veg% -} + \ #4#1#5% + \endgroup% +}% %% %% %% Copyright (C) 2015 by Zalan Bodo -- cgit v1.2.3