diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html')
-rw-r--r-- | Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html index 495b7e0b6da..41ea39fc4c6 100644 --- a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html +++ b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-patch.html @@ -47,30 +47,51 @@ This technique is obviously somewhat laborious, but if the original command comes from a source that’s liable to change under the control of someone else, it does at least warn you that your patch is in danger of going wrong. -<p/>Otherwise, LaTeX users may use one of the <i>patch</i> or -<i>patchcmd</i> systems. -<p/><i>Patch</i> gives you an ingenious (and difficult to understand) -mechanism, and comes as an old-style LaTeX documented macro file. -Sadly the old-style <i>doc</i> macros are no longer available, but -the file (<i>patch.doc</i>) may be input directly, and the -documentation may be read (un-typeset). Roughly speaking, one gives -the command a set of instructions analagous to <i>sed</i> -substitutions, and it regenerates the command thus amended. The -author of this FAQ has (slightly reluctantly) given up using -<i>patch</i>... +<p/>Otherwise, LaTeX users may use one of the <i>patchcmd</i>, +<i>ted</i> or <i>etoolbox</i> packages. <p/>The <i>patchcmd</i> package addresses a slightly simpler task, by restricting the set of commands that you may patch; you mayn’t patch any command that has an optional argument, though it does deal with the case of commands defined with <code>\</code><code>DeclareRobustCommand</code>. The package defines a <code>\</code><code>patchcommand</code> command, that takes three arguments: the command to patch, stuff to stick at the front of its -definition, and stuff to stick on the end of its definition. So, if -<code>\</code><code>b</code> contains “<code>b</code>”, then -<code>\</code><code>patchcommand</code><code>\</code><code>b{a}{c}</code> -will produce a new version of <code>\</code><code>b</code> that contains “<code>abc</code>”. +definition, and stuff to stick on the end of its definition. So, +after +<blockquote> +<pre> +\def\b{b} +\patchcmd\b{a}{c} +</pre> +</blockquote><p> +we will have a new version of <code>\</code><code>b</code> defined as “<code>abc</code>”. +<p/>The <i>ted</i> package is a ‘token list editor’, and provides a +command <code>\</code><code>Substitute*</code> which will patch the contents of a macro, +putting the result in a token-list, or (optionally) using the result +to (re)define a macro. The package may also be used as a powerful +debugging tool. +<p/>The <i>etoolbox</i> (which provides user access to e-TeX’s +programming facilities) provides a command <code>\</code><code>patchcmd</code> which will +perform a “string substitution” in a macro’s definition. The +package also provides commands that prepend (<code>\</code><code>pretocmd</code>) or append +(<code>\</code><code>apptocmd</code>) to the definition of a command. +<p/>Finally, we’ll briefly consider a package that is (just about) +usable, but not really recommendable. <i>Patch</i> gives you an +ingenious (and difficult to understand) mechanism, and comes as an +old-style LaTeX documented macro file, which can no longer be +processed (as in + + <a href="FAQ-install-doc.html">generating documentation for a new package</a>). +Fortunately, the file (<i>patch.doc</i>) may be input directly, and +“documentation” may found by reading the source of the package. +Roughly speaking, one gives the command a set of instructions +analogous to <i>sed</i> substitutions, and it regenerates the +command thus amended. Unless you can’t do your job any other way, you +had probably best avoid <i>Patch</i>. <dl> +<dt><tt><i>etoolbox.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/etoolbox.zip">macros/latex/contrib/etoolbox</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/etoolbox.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/etoolbox/">browse</a>) <dt><tt><i>patch.doc</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/generic/misc/patch.doc">macros/generic/misc/patch.doc</a> <dt><tt><i>patchcommand.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/patchcmd.zip">macros/latex/contrib/patchcmd</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/patchcmd.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/patchcmd/">browse</a>) +<dt><tt><i>ted.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/ted.zip">macros/latex/contrib/ted</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/ted.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/ted/">browse</a>) </dl> <p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=patch">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=patch</a> </body> |