summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-20 20:40:11 +0000
committerKarl Berry <karl@freefriends.org>2020-06-20 20:40:11 +0000
commit542262014b6cc6afc0abc938c970167885bd6f13 (patch)
treee6ee181a15f03b58c89429840cff3326e8671595 /Master/texmf-dist/doc/generic
parent52754e17bbd32c1dc6bd13621df8bc3149abe864 (diff)
namedef (20jun20)
git-svn-id: svn://tug.org/texlive/trunk@55606 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic')
-rw-r--r--Master/texmf-dist/doc/generic/namedef/DEPENDS.txt1
-rw-r--r--Master/texmf-dist/doc/generic/namedef/README.md73
-rw-r--r--Master/texmf-dist/doc/generic/namedef/namedef.pdfbin0 -> 633001 bytes
3 files changed, 74 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/namedef/DEPENDS.txt b/Master/texmf-dist/doc/generic/namedef/DEPENDS.txt
new file mode 100644
index 00000000000..574e1c1ca4b
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/namedef/DEPENDS.txt
@@ -0,0 +1 @@
+hard l3kernel
diff --git a/Master/texmf-dist/doc/generic/namedef/README.md b/Master/texmf-dist/doc/generic/namedef/README.md
new file mode 100644
index 00000000000..5cf05c4abc2
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/namedef/README.md
@@ -0,0 +1,73 @@
+# namedef
+Named parameters in TeX definitions
+
+This package allows you to use names rather than numbers in TeX
+definitions. Usually a definition would look like:
+```tex
+\def\SayHello#1%
+ {Hello, #1!}
+```
+which is usually good enough. However sometimes when writing macros the
+programmer (I, at least) has a macro with several arguments, and then
+adding another argument before `#1` requires changing all the numbers
+in the definition:
+```tex
+\def\Say#1#2%
+ {#1, #2!}
+```
+which again, is usually fine most of the time. But sometimes the
+definition is rather long, and has a handful of arguments, so changing
+the order requires the programmer to change a lot of `#1` to `#2` in the
+code, which is tedious, at best.
+
+With `namedef` you can prefix your definition with `\named`, then every
+parameter should be given a name:
+```tex
+\named\def\SayHello#[subject]%
+ {Hello, #[subject]!}
+```
+then adding another argument before the existing ones is trivial:
+```tex
+\named\def\Say#[greeting]#[subject]%
+ {#[greeting], #[subject]!}
+```
+and to change the order of the arguments you just swap `#[greeting]` and
+`#[subject]` in the <code>&langle;parameter text&rangle;</code>. No
+other changes required!
+
+Note that this can be (ab)used for writing macros, but it should
+probably be removed for publishing the code.
+
+---
+
+This repository contains the source code `namedef.dtx` and the
+installation file `namedef.ins`. To create the package file
+`namedef.sty`, run:
+```
+tex namedef.ins
+```
+and to produce the documentation, run:
+```
+pdflatex namedef.ins
+```
+
+---
+
+Copyright (C) 2019--2020 Phelype Oleinik
+
+This work may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work is "maintained" (as per the LPPL maintenance status)
+by Phelype Oleinik.
+
+Please send bug reports or feature requests at the project repository:
+https://github.com/PhelypeOleinik/namedef
+or by e-mail (contact info in the source file).
diff --git a/Master/texmf-dist/doc/generic/namedef/namedef.pdf b/Master/texmf-dist/doc/generic/namedef/namedef.pdf
new file mode 100644
index 00000000000..ae32bff6acd
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/namedef/namedef.pdf
Binary files differ