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/doc/latex/nevelok/nevelok.pdf | Bin 188123 -> 210069 bytes Master/texmf-dist/source/latex/nevelok/nevelok.dtx | 252 ++++++++++++++------- Master/texmf-dist/tex/latex/nevelok/nevelok.sty | 156 ++++++++----- 3 files changed, 269 insertions(+), 139 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/nevelok/nevelok.pdf b/Master/texmf-dist/doc/latex/nevelok/nevelok.pdf index 554b5da89ad..0e740b7524d 100644 Binary files a/Master/texmf-dist/doc/latex/nevelok/nevelok.pdf and b/Master/texmf-dist/doc/latex/nevelok/nevelok.pdf differ diff --git a/Master/texmf-dist/source/latex/nevelok/nevelok.dtx b/Master/texmf-dist/source/latex/nevelok/nevelok.dtx index 5f496af8af5..21e13ac0ea4 100644 --- a/Master/texmf-dist/source/latex/nevelok/nevelok.dtx +++ b/Master/texmf-dist/source/latex/nevelok/nevelok.dtx @@ -86,7 +86,7 @@ Running make install installs the files in the local TeX tree. %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{nevelok} %<*package> - [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} %<*driver> @@ -117,6 +117,8 @@ Running make install installs the files in the local TeX tree. %\maketitle % %\changes{v1.00}{2015/09/10}{First public release} +%\changes{v1.01}{2015/11/13}{Added support for referencing in captions (e.g. in figures), added extra commands +% for extended functionality, etc.} % % \begin{abstract} % \LaTeX{} package for automatic definite articles for Hungarian. @@ -126,7 +128,7 @@ Running make install installs the files in the local TeX tree. % % In Hungarian, the definite articles ``a'' and ``az'' are determined by the % pronounciation of the subsequent word. If the first phoneme of the pronounced word -% is a vowel, then the article is ``az'', otherwise ``az'' must be used. +% is a vowel, then the article is ``az'', otherwise ``a'' must be used. % The simple commands help the \LaTeX{} user to automatically adjust the % definite article according to chapter, equation, page, etc. number. % @@ -134,35 +136,77 @@ Running make install installs the files in the local TeX tree. % % \DescribeMacro{\aaz} % \DescribeMacro{\Aaz} -% The \textsf{nevelok} package provides the following commands: \cmd{\aaz}\marg{reference} +% The \textsf{nevelok} package provides the following \emph{main} commands: \cmd{\aaz}\marg{reference} % and \cmd{\Aaz}\marg{reference}, -% where {\em reference} is a reference to a labeled \LaTeX{} object (section, equation, figure, etc.). +% where \emph{reference} is a reference to a label of a \LaTeX{} object, or simply a +% defined label (section, equation, figure, etc.). % The difference stands in letter casing: the \cmd{\aaz} is the lower case command % producing ``a'' and ``az'', while \cmd{\Aaz} is the upper case version, producing % ``A'' and ``Az'' for the beginning of a sentence. % The commands also work if the reference is put in round parantheses. % -% \textsf{Note}: The commands work only with the simple, built-in references -% \cmd{\ref} and \cmd{\pageref}. It does not work with the popular \cmd{\eqref} -% command of \textsf{amsmath} package, but the same effect can be achieved by enclosing the -% reference in round parantheses. +% \DescribeMacro{\aazx} +% \DescribeMacro{\Aazx} +% The \cmd{\aazx}\marg{reference}\marg{s1}\marg{s2} and +% \cmd{\Aazx}\marg{reference}\marg{s1}\marg{s2} commands are the extended versions of the base \cmd{\aaz} +% and \cmd{\Aaz} +% commands, which simply put the reference between the symbols \emph{s1} and \emph{s2}. +% This is useful for example when referencing equations, where the equations' numbers are often put +% in round parantheses. +% +% \DescribeMacro{\aazt} +% \DescribeMacro{\Aazt} +% The \cmd{\aazt}\marg{reference} and \cmd{\Aazt}\marg{reference} commands can be used for +% simple text, i.e. for text representing non-labels. % +% \textsf{Note}: The reference argument---in contrast to v1.00---must be a label, not +% a \cmd{\ref} command. For example: \cmd{\aaz\{eq:some\_equation\}} +% % \textsf{Requirements}: The package requires/uses the \textsf{xstring} package. % +% \section{Limitations} +% \subsection{Using with \textsf{babel}} +% +% The package can be used with \textsf{babel}, however, one cannot use +% \emph{shorthands}. Therefore, one has to load \textsf{babel} with the +% \texttt{safe=none} option: +% +% \cmd{\usepackage[magyar,safe=none]\{babel\}} +% +% \subsection{Other limitations} +% +% The numeric labels are handled correctly by the package if they are lower or equal to +% 9999. Larger numbers are planned to be handled in future versions of the package. +% %\StopEventually{^^A % \PrintChanges %} % % \section{Implementation} % +% \begin{macro}{\ifUnDefinedCs} +% The \cmd{\ifUnDefinedCs} macro checks whether a command is defined, and +% is used to check for undefined labels. It is taken from \cite{Eijkhout92}. +% \begin{macrocode} +%% +\def\ifUnDefinedCs#1{\expandafter\ifx\csname#1\endcsname\relax}% +%% +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\aaz} % The \cmd{\aaz} command outputs ``a'' or ``az'', depending on the argument. % To be used inside the sentence. % \begin{macrocode} %% -\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% +}% %% % \end{macrocode} % \end{macro} @@ -172,9 +216,70 @@ Running make install installs the files in the local TeX tree. % To be used when starting a new sentence. % \begin{macrocode} %% -\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{#1}{A}{Az}{}{}% + \fi% +}% +%% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\aazx} +% The \cmd{\aazx} command is the extended version of \cmd{\aaz} taking 3 parameters: +% the second and third parameters will be put in the output before and after the +% reference. +% \begin{macrocode} +%% +\DeclareRobustCommand{\aazx}[3]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{\ref{#1}}{a}{az}{#2}{#3}% + \fi% +}% +%% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Aazx} +% The equivalent of \cmd{\aazx} for the beginning of a sentence. +% \begin{macrocode} +%% +\DeclareRobustCommand{\Aazx}[3]{% + \ifUnDefinedCs{r@#1}% + \PackageWarning{nevelok}{Reference not (yet) defined!}% + a(z) ??% + \else% + \z@aaz{#1}{A}{Az}{#2}{#3}% + \fi% +}% +%% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\aazt} +% The equivalent of \cmd{\aaz} for simple, non-label text. +% \begin{macrocode} +%% +\DeclareRobustCommand{\aazt}[1]{% + \z@aaz{#1}{a}{az}{}{}% +}% +%% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Aazt} +% The equivalent of \cmd{\aazt} for the beginning of a sentence. +% \begin{macrocode} +%% +\DeclareRobustCommand{\Aazt}[1]{% + \z@aaz{#1}{A}{Az}{}{}% +}% %% % \end{macrocode} % \end{macro} @@ -182,92 +287,85 @@ Running make install installs the files in the local TeX tree. % \begin{macro}{\z@aaz} % The main command of the package, used by the two provided commands: % \cmd{\z@aaz}\marg{reference}\marg{art1}\marg{art2}\marg{sym1}\marg{sym2}. -% The {\em art1} and {\em art2} parameters stand for the definite articles used in case of -% consonants and vowels, respectively. Parameters {\em art1} and {\em art2} are used to -% handle cases when the reference is put between some symbols, e.g. ``('' and ``)''. -% The $4$th parameter is sought for at the beginning of the reference, and if found, -% the substring between the $4$th and $5$th parameter values is analyzed, instead of the whole -% reference. +% The \emph{art1} and \emph{art2} parameters stand for the definite articles used in case of +% consonants and vowels, respectively. Parameters \emph{sym1} and \emph{sym2} are used to +% handle cases when the reference has to be put between some symbols, e.g. ``('' and ``)''. % \begin{macrocode} %% +\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% - \loop% loops while it does not find a digit at the end - % (in \ref-s, strangely, an \hbox {} appears at the end; + \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% +}% %% % \end{macrocode} % \end{macro} % +% \begin{thebibliography}{9} +% \bibitem{Eijkhout92} +% Victor Eijkhout, +% \emph{TeX by Topic. A TeXnician's Reference}, +% Addison-Wesley, Wokingham, England, 1992. +% \end{thebibliography} +% %\Finale \endinput 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