diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-17 22:38:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-17 22:38:28 +0000 |
commit | a319b877e3db590613748f78848498aea73114dc (patch) | |
tree | 92e16fdb11d6d7cfa933ecd1d7d52b94c3306311 /Master/texmf-dist/tex | |
parent | 90e1ba09ab610723f7a2f6105968320efdaadb20 (diff) |
acronym (17nov19)
git-svn-id: svn://tug.org/texlive/trunk@52845 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/acronym/acronym.sty | 202 |
1 files changed, 157 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/acronym/acronym.sty b/Master/texmf-dist/tex/latex/acronym/acronym.sty index 5d6581a77af..c582d6e9b9c 100644 --- a/Master/texmf-dist/tex/latex/acronym/acronym.sty +++ b/Master/texmf-dist/tex/latex/acronym/acronym.sty @@ -40,8 +40,8 @@ %% %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{acronym}[2015/03/21 - v1.41 +\ProvidesPackage{acronym}[2019/11/11 + v1.42 Support for acronyms (Tobias Oetiker)] \RequirePackage{suffix,xstring} \newif\ifAC@footnote @@ -65,6 +65,9 @@ \newif\ifAC@nolist \AC@nolistfalse \DeclareOption{nolist}{\AC@nolisttrue\AC@nohyperlinkstrue} +\newif\ifAC@nolinebreak +\AC@nolinebreakfalse +\DeclareOption{nolinebreak}{\AC@nolinebreaktrue} \ProcessOptions\relax \ifAC@smaller \RequirePackage{relsize} @@ -74,6 +77,11 @@ \fi \newcommand*{\acffont}[1]{#1} \newcommand*{\acfsfont}[1]{#1} +\ifAC@nolinebreak + \def\AC@linebreakpenalty{4} +\else + \def\AC@linebreakpenalty{3} +\fi \def\AC@hyperlink#1#2{#2} \def\AC@hypertarget#1#2{#2} \def\AC@phantomsection{} @@ -115,17 +123,27 @@ }% \def\acs#1{\AChy@call{#1}\AC@acs}% \def\acl#1{\AChy@call{#1}\@acl}% + \def\Acl#1{\AChy@call{#1}\@Acl}% \def\acf#1{\AChy@call{#1}\AChy@acf}% + \def\Acf#1{\AChy@call{#1}\AChy@Acf}% \def\ac#1{\AChy@call{#1}\@ac}% + \def\Ac#1{\AChy@call{#1}\@Ac}% \def\acsp#1{\AChy@call{#1}\@acsp}% \def\aclp#1{\AChy@call{#1}\@aclp}% + \def\Aclp#1{\AChy@call{#1}\@Aclp}% \def\acfp#1{\AChy@call{#1}\AChy@acfp}% + \def\Acfp#1{\AChy@call{#1}\AChy@Acfp}% \def\acp#1{\AChy@call{#1}\@acp}% + \def\Acp#1{\AChy@call{#1}\@Acp}% \def\acfi#1{\AChy@call{#1}\AChy@acf}% + \def\Acfi#1{\AChy@call{#1}\AChy@Acf}% \let\acsu\acs \let\aclu\acl + \let\Aclu\Acl \def\AChy@acf#1{\AC@acl{#1} (\AC@acs{#1})}% + \def\AChy@Acf#1{\AC@Acl{#1} (\AC@acs{#1})}% \def\AChy@acfp#1{\AC@aclp{#1} (\AC@acsp{#1})}% + \def\AChy@Acfp#1{\AC@Aclp{#1} (\AC@acsp{#1})}% }% } \newtoks\AC@clearlist @@ -155,6 +173,11 @@ \global\expandafter\let\csname acused@#1\endcsname\AC@used \global\let\AC@populated\AC@used \fi} +\newcommand{\@firstupper}[1]{% + \StrLeft{#1}{1}[\firstletter]% + \StrGobbleLeft{#1}{1}[\remainder]% + \MakeUppercase\firstletter\remainder% +} \newcommand*\newacro[1]{% \@ifnextchar[{\AC@newacro{#1}}{\AC@newacro{#1}[#1]}} \newcommand\AC@newacro{} @@ -231,8 +254,8 @@ full in text}% \else% \dotfill\pageref{acro:#1}% - \fi\\% - \fi% + \fi% + \fi\\% \fi% \else% \item[\protect\AC@hypertarget{#1}{\aclabelfont{#2}}] #3% @@ -244,7 +267,8 @@ \protected@write\@auxout{}% {\string\newacro{#1}[\string\AC@hyperlink{#1}{#2}]{#3}}% \@esphack - \endgroup} + \endgroup + \ignorespaces} \newcommand*\newacroindefinite[3]{% \expandafter\gdef\csname fn@#1@IS\endcsname{#2}% \expandafter\gdef\csname fn@#1@IL\endcsname{#3}% @@ -311,6 +335,9 @@ \AC@acl{#1}s% \fi } +\newcommand*\AC@Aclp[1]{% + \@firstupper{\AC@aclp{#1}}% +} \newcommand*\AC@acsp[1]{% \ifcsname fn@#1@PS\endcsname \csname fn@#1@PS\endcsname @@ -318,7 +345,6 @@ \AC@acs{#1}s% \fi } - \newif\ifAC@starred \newcommand*\AC@get[3]{% \ifx#1\relax @@ -331,6 +357,9 @@ \mbox{\expandafter\AC@get\csname fn@#1\endcsname\@firstoftwo{#1}}} \newcommand*\AC@acl[1]{% \expandafter\AC@get\csname fn@#1\endcsname\@secondoftwo{#1}} +\newcommand*\AC@Acl[1]{% + \@firstupper{\AC@acl{#1}}% +} \newcommand*{\acs}{\AC@starredfalse\protect\acsa}% \WithSuffix\newcommand\acs*{\AC@starredtrue\protect\acsa}% \newcommand*{\acsa}[1]{% @@ -344,9 +373,14 @@ \ifAC@starred\else\AC@logged{#1}\fi} \newcommand*{\acl}{\AC@starredfalse\protect\@acl}% \WithSuffix\newcommand\acl*{\AC@starredtrue\protect\@acl}% +\newcommand*{\Acl}{\AC@starredfalse\protect\@Acl}% +\WithSuffix\newcommand\Acl*{\AC@starredtrue\protect\@Acl}% \newcommand*{\@acl}[1]{% \AC@acl{#1}% \ifAC@starred\else\AC@logged{#1}\fi} +\newcommand*{\@Acl}[1]{% + \AC@Acl{#1}% + \ifAC@starred\else\AC@logged{#1}\fi} \newcommand*\@verridelabel[1]{% \@bsphack \protected@write\@auxout{}{\string\AC@undonewlabel{#1}}% @@ -425,37 +459,60 @@ }% \newcommand*{\acf}{\AC@starredfalse\protect\acfa}% \WithSuffix\newcommand\acf*{\AC@starredtrue\protect\acfa}% -\newcommand*{\acfa}[1]{% - \texorpdfstring{\protect\@acf{#1}}{\AC@acl{#1} (#1)}} -\newcommand*{\@acf}[1]{% +\newcommand*{\Acf}{\AC@starredfalse\protect\Acfa}% +\WithSuffix\newcommand\Acf*{\AC@starredtrue\protect\Acfa}% +\newcommand*{\acfa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@acf[#1]{#2}}{\AC@acl{#2} (#2)}} +\newcommand*{\Acfa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@Acf[#1]{#2}}{\AC@Acl{#2} (#2)}} +\newcommand*{\@acf}[2][\AC@linebreakpenalty]{% \ifAC@footnote - \acsfont{\AC@acs{#1}}% - \footnote{\AC@placelabel{#1}\AC@acl{#1}{}}% + \acsfont{\AC@acs{#2}}% + \footnote{\AC@placelabel{#2}\AC@acl{#2}{}}% \else \acffont{% - \AC@placelabel{#1}\AC@acl{#1}% - \nolinebreak[3] % - \acfsfont{(\acsfont{\AC@acs{#1}})}% + \AC@placelabel{#2}\AC@acl{#2}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acs{#2}})}% }% \fi - \ifAC@starred\else\AC@logged{#1}\fi} + \ifAC@starred\else\AC@logged{#2}\fi} +\newcommand*{\@Acf}[2][\AC@linebreakpenalty]{% + \ifAC@footnote + \acsfont{\AC@acs{#2}}% + \footnote{\AC@placelabel{#2}\AC@Acl{#2}{}}% + \else + \acffont{% + \AC@placelabel{#2}\AC@Acl{#2}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acs{#2}})}% + }% + \fi + \ifAC@starred\else\AC@logged{#2}\fi} \newcommand*{\ac}{\AC@starredfalse\protect\@ac}% \WithSuffix\newcommand\ac*{\AC@starredtrue\protect\@ac}% -\newcommand{\@ac}[1]{% +\newcommand*{\Ac}{\AC@starredfalse\protect\@Ac}% +\WithSuffix\newcommand\Ac*{\AC@starredtrue\protect\@Ac}% +\newcommand{\@ac}[2][\AC@linebreakpenalty]{% \ifAC@dua - \ifAC@starred\acl*{#1}\else\acl{#1}\fi% + \ifAC@starred\acl*{#2}\else\acl{#2}\fi% \else - \expandafter\ifx\csname AC@#1\endcsname\AC@used% - \ifAC@starred\acs*{#1}\else\acs{#1}\fi% + \expandafter\ifx\csname AC@#2\endcsname\AC@used% + \ifAC@starred\acs*{#2}\else\acs{#2}\fi% \else - \ifAC@starred\acf*{#1}\else\acf{#1}\fi% + \ifAC@starred\acf*[#1]{#2}\else\acf[#1]{#2}\fi% + \fi + \fi} +\newcommand{\@Ac}[2][\AC@linebreakpenalty]{% + \ifAC@dua + \ifAC@starred\Acl*{#2}\else\Acl{#2}\fi% + \else + \expandafter\ifx\csname AC@#2\endcsname\AC@used% + \ifAC@starred\acs*{#2}\else\acs{#2}\fi% + \else + \ifAC@starred\Acf*[#1]{#2}\else\Acf[#1]{#2}\fi% \fi \fi} -\newcommand{\@firstupper}[1]{% - \StrLeft{#1}{1}[\firstletter]% - \StrGobbleLeft{#1}{1}[\remainder]% - \MakeUppercase\firstletter\remainder -} \newcommand*{\iac}{\AC@starredfalse\protect\@iac}% \WithSuffix\newcommand\iac*{\AC@starredtrue\protect\@iac}% \newcommand*{\Iac}{\AC@starredfalse\protect\@Iac}% @@ -475,11 +532,11 @@ a% \fi } -\newcommand*{\@iac}[1]{% - \@iaci{#1} \ifAC@starred\ac*{#1}\else\ac{#1}\fi% +\newcommand*{\@iac}[2][\AC@linebreakpenalty]{% + \@iaci{#2} \ifAC@starred\ac*[#1]{#2}\else\ac[#1]{#2}\fi% } -\newcommand*{\@Iac}[1]{% - \@firstupper{\@iaci{#1}} \ifAC@starred\ac*{#1}\else\ac{#1}\fi% +\newcommand*{\@Iac}[2][\AC@linebreakpenalty]{% + \@firstupper{\@iaci{#2}} \ifAC@starred\ac*[#1]{#2}\else\ac[#1]{#2}\fi% } \newcommand*{\acsp}{\AC@starredfalse\protect\acspa}% \WithSuffix\newcommand\acsp*{\AC@starredtrue\protect\acspa}% @@ -490,41 +547,92 @@ \ifAC@starred\else\AC@logged{#1}\fi} \newcommand*{\aclp}{\AC@starredfalse\protect\@aclp}% \WithSuffix\newcommand\aclp*{\AC@starredtrue\protect\@aclp}% +\newcommand*{\Aclp}{\AC@starredfalse\protect\@Aclp}% +\WithSuffix\newcommand\Aclp*{\AC@starredtrue\protect\@Aclp}% \newcommand*{\@aclp}[1]{% \AC@aclp{#1}% \ifAC@starred\else\AC@logged{#1}\fi} +\newcommand*{\@Aclp}[1]{% + \AC@Aclp{#1}% + \ifAC@starred\else\AC@logged{#1}\fi} \newcommand*{\acfp}{\AC@starredfalse\protect\acfpa}% \WithSuffix\newcommand\acfp*{\AC@starredtrue\protect\acfpa}% -\newcommand*{\acfpa}[1]{% - \texorpdfstring{\protect\@acfp{#1}}{\AC@aclp{#1} (\AC@acsp{#1})}} -\newcommand*{\@acfp}[1]{% +\newcommand*{\Acfp}{\AC@starredfalse\protect\Acfpa}% +\WithSuffix\newcommand\Acfp*{\AC@starredtrue\protect\Acfpa}% +\newcommand*{\acfpa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@acfp[#1]{#2}}{\AC@aclp{#2} (\AC@acsp{#2})}} +\newcommand*{\Acfpa}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@Acfp[#1]{#2}}{\AC@Aclp{#2} (\AC@acsp{#2})}} +\newcommand*{\@acfp}[2][\AC@linebreakpenalty]{% \ifAC@footnote - \acsfont{\AC@acsp{#1}}% - \footnote{\AC@placelabel{#1}\AC@aclp{#1}{}}% + \acsfont{\AC@acsp{#2}}% + \footnote{\AC@placelabel{#2}\AC@aclp{#2}{}}% \else \acffont{% - \AC@placelabel{#1}\AC@aclp{#1}% - \nolinebreak[3] % - \acfsfont{(\acsfont{\AC@acsp{#1}})}% + \AC@placelabel{#2}\AC@aclp{#2}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acsp{#2}})}% }% \fi - \ifAC@starred\else\AC@logged{#1}\fi} + \ifAC@starred\else\AC@logged{#2}\fi} +\newcommand*{\@Acfp}[2][\AC@linebreakpenalty]{% + \ifAC@footnote + \acsfont{\AC@acsp{#2}}% + \footnote{\AC@placelabel{#2}\AC@Aclp{#2}{}}% + \else + \acffont{% + \AC@placelabel{#2}\AC@Aclp{#2}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acsp{#2}})}% + }% + \fi + \ifAC@starred\else\AC@logged{#2}\fi} \newcommand*{\acp}{\AC@starredfalse\protect\@acp}% \WithSuffix\newcommand\acp*{\AC@starredtrue\protect\@acp}% -\newcommand{\@acp}[1]{% +\newcommand*{\Acp}{\AC@starredfalse\protect\@Acp}% +\WithSuffix\newcommand\Acp*{\AC@starredtrue\protect\@Acp}% +\newcommand{\@acp}[2][\AC@linebreakpenalty]{% + \ifAC@dua + \ifAC@starred\aclp*{#2}\else\aclp{#2}\fi% + \else + \expandafter\ifx\csname AC@#2\endcsname\AC@used + \ifAC@starred\acsp*{#2}\else\acsp{#2}\fi% + \else + \ifAC@starred\acfp*[#1]{#2}\else\acfp[#1]{#2}\fi% + \fi + \fi} +\newcommand{\@Acp}[2][\AC@linebreakpenalty]{% \ifAC@dua - \ifAC@starred\aclp*{#1}\else\aclp{#1}\fi% + \ifAC@starred\Aclp*{#2}\else\Aclp{#2}\fi% \else - \expandafter\ifx\csname AC@#1\endcsname\AC@used - \ifAC@starred\acsp*{#1}\else\acsp{#1}\fi% + \expandafter\ifx\csname AC@#2\endcsname\AC@used + \ifAC@starred\acsp*{#2}\else\acsp{#2}\fi% \else - \ifAC@starred\acfp*{#1}\else\acfp{#1}\fi% + \ifAC@starred\Acfp*[#1]{#2}\else\Acfp[#1]{#2}\fi% \fi \fi} \newcommand*{\acfi}{\AC@starredfalse\protect\acfia}% \WithSuffix\newcommand\acfi*{\AC@starredtrue\protect\acfia}% -\newcommand{\acfia}[1]{% - {\itshape \AC@acl{#1} \nolinebreak[3]} (\ifAC@starred\acs*{#1}\else\acs{#1}\fi)} +\newcommand*{\Acfi}{\AC@starredfalse\protect\Acfia}% +\WithSuffix\newcommand\Acfi*{\AC@starredtrue\protect\Acfia}% +\newcommand{\acfia}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@acfi[#1]{#2}}{{\AC@acl{#2}} (#2)}} +\newcommand{\Acfia}[2][\AC@linebreakpenalty]{% + \texorpdfstring{\protect\@Acfi[#1]{#2}}{{\AC@Acl{#2}} (#2)}} +\newcommand*{\@acfi}[2][\AC@linebreakpenalty]{% + \acffont{% + \AC@placelabel{#2}{\itshape\AC@acl{#2}}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acs{#2}})}% + }% + \ifAC@starred\else\AC@logged{#2}\fi} +\newcommand*{\@Acfi}[2][\AC@linebreakpenalty]{% + \acffont{% + \AC@placelabel{#2}{\itshape\AC@Acl{#2}}% + \nolinebreak[#1] % + \acfsfont{(\acsfont{\AC@acs{#2}})}% + }% + \ifAC@starred\else\AC@logged{#2}\fi} \newcommand{\acused}[1]{% \global\expandafter\let\csname AC@#1\endcsname\AC@used% \AC@addtoAC@clearlist{#1}} @@ -534,8 +642,12 @@ \ifAC@starred\acs*{#1}\else\acs{#1}\fi\acused{#1}} \newcommand*{\aclu}{\AC@starredfalse\protect\aclua}% \WithSuffix\newcommand\aclu*{\AC@starredtrue\protect\aclua}% +\newcommand*{\Aclu}{\AC@starredfalse\protect\Aclua}% +\WithSuffix\newcommand\Aclu*{\AC@starredtrue\protect\Aclua}% \newcommand{\aclua}[1]{% \ifAC@starred\acl*{#1}\else\acl{#1}\fi\acused{#1}} +\newcommand{\Aclua}[1]{% + \ifAC@starred\Acl*{#1}\else\Acl{#1}\fi\acused{#1}} \endinput %% %% End of file `acronym.sty'. |