summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/concepts/with.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/concepts/with.sty')
-rw-r--r--Master/texmf-dist/tex/latex/concepts/with.sty103
1 files changed, 103 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/concepts/with.sty b/Master/texmf-dist/tex/latex/concepts/with.sty
new file mode 100644
index 00000000000..4e94ac02516
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/concepts/with.sty
@@ -0,0 +1,103 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%%
+% %
+% Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) %
+% %
+% http://latex-concepts.googlecode.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 `author-maintained'. %
+% %
+% The Current Maintainer of this work is Michiel Helvensteijn. %
+% %
+% This work consists of the file with.sty. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%%
+
+% I will 'officially' release this package at some point in the future. For
+% now I'm just using it to document the concepts package. Still, it's
+% released under LPPL, so use it as you will.
+%
+% -- Michiel Helvensteijn
+
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\ProvidesExplPackage{with}{2012/12/16}{0.0.1}
+ {an inline construct for passing token lists as ##1-type arguments}
+
+\cs_new_eq:NN \qnv \q_no_value
+
+\cs_new:Nn \with:nn {
+ \with:nnnnnnnnn {#1}\qnv\qnv\qnv\qnv\qnv\qnv\qnv{#2}
+}
+
+\cs_new:Nn \with:nnn {
+ \with:nnnnnnnnn {#1}{#2}\qnv\qnv\qnv\qnv\qnv\qnv{#3}
+}
+
+\cs_new:Nn \with:nnnn {
+ \with:nnnnnnnnn {#1}{#2}{#3}\qnv\qnv\qnv\qnv\qnv{#4}
+}
+
+\cs_new:Nn \with:nnnnn {
+ \with:nnnnnnnnn {#1}{#2}{#3}{#4}\qnv\qnv\qnv\qnv{#5}
+}
+
+\cs_new:Nn \with:nnnnnn {
+ \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}\qnv\qnv\qnv{#6}
+}
+
+\cs_new:Nn \with:nnnnnnn {
+ \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}\qnv\qnv{#7}
+}
+
+\cs_new:Nn \with:nnnnnnnn {
+ \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}\qnv{#8}
+}
+
+\cs_new:Nn \with:nnnnnnnnn {
+ \cs_set:Nn \with_aux:nnnnnnnn {#9}
+ \with_aux:nnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}
+}
+
+\cs_generate_variant:Nn \with:nn {xn}
+\cs_generate_variant:Nn \with:nnn {xxn}
+\cs_generate_variant:Nn \with:nnnn {xxxn}
+\cs_generate_variant:Nn \with:nnnnn {xxxxn}
+\cs_generate_variant:Nn \with:nnnnnn {xxxxxn}
+\cs_generate_variant:Nn \with:nnnnnnn {xxxxxxn}
+\cs_generate_variant:Nn \with:nnnnnnnn {xxxxxxxn}
+\cs_generate_variant:Nn \with:nnnnnnnnn {xxxxxxxxn}
+
+\NewDocumentCommand{\With}{+o+o+o+o+o+o+o+o+m}{
+ \IfValueTF{#8}{ \with:xxxxxxxxn{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9} }{
+ \IfValueTF{#7}{ \with:xxxxxxxn {#1}{#2}{#3}{#4}{#5}{#6}{#7} {#9} }{
+ \IfValueTF{#6}{ \with:xxxxxxn {#1}{#2}{#3}{#4}{#5}{#6} {#9} }{
+ \IfValueTF{#5}{ \with:xxxxxn {#1}{#2}{#3}{#4}{#5} {#9} }{
+ \IfValueTF{#4}{ \with:xxxxn {#1}{#2}{#3}{#4} {#9} }{
+ \IfValueTF{#3}{ \with:xxxn {#1}{#2}{#3} {#9} }{
+ \IfValueTF{#2}{ \with:xxn {#1}{#2} {#9} }{
+ \IfValueTF{#1}{ \with:xn {#1} {#9} }
+ {#9}
+ }}}}}}}
+}
+
+\int_new:c{g_with_uniquecsname_count}
+
+\cs_new:Nn \with_uniquecsname:n {
+ \with_uniquecsname:xn {uniquecsname} {#1}
+}
+
+\cs_new:Nn \with_uniquecsname:xn {
+ \int_incr:c {g_with_uniquecsname_count}
+ \with:xn {#1\int_use:c{g_with_uniquecsname_count}} {#2}
+}
+
+\NewDocumentCommand{\WithUniqueCsname}{O{uniquecsname}+m}{
+ \with_uniquecsname:xn {#1} {#2}
+}