diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty | 137 |
1 files changed, 101 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty index 9e434f56877..a4be7114fd9 100644 --- a/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/cnltx/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013-2014 Clemens Niederberger +% Copyright 2013-2015 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -25,8 +25,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\def\cnltx@@date{2014/01/05} -\def\cnltx@@version{v0.10} +\def\cnltx@@date{2015/01/11} +\def\cnltx@@version{v0.12} \def\cnltx@@info{LaTeX tools and documenting facilities (CN)} \ProvidesPackage{cnltx-base}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] \RequirePackage{pgfopts,etoolbox,ltxcmds,pdftexcmds} @@ -115,6 +115,15 @@ \cnltx@create@bundle@message{base}{Info} % -------------------------------------------------------------------------- +% modules +\newrobustcmd*\cnltx@load@module[1]{\RequirePackage{cnltx-\trim@spaces{#1}}} +\newrobustcmd*\cnltx@load@modules[1]{\forcsvlist{\cnltx@load@module}{#1}} + +\newrobustcmd*\cnltx@register@module[1]{% + \DeclareOption{#1}{\AtEndOfPackage{\cnltx@load@module{#1}}}% +} + +% -------------------------------------------------------------------------- % setup command \newrobustcmd\setcnltx[1]{\pgfqkeys{/cnltx}{#1}} @@ -134,6 +143,46 @@ \newcommand*\cnltx@tmpc{} % -------------------------------------------------------------------------- +% catcode stuff: +\DeclareListParser*{\cnltx@map@tokenlist}{} + +\newrobustcmd*\cnltx@save@catcodes[1]{% + \cnltx@map@tokenlist\cnltx@save@catcode{#1}% +} +\newrobustcmd*\cnltx@save@catcode[1]{% + \csedef{cnltx@catcode@#1}{\the\catcode`#1}% +} + +\newrobustcmd*\cnltx@restore@catcodes[1]{% + \cnltx@map@tokenlist\cnltx@restore@catcode{#1}% +} +\newrobustcmd*\cnltx@restore@catcode[1]{% + \catcode`#1=\csname cnltx@catcode@#1\endcsname + \csundef{cnltx@catcode@#1}% +} + +\newrobustcmd*\cnltx@set@catcodes[2]{% + \cnltx@map@tokenlist{\cnltx@set@catcode{#2}}{#1}% +} +\newrobustcmd*\cnltx@set@catcode[2]{% + \catcode`#1=#2\relax +} + +\newrobustcmd*\cnltx@make@letter[1]{\cnltx@set@catcode{#1}{11}} +\newrobustcmd*\cnltx@make@other[1]{\cnltx@set@catcode{#1}{12}} +\newrobustcmd*\cnltx@make@active[1]{\cnltx@set@catcode{#1}{13}} + +% -------------------------------------------------------------------------- +% damit wir beim Definieren der vielen assoziierten Makros nichts +% überschreiben: +\newrobustcmd*\cnltx@robust@cs[1]{% + \expandafter\newrobustcmd\expandafter*\csname#1\endcsname +} +\newrobustcmd*\cnltx@new@cs[1]{% + \expandafter\newcommand\expandafter*\csname#1\endcsname +} + +% -------------------------------------------------------------------------- % who knows what they might be good for -- well, for indexing: \newrobustcmd*\cnltxat{@} \let\cnltxletterat\cnltxat @@ -163,6 +212,15 @@ \fi } +\newcommand*\cnltx@ifcounter[1]{% + \ifboolexpe{ + test {\ifcsdef{c@#1}} and + test {\ifcsdef{cl@#1}} and + test {\ifcsdef{p@#1}} and + test {\ifcsdef{the#1}} + }% +} + \newrobustcmd*\cnltx@ifsym[2]{\@ifnextchar#1{\@firstoftwo{#2}}} \newcommand*\cnltx@ifdash{\cnltx@ifsym{-}} \newcommand*\cnltx@ifbang{\cnltx@ifsym{!}} @@ -176,7 +234,10 @@ % make the test character an (hopefully extremely) unlikely % with % catcode!=14; let's make & a temporary comment char % save both catcodes just in case someone changed the defaults: -\edef\cnltx@tmpa{\catcode`\%=\the\catcode`\% \catcode`\&=\the\catcode`\&} +\edef\cnltx@tmpa{ + \catcode`\noexpand\%=\the\catcode`\% + \catcode`\noexpand\&=\the\catcode`\& +} \catcode`\%=3 \catcode`\&=14 & the test: @@ -370,7 +431,7 @@ \newrobustcmd\cnltx@remove@all[2]{\cnltx@replace@all#1{#2}{}} % -------------------------------------------------------------------------- -% an equivalent of \newcommand that where the macro with the optional argument +% an equivalent of \newcommand where the macro with the optional argument % is expandable. For this to work the newly defined macro /needs/ to eat the % first following token! \def\cnltx@num@to@args#1{% @@ -801,35 +862,39 @@ % -------------------------------------------------------------------------- HISTORY: -2013/09/08 v0.1 - first working version -2013/09/10 v0.2 - added `cnltx-tools' to the bundle - - extended the messaging creation to class messages -2013/09/12 v0.3 - added index style file `cnltx.ist' - - added color `module' - - added \cnltx@remove@once and \cnltx@remove@all - - added long versions of tokenlist manipulation macros -2013/09/14 v0.4 - added \cnltx@fullexpand@afterarg - - new colors `bibentry' and `bibentryfield' -2013/09/20 v0.5 - added colors `expandable' and `unexpandable' - - added \definecolorscheme -2013/09/24 v0.6 - added \cnltx@ifisnum -2013/09/30 v0.7 - added functionality to look for trailing punctuation - - added colors `makeidxkey' and `makeidxstring' - - added counter representation command facilities - - generalized expansion helpers (by copying expl3's - \exp_arg:N<spec> idea) - - \iftest and \nottest -2013/10/21 v0.8 - \cnltx@ifnextchars -2013/11/22 v0.9 - \cnltx@modulo - - scratch variables - - \cnltx@ifshellescape - - \cnltx@greplace@once, \cnltx@greplace@all, - \cnltx@gremove@once, \cnltx@gremove@all - - \cnltx@ifisnum now also returns <false> if the test - argument is `<num>!' -2014/01/05 v0.10 - \expandtwice - - \cnltx@ifstrequal - -TODO: - `color-scheme' Option dokumentieren +2013/09/08 v0.1 - first working version +2013/09/10 v0.2 - added `cnltx-tools' to the bundle + - extended the messaging creation to class messages +2013/09/12 v0.3 - added index style file `cnltx.ist' + - added color `module' + - added \cnltx@remove@once and \cnltx@remove@all + - added long versions of tokenlist manipulation macros +2013/09/14 v0.4 - added \cnltx@fullexpand@afterarg + - new colors `bibentry' and `bibentryfield' +2013/09/20 v0.5 - added colors `expandable' and `unexpandable' + - added \definecolorscheme +2013/09/24 v0.6 - added \cnltx@ifisnum +2013/09/30 v0.7 - added functionality to look for trailing punctuation + - added colors `makeidxkey' and `makeidxstring' + - added counter representation command facilities + - generalized expansion helpers (by copying expl3's + \exp_arg:N<spec> idea) + - \iftest and \nottest +2013/10/21 v0.8 - \cnltx@ifnextchars +2013/11/22 v0.9 - \cnltx@modulo + - scratch variables + - \cnltx@ifshellescape + - \cnltx@greplace@once, \cnltx@greplace@all, + \cnltx@gremove@once, \cnltx@gremove@all + - \cnltx@ifisnum now also returns <false> if the test + argument is `<num>!' +2014/01/05 v0.10 - \expandtwice + - \cnltx@ifstrequal +2014/03/11 v0.11 - \cnltx@save@catcode, \cnltx@save@catcodes, + \cnltx@set@catcode, \cnltx@set@catcodes, + \cnltx@restore@catcode, \cnltx@restore@catcodes + - \cnltx@make@letter, \cnltx@make@other, \cnltx@make@active + - \cnltx@load@module, \cnltx@load@modules +2015/01/11 v0.12 - updating the bundle to CTAN + - more security for \cnltx@ifisnum |