summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty151
1 files changed, 151 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty b/Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty
new file mode 100644
index 00000000000..a9371bc938e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3ctr2e/l3ctr2e.sty
@@ -0,0 +1,151 @@
+%% This is file `l3ctr2e.sty', generated from `l3ctr2e.tex' (key `package').
+%% l3ctr2e LaTeX2e counters in LaTeX3 ways
+%%
+%% Copyright (C) 2012-2013 by Simon Sigurdhsson <sigurdhsson@gmail.com>
+%%
+%% 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 Simon Sigurdhsson.
+%%
+%% This work consists of the file l3ctr2e.tex and the derived file
+%% l3ctr2e.sty.
+
+\RequirePackage{expl3,l3keys2e,xparse}
+\ProvidesExplClass{l3ctr2e}%
+ {2013/05/25}{0.1d}{LaTeX2e counters in LaTeX3 ways}
+\keys_define:nn{l3ctr2e}{
+ replace .bool_set:N = \g__ctr_replace_latexe_bool,
+ replace .default:n = true,
+ replace .initial:n = false
+}
+\ProcessKeysPackageOptions{l3ctr2e}
+\msg_new:nnn{l3ctr2e}{no-counter}{No~counter~`#1'~defined!}
+\prg_new_conditional:Npnn\__ctr_exists:n#1{T}{
+ \int_if_exist:cTF{c@#1}{
+ \prg_return_true:
+ }{
+ \msg_error:nnn{l3ctr2e}{no-counter}{#1}
+ \prg_return_false:
+ }
+}
+\tl_new:N\g__ctr_children__ctr_global_tl
+\cs_new:Npn\__ctr_define:n#1{
+ \int_new:c{c@#1} % actually \newcount, incorrect! FIX!
+ \ctr_gzero:n{#1}
+ \tl_new:c{g__ctr_children_#1_tl}
+ \cs_gset:cpn{cl@#1}{}
+ \cs_gset:cpn{p@#1}{}
+ \cs_gset:cpn{the#1}{\ctr_use_arabic:n{#1}}
+}
+\cs_new:Npn\__ctr_add_child:nn#1#2{
+ \tl_gput_right:cn{g__ctr_children_#1_tl}{{#2}}
+}
+\cs_new:Npn\ctr_new:n#1{
+ \__ctr_define:n{#1}
+ \__ctr_add_child:nn{_ctr_global}{#1}
+}
+\cs_new:Npn\ctr_new:nn#1#2{
+ \__ctr_define:n{#1}
+ \__ctr_add_child:nn{#2}{#1}
+}
+\cs_new:Npn\ctr_gzero:n#1{
+ \__ctr_exists:nT{#1}{\int_gzero:c{c@#1}}
+}
+\cs_new:Npn\ctr_gset:nn#1#2{
+ \__ctr_exists:nT{#1}{\int_gset:cn{c@#1}{#2}}
+}
+\cs_new:Npn\ctr_gadd:nn#1#2{
+ \__ctr_exists:nT{#1}{\int_gadd:cn{c@#1}{#2}}
+}
+\cs_new:Npn\ctr_gincr:n#1{
+ \ctr_gadd:nn{#1}{\c_one}
+ \tl_if_exist:cT{g__ctr_children_#1_tl}{
+ \tl_map_inline:cn{g__ctr_children_#1_tl}{
+ \ctr_gincr:n{##1} % To reset children of the child
+ \ctr_gzero:n{##1}
+ }
+ }
+}
+\cs_new:Npn\ctr_ref_gincr:n#1{
+ \ctr_gincr:n{#1}
+ \cs_set:Npx\@currentlabel{
+ \use:c{p@#1}
+ \use:c{the#1}
+ }
+}
+\cs_new:Npn\ctr_value:n#1{
+ \use:c{c@#1}
+}
+\cs_new:Npn\ctr_use:n#1{
+ \int_use:c{c@#1}
+}
+\cs_new:Npn\ctr_use_arabic:n#1{
+ \int_to_arabic:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_alph:n#1{
+ \int_to_alph:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_Alph:n#1{
+ \int_to_Alph:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_binary:n#1{
+ \int_to_binary:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_hex:n#1{
+ \int_to_hexadecimal:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_octal:n#1{
+ \int_to_octal:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_roman:n#1{
+ \int_to_roman:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_Roman:n#1{
+ \int_to_Roman:n{\ctr_use:n{#1}}
+}
+\cs_new:Npn\ctr_use_fn:n#1{
+ \ensuremath{\ctr_use_custom:nn{#1}{
+ *, \dagger, \ddagger,
+ \mathsection,\mathparagraph,\|,
+ **, \dagger\dagger,\ddagger\ddagger
+ }}
+}
+\cs_new:Npn\ctr_use_custom:nn#1#2{
+ \clist_set:Nn\l_tmpa_clist{#2}
+ \tl_clear:N\l_tmpa_tl
+ \int_zero:N\l_tmpa_int
+ \clist_map_inline:Nn\l_tmpa_clist{
+ \int_incr:N\l_tmpa_int
+ \tl_put_right:Nx\l_tmpa_tl{{\int_use:N\l_tmpa_int}{##1}}
+ }
+ \exp_args:Nnnx\int_to_symbols:nnn{\ctr_use:n{#1}}
+ {\clist_count:N\l_tmpa_clist}
+ {\tl_use:N\l_tmpa_tl}
+}
+\bool_if:NT\g__ctr_replace_latexe_bool{
+ \RenewDocumentCommand\newcounter{mo}{
+ \IfNoValueTF{#2}{\ctr_new:n{#1}}
+ {\ctr_new:nn{#1}{#2}}
+ }
+ \RenewDocumentCommand\stepcounter{m}{\ctr_gincr:n{#1}}
+ \RenewDocumentCommand\refstepcounter{m}{\ctr_ref_gincr:n{#1}}
+ \RenewDocumentCommand\addtocounter{mm}{\ctr_gadd:nn{#1}{#2}}
+ \RenewDocumentCommand\setcounter{mm}{\ctr_gset:nn{#1}{#2}}
+ \RenewDocumentCommand\value{m}{\ctr_value:n{#1}}
+ \RenewDocumentCommand\arabic{m}{\ctr_use_arabic:n{#1}}
+ \RenewDocumentCommand\alph{m}{\ctr_use_alph:n{#1}}
+ \RenewDocumentCommand\Alph{m}{\ctr_use_Alph:n{#1}}
+ \RenewDocumentCommand\roman{m}{\ctr_use_roman:n{#1}}
+ \RenewDocumentCommand\Roman{m}{\ctr_use_Roman:n{#1}}
+ \RenewDocumentCommand\fnsymbol{m}{\ctr_use_fn:n{#1}}
+}
+\endinput
+