summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-26 12:49:44 +0000
committerKarl Berry <karl@freefriends.org>2007-04-26 12:49:44 +0000
commitdfb9b33178be8bb5b274b063abc455e7a5b3812b (patch)
treee5919819ddbca8da60558ced267e64cf39f09c09 /Master/texmf-dist
parent95655675bf9504d648aae03acece9e0ff7b7ed93 (diff)
new tex utility mkpattern (24apr07)
git-svn-id: svn://tug.org/texlive/trunk@4197 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/plain/mkpattern/README14
-rw-r--r--Master/texmf-dist/doc/plain/mkpattern/mkpatdoc.tex352
-rw-r--r--Master/texmf-dist/doc/plain/mkpattern/mkpatter.pdfbin0 -> 49442 bytes
-rw-r--r--Master/texmf-dist/doc/plain/mkpattern/mkpattern-exmpl.tex307
-rw-r--r--Master/texmf-dist/tex/plain/mkpattern/mkpatter.tex590
-rw-r--r--Master/texmf-dist/tpm/mkpattern.tpm28
6 files changed, 1291 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/plain/mkpattern/README b/Master/texmf-dist/doc/plain/mkpattern/README
new file mode 100644
index 00000000000..bb46924e2e7
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/mkpattern/README
@@ -0,0 +1,14 @@
+Mkpatter v. 1.1, 2007/04/23.
+
+Mkpattern is a general purpose program for the generation of hyphenation
+patterns, with definition of letter sets and template-like constructions.
+It also provides an easy way to handle different input and output encodings.
+A detailed description is provided in the manual: mkpatter.dps. Next is
+a brief descriptions of the files related to the program, as well as the
+license under which it is distributed:
+
+mkpatter.tex: The program mkpattern; lppl
+mkpattern-exmpl.tex: An example file; public domain
+mkpatter.pdf: The manual; public domain
+mkpatdoc.tex: The source for the manual; public domain
+
diff --git a/Master/texmf-dist/doc/plain/mkpattern/mkpatdoc.tex b/Master/texmf-dist/doc/plain/mkpattern/mkpatdoc.tex
new file mode 100644
index 00000000000..c7a9ca4bc5b
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/mkpattern/mkpatdoc.tex
@@ -0,0 +1,352 @@
+%This file is in the public domain: You can use, modify and/or distribute it freely.
+\catcode`\á=\active \defá{\'a}
+\catcode`\é=\active \defé{\'e}
+\catcode`\í=\active \defí{\'\i}
+\catcode`\ó=\active \defó{\'o}
+\catcode`\ú=\active \defú{\'u}
+\catcode`\ñ=\active \defñ{\~n}
+\overfullrule=0pt
+\vbadness=600
+
+\font\titlefont=cmr17 at 20.7pt
+\font\sectionfont=cmbx12 at 14pt
+\font\normalfont=cmr12
+\font\ttfont=cmtt12
+\font\syntaxfont=cmti12
+\font\simb=cmsy10 at 12pt
+\font\itfont=cmti12
+\font\ttsmall=cmtt12 at 11pt
+\font\latexA=cmr9
+\hyphenchar\ttfont=-1
+
+\textfont0=\normalfont
+\textfont1=\itfont
+\mathchardef\ldotp="602E
+
+\def\rm{\normalfont}
+\rm\baselineskip=14pt
+\hsize=76ex
+\hoffset=210mm
+\advance\hoffset-\hsize
+\divide\hoffset by 2
+\advance\hoffset-1in
+
+\catcode`@=11
+\catcode`&=12
+%\escapechar=-1
+\def\tt{\ttfont \catcode`/=0 \catcode`\\=12 \catcode`[=1 \catcode`]=2 \catcode`\{=12 \catcode`\}=12 \catcode`\#=12 \frenchspacing}
+
+\def\<{{\simb h}} \def\>{{\simb i}}
+\catcode`\<=\active
+\catcode`\>=\active
+\def<{\<\bgroup\syntaxfont}
+\def>{\/\egroup\>}
+\def\hb{\hfil\break}
+\def\emph{\itfont}
+\def\gobble#1{}
+
+\def\begin#1{\csname #1\endcsname}
+\def\syntax{\par\nobreak\bigskip\bgroup\advance\leftskip\parindent \advance\rightskip\parindent%
+\parindent=0pt \advance\baselineskip1pt \widowpenalty=1000 \clubpenalty=1000 \tt}
+\def\endsyntax{\par\egroup\bigskip}
+
+\def\displayline{\par\nobreak\bigskip\noindent\hbox to\hsize\bgroup\hskip\parindent \tt\catcode`]=13\gobble}
+{\catcode`]=13 \gdef]{\hfil\hskip\parindent\egroup\bigskip}}
+
+{\catcode`/=0 \catcode`/\=12 /gdef/put{{/tt \put}}}
+
+\newtoks\@@everypar \newtoks\@everypar
+\@@everypar\everypar
+\def\noindentnext{\@everypar\everypar
+ \everypar={\everypar\@everypar\hskip-\parindent\widowpenalty=10000 }}
+
+\catcode`\>=12
+\newcount\csection
+\csection=0
+\def\noex{\noexpand\noexpand\noexpand}
+
+\def\section#1{\par\skip0=5ex plus 1ex minus 1ex \ifdim\lastskip>\skip0 \skip0=0pt \else \vskip-\lastskip\fi \penalty-1000\vskip\skip0
+ {\sectionfont\noindent\ifnumber\global\advance\csection 1 \hbox to1.8em{\the\csection.\hss}\fi#1} \let\ifnumber\iftrue
+ \ifindex\edef\tempa{\write\tocfile{\noex\indexsectionline{\the\csection}{#1}{\noexpand\the\count0}}}
+ \tempa
+ \fi
+ \let\ifindex\iftrue
+ \par\nobreak\vskip-\parskip\nobreak\vskip3ex plus 0.5ex minus 0.5ex \noindentnext
+}
+\let\ifindex\iftrue
+\let\ifnumber\iftrue
+\def\noindex{\let\ifindex\iffalse}
+\def\nonumber{\let\ifnumber\iffalse}
+
+\catcode`\>=\active
+
+\def\today{\ifcase\month\or January\or February\or March\or April\or May\or June
+ \or July\or August \or September\or October\or November\or December\fi
+ \ \number\day, \number\year}
+
+\null\vskip50pt
+\centerline{\titlefont The mkpattern program}
+\bigskip
+\centerline{Javier A. M\'ugica de Rivera}
+\medskip
+\centerline{Version\ 1.1, \today}
+\vskip40pt plus 10pt minus 6pt
+
+\def\indexsectionline#1#2#3{\vskip3pt\leavevmode\hbox to1em{\hss#1.\kern0.8em}#2\kern1em #3\par}
+\def\indexsubsectionline#1#2#3{\vskip1pt\leavevmode\hbox to2em{\hss}#2\par}
+\def\toindex#1{\edef\tempa{\write\tocfile{\noex\indexsubsectionline{}{#1}{\noexpand\the\count0}}}\tempa}
+
+\noindex\nonumber\section{Index}
+\everypar\@everypar\vskip-3pt
+\input \jobname.toc
+
+\newwrite\tocfile
+\immediate\openout\tocfile=\jobname.toc
+
+\section{Introduction}
+
+There have been in the past people who wrote scripts for the generation of hyphenation patterns. They either used a language different from \TeX, wrote a program specific for the needs of their language, or they didn't distribute it (there was none at Ctan at the time of writing this paper).
+
+The mkpattern program is just the file mkpatter.tex. It is a general purpose pattern generating program. It allows the user to define letter sets and to write the patterns in a template-like manner, with the several options described below.
+
+\section{How to use it}
+
+You should create a generating file to be processed with \TeX{} that at some point inputs \hbox{mkpatter.tex}. The program was created with occasion of the need to write the Galician patterns, so the file \hbox{mkpattern-exmpl.tex}, (almost) the source for version 2.1 of those patterns, is a quite complete example of a generating file.
+
+The order {\tt \input mkpatter.tex] need not be at the very first line, since you may define macros before that point. The general structure of the generating file is:
+
+\begin{syntax}
+\input mkpatter.tex/hb
+<optional change of the output file name>/hb
+\begin{code}/hb
+<definition of user macros>/hb
+\end{code}/hb
+<definition of letter sets>/hb
+<other definitions>/hb
+\begin{pseudopatterns}/hb
+<pseudopatterns>/hb
+\end{pseudopatterns}/hb
+\end{}
+/endsyntax
+
+Once this file is written it has to be processed under INITEX ---e.g., by typing {\tt initex <filename>] on the command line--- (it will also work under Plain\TeX{} or L\raise0.13em\hbox to0.1em{\kern-.36em\latexA A\hss}\TeX). If no other name is given (see the next section), a file with the same name but extension {\tt .pat] will be created. This is the patterns file, and has the following structure:
+
+\begin{syntax}
+<catcode settings>/hb
+{/hb
+<setting of active characters>/hb
+\patterns{/hb
+<patterns>/hb
+}/hb
+}
+/endsyntax
+
+<patterns> consist only of patterns and comments, provided the generating file is correct.
+
+\section{Changing the name of the output file}
+
+The file to be written can be given a name different form the default one. Just write
+\displayline{\filename{<filename>}]
+
+\noindent before any write action is performed ---simply write it just after {\tt \input mkpatter].
+
+\section{Defining letter sets}
+The <definition of letter sets> is a set of instructions with this syntax:
+\begin{syntax}
+&<set name>={<list of characters>}
+/endsyntax
+
+For example, {\tt &V={a e i o u}]. The <set name> may contain, excluded numbers, braces, ampersands and equal signs, almost any character. The <list of characters> is a space separated list of usually, but not necessarily, single characters, as well as previously defined sets of characters, as in the following example:
+
+\begin{syntax}
+&V={a e i o u}/hb
+&V+={&V h}/hb
+&Va={á é í ó ú}/hb
+&Vall={&V &Va}/hb
+&Vall+={&Vall h}
+/endsyntax
+
+\section{Other definitions}
+
+<other definitions> is three kinds of definitions, two of which are character related. One is the command\toindex{Encoding substitutions}
+\displayline{\encodingsubstitutions]
+
+\noindent It takes two arguments, each one being a space separated list of characters. The first includes the characters to be replaced, and the second the corresponding replacements. For example, the file mkpattern-exmpl.tex declares the following encoding substitutions:
+
+\displayline{/ttsmall/catcode`/^=12 /hss\encodingsubstitutions{á é í ó ú ñ /"u /"/i}{^^e1 ^^e9 ^^ed ^^f3 ^^fa ^^f1 ^^fc ^^ef}/hss]
+
+The patterns are specific for a particular font encoding, but the text editor you are using may follow a different encoding. For example, the character á is in position {\tt E1] in the T1 encoding, but it may be represented by a different number by your text editor. Thus, whenever you write a pattern that contains á, and you see an á in your text editor, you are not writing the pattern you intended for the T1 encoding. Suppose á is stored as {\tt E7] by your text editor. That position is \c{c} in the T1 encoding, so, even if you see an á, you are writing a pattern containing \c{c} instead.
+
+In order to achieve the correct results, all the á's that you wrote have to be replaced by T1's á, i.e., character {\tt E1], which may be whatever in your text editor encoding. This can be done either at the time of writing the patterns, or by means of active characters at the time INITEX shall read them. The program mkpattern takes this latter approach. Suppose that the slot {\tt E1] (á~in T1) is interpreted by your text editor as \o, then the above declaration will result in a set of definitions written in the patterns file, before the patterns, the first of which will look like
+
+\displayline{\catcode`\á=13 \edefá{\string /o}]
+
+\noindent This will cause INITEX to replace each occurrence of your text editor's á with your text editor's \o, i.e., T1's á. These definitions are written inside a group, so that they remain local.
+
+If the character to be replaced is the same than the replacement character, then making it active is superfluous, and mkpattern will not write the definitions to the file. The machine where mkpattern-exmpl.tex was written happened to represent all the needed letters above position 128 in the same places as the T1 encoding, so if you process that file no definition will be generated.
+
+You may wonder why mkpattern writes {\tt \edefá{\string /o}] and not simply {\tt \defá{/o}]. The reason is that the set of characters to be replaced and the set of replacement characters may have nonempty intersection, which renders the later approach invalid.
+
+\def\tttoindex#1{\tt\toindex{{\noex\tt \noex\string#1}}}
+The other character related command of <other definitions> is {\tt \letters/tttoindex[\letters]], that takes as argument a space separated list of characters. The catcode of these characters will be made equal to 11 in the patterns file. You write the characters normally with your text editor encoding; mkpattern will replace them if necessary.
+
+Successive occurrences of {\tt \encodingreplacements] and {\tt \letters] are added to previous ones.
+
+The relative order of encoding replacement declarations, letter declarations and letter set definitions is free, because mkpattern simply stores the information necessary when processing those commands, and it does not write anything to the patterns file till it sees the beginning of the patterns.
+
+\medskip
+Finally, the other predefined command is {\tt \templatedef]\toindex{Giving names to templates}, and example of the use of which is {\tt \templatedef{prefixos}{#1&{V}2}], and later in the pseudopatterns you could write
+
+\begin{syntax}
+\begin{prefixos}/hb
+<#-parts>/hb
+\end{syntax}
+/endsyntax
+
+It is selfexplanatory once you know about templates, which is explained below.
+
+\section{The pseudopatterns}
+
+The pseudopatterns are the bulk of the generating file. There you may write bare patterns or ``patterns for the generation of patterns'', thus the name pseudopatterns. These are patterns where one or more letters have been replaced by letter sets, and the program writes a pattern for each letter of the set. Thus, for example, the pseudopattern
+
+\displayline{&{Vall}1/rm ,]
+
+\noindent with the set {\tt Vall] defined as above, would be replaced by the five patterns {\tt a1], $\dots$, {\tt ú1]; and the input {\tt &{Vall}2&{Vall+}] would write to the patterns file a pattern matrix starting at {\tt a2a] and ending at {\tt ú2h]. If the name of the letter set consists of a single character you may omit the braces.
+
+If a single pattern is written it will be transparently passed to the patterns file. Indeed, any text that does not deserve any special treatment is directly output to the patterns file. Any such text as well as pseudopatterns are {\emph words\/}. Words must be preceded and followed by one or more spaces or end of lines. Remember this when you write control sequences or comments (do not append them directly to a word).
+
+\section{Templates}
+
+Some times you may find that the synthesis provided by letter sets is not enough, as you may need to write several pseudopatterns which share a common structure. You may then write a template, in a way similar to the alignments of \TeX. The syntax is:
+
+\begin{syntax}
+\template{<pre-text>#<post-text>}/hb
+<#-parts>/hb
+\end{template}
+/endsyntax
+
+For example, the file mkpattern-exmpl.tex defines the following template for prefixes:
+
+\begin{syntax}
+\template{#1&{V}2}/ / /%Prefixos/hb
+<#-parts>/hb
+\end{template}
+/endsyntax
+
+In this case the <pre-part> is empty. The <\#-parts> is any text that may also appear outside the template scope. The program prepends and appends the <pre-part> and <post-part> to any word, and then it reads the resulting string as if it had been there from the beginning.
+
+Some lines below in the same file the template {\tt \template{co2# \newline}] is defined. This example illustrates the fact that the <pre-text> and the <post-text> may contain spaces as well as control sequences. Spaces will be respected whenever they don't follow a control sequence.
+
+Templates cannot be nested. (They actually can, but the effect is not to apply both, but to apply the innermost).
+
+\section{Exceptions}
+
+It is very likely that a pseudopattern or template applies to all but one or a few patterns. Such exceptions can be specified prior to their generation with the command {\tt exceptions]:
+
+\begin{syntax}
+\exceptions{<exceptions>}{<replacements>}
+/endsyntax
+
+\noindent <exceptions> is a space separated list of exceptions. <replacements> may be either empty or a comma separated list of replacements. This command may appear more than once; it simply accumulates exceptions.
+
+If <replacements> is empty mkpattern will generate for each pattern in <exceptions> a ``hole'' of equal size than the removed pattern, so that the output remains nicely formatted and the exception can be spotted at the first sight. Note that empty means exactly that, so a space is not considered empty. If it is not empty it must include exactly $n-1$ commas (not hidden by braces), where $n$ is the number of patterns in <exceptions>. The replacement text for each exception is copied verbatim to the patterns file, without further processing. This has some limitations, as is for instance that you cannot replace a particular pattern with a pseudopattern. Note, however, that you may still replace one pattern with two or more patterns, and that one of those patterns may be the original pattern (there is a case of this in mkpattern-exmpl.tex).
+
+Each pattern written to the patterns file is followed by a space, and it is so for the replacement text, so even if <replacements> includes only commas at least a space will be written in the place of the missing pattern. If there is just one pattern to be replaced the least you can get is {\emph two\/} spaces, for in that case the replacement {\tt {}] is interpreted as explained above. If you {\emph really} want the replacement to be as short as possible, then write a faked pattern:
+
+\displayline{\exceptions{a2a fff}{,}]
+
+\section{Comments, blanks and arbitrary output}
+
+mkpattern has a command that allows you to place any text (any balanced text) in the output file:
+
+\displayline{\put{<balanced text>}]
+
+The most frequent elements that need to be written, and that cannot be written by simply placing them in the generating file, are comments and empty lines. mkpattern treats the end of a line and empty lines as spaces, so the only way to insert an end of line in the patterns file is with the command {\tt \newline] (you can include end(s) of line in the argument to \put, but it will output the character 13, which may or may not be the end of line for your OS). You may occasionally need to write two {\tt \newline] instead of one. As it has already been shown, this command may appear in the definition of a template.
+
+Comments may be output with \put, but there are other possibilities. mkpattern has three states regarding the treatment of comments:
+
+\displayline{\nocomments/hfill \halfcomments/hfill \keepcomments]
+
+%\year=\tolerance \tolerance=250
+{\tt \nocomments] makes mkpattern ignore all comments (by simply doing no\-thig) except those inside \put. {\tt \halfcomments] is necessary if you want comments to appear in the arguments to functions other than \put. There are actually two cases. The one is inside the definition of a template, and the other in the replacements of {\tt \exception]. While the former is unlikely to be ever needed, the later can turn to be useful. Moreover, in this latter case \put{} does not work, since the replacement is copied verbatim. One reason you may need it is that the exception is the last pattern of its line, in which case a hole will not be perceptible. You may then write
+
+\displayline{\exceptions{z1z}{/%/%/%}/hfill]
+
+%\tolerance=\year
+\noindent to point out the absence of the pattern. You may also want it in order to emphasise an exception. Thus, a line of mkpattern-exmpl.tex could have been written in this manner:
+
+\displayline{/hss/ttsmall \exceptions{.de3s2esper}{.de3s2esper de4s3esperanz /%Note! Exception}/hskip-/parindent]
+
+\noindent The comments inside the replacement of an exception can only contain commas if they are hidden by braces, but the braces will also appear in the output.
+
+{\tt \keepcomments], in addition to the behaviour of {\tt \halfcomments], writes to the patterns file any comment that is read in the generating file. Each comment is written on a line by its own, which is usually the desired behaviour. If you want the comment to appear after some text in the line use \put.
+
+Before the pseudopatterns start, comments can only be placed in the patterns file with \put. You may also write {\tt \newline]'s there.
+
+\section{Input files}
+
+In order to input a file you need to write {\tt \mkinput{<filename>}]. The file must include the {\tt \endinput] command.
+
+Currently, outside the pseudopatterns a common {\tt \input] will work, but you'd better not rely on that, for it may change in the future while {\tt \mkinput] will always work.
+
+\section{User defined macros}
+
+It is obvious that mkpattern makes substantial changes to the catcodes. In this respect the program is quite radical, which makes sense if you think that the main task of \TeX{} is usually to output pages or read macro definitions, while the mkpattern program processes a file with the purpose of writing another text file. It has to catch every character of the input file, so that instead of being added to a box to be eventually typeset it is added to the material to be eventually written to the patterns file, after prior processing if necessary.
+
+All these is done by means a control sequence named {\tt \lee]. It is triggered by {\tt \begin{pseudopatterns}] and does not stop to act till the end of the input, which is signalled by {\tt \end{}]. When the command {\tt \lee] sees another command in front of it, it executes that command, thus yielding temporarily the control to that command. Every command designed in mkpatter.tex and liable to appear inside pseudopatterns, places a {\tt \lee] after it has completely expanded, restoring the control to the main reading flow of the program. In the like manner, every control sequence designed by the user should place the control sequence {\tt \lee], or any other that does that, before any text, lest the following text goes to the dvi file. Thus, the following definitions are valid:
+
+\begin{syntax}
+\def\foo{\newline c2c}/ / \def\twolines{\newline\newline}/hb
+\def\foo{\lee c2c}/ / / / / / \def\foo{\exceptions{1h}{}}/hb
+\def\foo{\show\a\lee}
+/endsyntax
+
+\noindent But the following ones are not
+
+\begin{syntax}
+\def\foo{c2c \newline}/ / / / \def\foo{\show\a}
+/endsyntax
+
+Before pseudopatterns, {\tt \lee] is equal to {\tt \relax], so it makes no harm.
+
+Since the program ``destroys'' the catcode settings, macros have to be defined in the following manner:
+\begin{syntax}
+\begin{code}/hb
+<user definitions>/hb
+\end{code}
+/endsyntax
+
+\noindent or before the program is read. The latter is not possible if the file is processed with INITEX. The code environment does not open a new group level, so the scope of macros defined there is the enclosing group.
+
+{\tolerance300
+In addition, some usual conventions regarding registers are changed. Among the allocation routines only {\tt \newcount], {\tt \newtoks], {\tt \newread] and {\tt \newwrite] are available. Also count registers 0 to~9, usually reserved for page numbering, are available for scratch use. The allocations have to take place after the program file is read. This doesn't disable the use of these to be allocated registers when defining macros prior to the reading of the program, provided that they never get expanded at that time.\par}
+
+There is another environment for defining macros:
+\begin{syntax}
+\begin{patternscode}/hb
+<user definitions>/hb
+\end{patternscode}
+/endsyntax
+
+It sets the catcode equal to those that will be in force inside the pseudopatterns. This concerns in particular {\tt #] and {\tt &]. The macro parameter character inside that environment is {\tt /$]\iffalse$\fi. The above definition of prefixes, {\tt \templatedef{prefixos}{#1&{V}2}], can be performed by hand as
+\begin{syntax}
+\begin{patternscode}/hb
+/null/kern2em \def\prefixos{\template{#1&{V}2}}/hb
+/null/kern2em \endprefixos{\end{\template}}/hb
+\end{patternscode}
+/endsyntax
+
+
+You may even define a set of macros that completely replaces the task of mkpattern of generating the patterns. If, after the complete expansion, your macros result in the control sequence {\tt \lee] followed by a (possibly long) list of patterns, those patterns will be placed in the patterns file. Remember to insert a {\tt \newline] from time to time. If you add some {\tt \exceptions] before generating the patterns you may use mkpattern as a formatter for your patterns.
+
+When material to be output is seen by the program it is not usually directly output, but it instead gets placed in a buffer called {\tt \linesofar]. This is also what \put{} does. If you want something to be output immediately, before the current line is completed, write
+
+\displayline{\iwrite{<material>}[/rm ,/egroup]
+
+\noindent but recall that each write goes to a separate line.
+
+\section{Tracing and the log file}
+
+Mkpattern displays in the log file each defined letter set, as can be seen by running the example. If {\tt \tracingexceptions] is positive it will also write the exceptions found and the subsequent replacement, as well as the exceptions that were written but did not arise.
+
+\end
diff --git a/Master/texmf-dist/doc/plain/mkpattern/mkpatter.pdf b/Master/texmf-dist/doc/plain/mkpattern/mkpatter.pdf
new file mode 100644
index 00000000000..edef6065c8c
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/mkpattern/mkpatter.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/plain/mkpattern/mkpattern-exmpl.tex b/Master/texmf-dist/doc/plain/mkpattern/mkpattern-exmpl.tex
new file mode 100644
index 00000000000..6c91d8a0a97
--- /dev/null
+++ b/Master/texmf-dist/doc/plain/mkpattern/mkpattern-exmpl.tex
@@ -0,0 +1,307 @@
+% This is the file mkpattern-exmpl.tex, by Javier A. M\'ugica, November 2006
+%
+% This file is provided as an example file for the program mkpattern.
+% This file is in the public domain: You can use, modify and/or distribute it freely.
+%
+% Some comments are written in Galician. They are intended
+% to explain the Galician patterns, since this file was once the
+% source for them, so don't worry if you don't understand them.
+\input mkpatter.tex
+
+\begin{code}
+\def\Ti{\encodingreplacements{á é í ó ú ñ ü ï}{^^e1 ^^e9 ^^ed ^^f3 ^^fa ^^f1 ^^fc ^^ef}}
+\end{code}
+
+&Va={a e o}
+&Vp={i u}
+&Vi={&Va u}
+&Va+={&Va á}
+&Vv={a e i}
+&Vai={a i}
+&Vvac={á é í}
+&V={a e i o u á é í ó ú}
+&L={l r}
+%ñ non se inclúe nos seguintes grupos
+&C-={b c d f g h k m n p q s t v w x z} %Consoantes excepto as líquidas
+&C={&C- l r}
+&Cl={b c d f g k p t v} %As que van unidas á líquida, agás r e l
+&C!l={m n q s x y z h}%As que van separadas da líquida, agás l e r
+&G={b c d l m n r s t x}%Consoante inicial de certos grupos pouco frecuentes
+
+\Ti
+\letters{á é í ó ú ñ ü ï}
+
+\begin{pseudopatterns}
+
+a1a e1e o1o zo2o a1á e1é o1ó 2&{Va}&{Vp}.
+&{Vi}1i&{Va+} 3ï3a 2i&{Va+}.
+
+\newline
+\exceptions{2ch 2gh 2kh}{}
+\exceptions{t2l 2tl.}{}
+1ñ
+1&{C}
+2&{C}&{C-}
+c4h 2ch. 2g2h 2k2h \newline
+\newline
+&{Cl}2&L 2&{Cl}&L.
+2&{C!l}&L
+
+2t2l \newline
+2lr l4l 2ll.
+2rl r2r 2rr.
+
+\template{2&G3#}
+p2t c2t c2n p2s m2n g2n f2t p2n c2z t2s
+\end{template}
+san4c5t plan4c5t
+
+\template{4#.}
+pt ct cn ps mn gn ft pn cz ts
+\end{template}
+
+un4ha 2non. 3mente. o2hib alde2h pro2hib \newline
+\newline
+%palabras malsonates
+4caca4 4cago4 4caga4 4cagas. 4puta4 4puto4 4meo. 4mea. \newline
+4meable. 4meables. 4peido4
+
+\exceptions{.pre1á2 .su2b1i2 .su2b1í2}{} %If duplicate patterns were simply added...
+\exceptions{.pre2á}{.pre2á2} %This is error prone. I think that writting
+\exceptions{.sub2i .sub2í}{.su2b2i2,.su2b2í2}%all the exceptions here together is the best that can be done.
+\template{#1&{V}2} %Prefixos
+acto afro aero anfi anglo .ante .anti .arqui auto
+biblio bio cardio cefalo ciclo cito cnico contra cripto crono
+deca .deza ecano eco ectro endo ento entre euco euro extra
+fono foto gastro xeo gluco hecto helio hemato hemi
+hexa hidro hipe2r histo homo icono .in infra .inte2r intra .iso
+kilo macro maxi mega megalo melano micro mili mini
+multi miria mono dinamo .nano necro .neo magneto norte octo octa
+oligo omni paleo para penta piezo pluri poli .pos2t .pre
+.pro proto radio franco germano retro cromo sobre semi
+pseudo socio .su2b super supra oftalmo .tele termo tetra topo
+.tri tropo ultra xeno
+\end{template}
+
+\newline
+ti2o3qu ti2o3co
+bi1u2ní
+o2i3de o2i3dal
+deca2e3ment
+2al. 2a2is.
+pe3r2e3mia
+hiper3r \newline
+famili2a familia3r
+mini2a3tur
+para2u3gas
+paraí3so
+atopo2u3
+enaxeno2u3
+
+\newline
+2os. 2o3so. 2o3sos. 2o3sa. 2o3sas. 2o3samente. \newline
+2i3co. 2i3cos. 2i3ca. 2i3cas. \newline
+
+\newline
+\put{%O prefixo co}
+\exceptions{.co1á2}{}
+.co1&V2
+
+%Pode non ser prefixo (expecto os derivados de coar)
+\template{.co2# \newline}
+\put{%Formas do verbo coar con pronomes enclíticos}\newline ar á2 abá
+acerv andro ano añar año art etan enci erci inci ira iro ita
+\end{template}
+
+%Non é prefixo (os que non son da forma &V3 non necesitan ir un por un)
+\template{co2# \newline} %Non é necesario coia, coiote
+a3gul á3gul a3la. a3las. a3lescen a3lición. a3licions. a3na. a3nas.
+antriñ a3ñadeir a3tí. a3tís. e3ficien e3lernos. e3llo. e3lla. e3llos. e3llas.
+e3lleir enll enxía e3sita. e3sitas. e3táne e3vo. e3va. e3vos. e3vas.
+i3dado iei imbra intreau. íña iña iñei i3pú. i3pús. i3ra. i3ras. i3raza i3ro. i3ros.
+i3ta. i3tas. i3tado. i3to. i3tos. i3tel i3tío. i3tus. u3c u3lomb u3try u3qui u3rel
+u3sa. u3sas. u3so. u3sos. u3selo u3tad u3to. u3tos. u3vini u3z
+\end{template}
+
+\newline
+\put{%O prefixo des}
+.de2s1&{V}2
+3se. 3s2es. 3sa. 3s2as. de3s2outr 3s2emos. 3s2edes. 3s2en.
+
+\exceptions{de3s2esper}{de3s2esper de4s3esperanz}
+\template{de3s2# \newline} %Prefixos .de (máis ou menos)
+a3crali a3guisa a3lini a3ngr a3ñ a3rrollis astr a3zo e3c e3que e3guid e3la
+ensib e3ñ ert ért esper e3pér e3x é3x i3der ign ígn i3nenc ingr iste isti o3lac o3lad old
+o3lidari uetud sulf
+\end{template}
+
+\template{.des2# \newline} %Prefixos dubidosos ou afastados da orixe etimolóxica. Non se inclúen os que por ser moi breves poderían coincidir con prefixos .des formados ad hoc, xa que impedirían a división de palabras comúns (desecar, deselar).
+abor afia afía afío air emboc embóc empeñ empéñ enlac enlaz enlác enláz
+envol envól idia ora
+\end{template}
+
+\keepcomments
+
+\newline
+%Excepcións ó prefixo in
+\template{.in2# \newline}
+a3misib. a3mov a3ne. a3nic a3nid á3nime antes. au e3dia é3dit e3fab e3narr
+epc ept erc ert erm erv e3siv e3xora i3ci i3cu i3mig i3miza i3qui
+o3cen o3cui o3cuo o3cul ó3cul o3pia. o3sili o3sit o3tróp o3trop uit u3lase u3lina
+unda u3sita ú3til
+\end{template}
+in2o4cular \newline
+
+\newline
+%Excepcións ó prefixo inter
+.inter3r
+\template{.inte3r2#}
+és. e3sa é3sa e3sá e3so é3so e3só ior i3no. i3nos. i3na. i3nas. i3nid
+\end{template}
+
+\newline
+%Os prefixos mal e ben
+\exceptions{.be2n1e2 .be2n1é2 .ma2l1e2 .ma2l1é2}{.be2ne2, ,.ma2le2, }
+
+\halfcomments
+.be2n1&{V}2
+\template{be3n2# \newline} %Non é prefixo (ou non se nota)
+ign i3merí i3nés i3nes i3toíta
+\end{template}
+
+\newline
+.ma2l1&{V}2
+\template{.mal2# \newline} %Pode non ser prefixo
+abar abár aco acó armad ogr ura axa
+\end{template}
+\template{ma3l2# \newline} %Non é prefixo. Non é neceario malos, malas
+a3cía a3citan a3gueñ aio aia andrín andrin a3quita ar. a3res. a3ria.
+a3to. a3tos. a3ta. a3tas. a3tión aui eabl eabil eico eolar e3ta. e3tas. e3tín e3teiro
+eza ia. ian i3cia i3cios ign i3kita inke ó3fago ó3nic o3nato o3nilue
+\end{template}
+ma4l3ianq
+\template{.mal1# \newline} %É prefixo e comenza por e
+educ encar ensin entend
+\end{template}
+
+\newline
+\put{%Excepcións ó prefixo poli}
+\template{poli2# \newline}
+u3r o3me arq árq éste andr antea
+\end{template}
+expoli2
+
+\newline
+\put{%Excepcións ó prefixo post}
+\template{pos3t2# \newline}
+a. as. al. ais. a3llo e. es. ear. e3la. e3las. er. erg e3rid e3rior i3go i3la
+illón ín. i3te. i3zo. i3zos. i3za. i3zas. os. oiro ó3ni u3la u3lo u3le u3ra. u3ras.
+\end{template}
+
+\newline
+\put{%Excepcións ó prefixo pre}
+\template{.pre2# \newline} %Poden non ser prefixos
+amar \put{%Formas do verbo prear con pronomes enclíticos}\newline ar á abá
+\end{template}
+\template{pre2# \newline} %Non son prefixos
+as. a3da. a3das. á2 abá i3t o3cup o3cúp
+\end{template}
+
+\newline
+\put{%Excepcións ó prefixo pro}
+\template{pro2# \newline} %Non son prefixos. Non é necesario proer
+e3za í3do ust
+\end{template}
+
+\newline
+\exceptions{.re2e2 .re2é2}{.ree2,.reé2}
+\put{%O prefixo re} %Faltan excepcións
+.re2&{V}2
+
+
+\newline
+\put{%O prefixo sub: l, r e excepcións}\newline
+.su2b3l .su2b3r
+
+\template{.sub2# \newline} %Poden non ser prefixos
+\put{%Formas do verbo subir con pronomes enclíticos}\newline i í
+eriz orna
+\end{template}
+\template{.sub4# \newline}
+lev lim
+\end{template}
+
+\template{su3b2# \newline} %Non son prefixos
+e3la. e3las. é3rico e3rina. e3rinas. eroso iote ulado orno. ornos. urbio
+\end{template}
+\template{su3b4# \newline}
+liminar repción reptici
+\end{template}
+
+\newline
+\put{%Excepcións ó prefixo tri}
+\template{tri2# \newline} %Non son prefixos (ou non se nota)
+a3ga. a3gas. al. a3les. angul á3sico. estin %(De Trieste)
+unf unvir
+\end{template}
+
+\newline
+\put{%Excepcións a varios prefixos que son terminacións verbais}
+%As combinación con pronomes enclíticos (son centos)
+%deberanse evitar nos patróns de cada prefixo cando sexa necesario
+%Inclúense as combinacións máis habituais
+\template{2&{Vai}#.}
+3do 3da 3dos 3das ndo r %inf. xer. part.
+\end{template}
+
+\template{2&{Vv}#.}
+3res rmos rdes 3ren \newline %inf. conx.
+rme rte rlle rnos rvos rlles %inf. con pron. indir.
+\end{template}
+
+\template{2&{Vv}3#.}
+dor dora dores doiro doiros doira doiras deiro deiros deira deiras %subst. deriv.
+lo los la las %inf. con pron. dir.
+rei rás rá remos redes rán \newline %futuro
+ría rías ri1amos ri1ades rían \newline %cond.
+de %imp.
+\end{template}
+\template{2&{Vvac}3#.}
+deo dea deos deas %imp. con pron. dir.
+\end{template}
+
+\template{2#.}
+%coar, inar, entrear, prear, superar
+as a3mos a3des an \newline
+a3ba a3bas a3bamos a3bades a3ban \newline
+a3ches astes a3ron \newline
+es e3mos e3des en \newline
+a3se a3ses á3semos á3sedes a3sen \newline
+\newline
+%subir
+i3mos i3des \newline
+ía í3as iamos iades í3an \newline %su-bi-a-mos, pero ca-ia-mos
+ín i3ches iu istes i3ron \newline
+% O pres. subx. coincide con pres. ind. da 1ª
+i3se i3ses í3semos í3sedes i3sen
+%contraer, decaer, extraer
+%Pres. subx. xa se divide ben
+\end{template}
+\newline
+í3do í3da í3dos í3das
+%Conxugación completa do verbo subir
+\template{.su3b#.}
+ir indo ido ida idos idas \newline
+ires irmos irdes iren \newline
+o es e imos ides en \newline
+ía ías i3amos i3ades ían \newline
+ín iches iu istes iron \newline
+irei irás irá iremos iredes irán \newline
+iría irías iriamos iriades irían \newline
+a as amos ades an \newline
+ise ises ísemos ísedes isen \newline
+ide ídeo ídea ídeas
+\end{template}
+
+\end{pseudopatterns}
+\end{} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/plain/mkpattern/mkpatter.tex b/Master/texmf-dist/tex/plain/mkpattern/mkpatter.tex
new file mode 100644
index 00000000000..80be6ffb837
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/mkpattern/mkpatter.tex
@@ -0,0 +1,590 @@
+% mkpatter.tex Version 1.1
+%
+% This file is part of the program mkpattern, and all files
+% that belong to that program must be distributed together.
+%
+% For this version 1.1, this file mkpatter.tex is the only file
+% belonging to the program mkpattern.
+%
+% The file mkpatter.dvi (or mkpatter.pdf) is a manual for this program.
+% It is very likely that you may obtain it at the same place
+% where you got this file from.
+%
+% (c) Javier A. M\'ugica, 2006, 2007
+% License: LPPL version 1.3
+%
+% LPPL maintenance status: maintained
+% Current Maintainer: Javier A. M\'ugica
+%
+% For bug reports and comments:
+%
+% Javier Múgica, javier at digi21.net
+%
+%
+\ifnum\catcode`\{=1
+\catcode`\$=12 %
+\catcode`\&=12 %
+\catcode`\^^K=12 %
+\catcode`\^^A=12 %
+\let\bye\undefined
+\fi
+
+\chardef\active=13
+\catcode`\{=1
+\catcode`\}=2
+\catcode`\#=6 % hash mark is macro parameter character
+\catcode`\^=7
+\catcode`\^^I=10 % ascii tab is a blank space
+\catcode`\^^M=9 %We need a \relax after some numbers at the end of a line
+\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"
+\catcode`\&=12
+\catcode`\_=11
+\catcode`\~=11
+\catcode`\@=11\relax
+
+%Latex
+\catcode`\:=11\relax
+\ifx\@@end\undefined\else\let\end\@@end \let\@@end\undefined\fi
+\ifx\tex_end:D\undefined\else \let\end\tex_end:D \let\tex_end:D\undefined\fi
+\catcode`\:=12\relax
+
+\newlinechar=`\^^J
+\message{This is Mkpattern, Version 1.1 APR 2007^^J}
+\let\bgroup={
+\let\egroup=}
+
+\def\empty{}
+\def\space{ }
+\def\qend{\qend}
+\countdef\m@ne=10 \m@ne=-1 %
+\def\_qlast{?_qlast}
+{\escapechar=\m@ne\relax
+ \xdef\backslash{\string\\}
+ \xdef\percent{\string\%}
+}
+
+\count11=9 %Allocates toks registers: 10, 11, ...
+\count12=14 %Allocates count registers: 15, 16, ...
+\count13=2 %Input streams: 3, ...
+\count14=2 %Output streams: 3, ...
+\def\wlog{\immediate\write\m@ne}
+\countdef\@@count=0
+\toksdef\tokscclv=255\relax
+\toksdef\toks@=0\relax
+\toksdef\toks@ne=1\relax
+\toksdef\toksv=5\relax %It will no be changed by low level macros
+\toksdef\toksvi=6\relax %It will no be changed by low level macros
+\outer\def\newtoks#1{\advance\count11 1 \toksdef#1=\count11%
+ \wlog{\string#1=\backslash toks\the\count11}}
+\outer\def\newcount#1{\advance\count12 1 \countdef#1=\count12%
+ \wlog{\string#1=\backslash count\the\count12}}
+%These two are not used but are provided to the users
+\outer\def\newread#1{\advance\count13 1 \chardef#1=\count13%
+ \wlog{\string#1=\backslash read\the\count13}}
+\outer\def\newwrite#1{\advance\count14 1 \chardef#1=\count14%
+ \wlog{\string#1=\backslash write\the\count14}}
+
+%Tracing switches. There isn't actually very much to trace
+\newcount\tracingexceptions \tracingexceptions=0\relax
+
+\edef\outputfilename{\jobname.pat}
+
+\def\filename{\bgroup
+ \catcode`\|=12
+ \count255='176 \@@count=256 \makeothers
+ \count255=0 \@@count='173 \makeothers
+ \_filename
+}
+\def\_filename#1{\gdef\outputfilename{#1}\egroup}
+
+\def\iwrite{\immediate\openout0=\outputfilename
+ \gdef\filename##1{\errmessage{Too late for changing the output file name}}
+ \gdef\iwrite{\immediate\write0 }\iwrite
+}
+
+\let\iffound\iffalse
+
+\let\~~end\end
+\def\~end{\let\end\~~end\ifnum\tracingexceptions>0\expandafter\reportmissingexceptios\fi\~~end}
+\def\begin#1{\csname#1\endcsname}
+\def\end#1{\def\tempa{#1}\ifx\tempa\empty\expandafter\~end\fi\csname end#1\endcsname}
+
+\newtoks\toksnames \toksnames={}
+\newtoks\tokslista
+\newtoks\linesofar \linesofar={}
+\newtoks\toksencoding \toksencoding={}
+\newtoks\toksletters \toksletters={}
+
+\def\writeline{\iwrite{\the\linesofar}\global\linesofar={}}
+\def\conditwrite{\edef\tempa{\the\linesofar}\ifx\tempa\empty\else\writeline\fi}
+\def\newline{\writeline\lee}
+
+\def\busca#1#2{% It will usually also work with #1 being lenghtier than one character,
+\def\encuentra##1#1##2\quend{%but if the ending can be overlaped with the beginning it may not.
+ \def\tempa{##2}
+ \ifx\tempa\empty\tokscclv{iffalse}
+ \else\tokscclv{iftrue}
+ \fi
+ \expandafter\let\expandafter\iffound\csname\the\tokscclv\endcsname
+}
+\encuentra#2#1\quend
+}
+
+\def\first#1#2\qend{#1}
+\def\second#1#2\qend{#2}
+
+{
+\catcode`\&=13
+\gdef&#1={
+ \catcode`\&=0\relax
+ \defineamp{#1}
+}
+}
+\def\defineamp#1#2{
+ \expandafter\edef\csname#1\endcsname{#2 }
+ \catcode`\&=13\relax
+ %Add #1 to the list of names *at the right*; they must be executed in order.
+ \toksnames\expandafter{\the\toksnames\\{#1}}
+}
+\def\makelists{
+\def\\##1{\expandafter\makelist\csname##1\endcsname}
+\the\toksnames
+}
+\def\makelist#1{
+\tokslista={}
+\expandafter\appendtolist#1\qend %#1 contains at least a trailing space
+{\def\\##1{##1 }
+\edef\tempa{\expandafter\empty\the\tokslista}
+\wlog{\string#1 :->\tempa}}
+\edef#1{\the\tokslista}
+}
+\def\appendtolist#1 #2\qend{
+ \def\tempa{#2}
+ \ifx\tempa\empty
+ \def\next{}
+ \else
+ \def\next{\appendtolist#2\qend}
+ \fi
+ \def\tempa{#1}
+ \ifx\tempa\empty %if #2 is not empty we have gobbled a leading space
+ \else
+ \tokslista\expandafter{\the\tokslista\\{#1}}
+ \fi
+ \next
+}
+
+\def\lee{\gobbles\_lee}
+\def\gobbles#1#2{% this just gobbles up and then executes #1
+%Test if #2 is a single token
+\def\tempa{#2}
+\ifx\tempa\empty\else
+\edef\tempa{\second#2\qend}
+\fi
+\ifx\tempa\empty\def\next{#1#2}
+\else\def\next{#1{#2}}
+\fi
+\next
+}
+
+\def\_lee#1{
+\edef\tempa{\expandafter\first\string#1a\qend}% The letter a is just in case #1 is empty
+\ifx\tempa\backslash\expandafter#1% Each control sequence that may appear inside pseudopatterns must provide its own \lee at the end
+\else\ifx\tempa\percent
+ \catcode13=12
+ \def\next{\comment#1}
+\else
+ \def\tempa{#1}%Test if #1 is a single token
+ \ifx\tempa\empty\else
+ \edef\tempa{\second#1\qend}
+ \fi
+ \ifx\tempa\empty\def\next{\__lee#1}
+ \else\def\next{\__lee{#1}}
+ \fi
+\fi
+\expandafter\next\fi
+}
+
+\def\__lee#1 {%Do not remove this space
+%Backslash and comment handled above
+%\else
+ \ifappliedtemplate
+ \busca{&}{#1}
+ \iffound
+ \edef\tempa{\the\linesofar}\ifx\tempa\empty\else\writeline\fi
+ \advance\c_amp1 %
+ \tokslista={}\procesamacro\tokslista{#1}
+ \def\next{\expandafter\lee\the\tokslista%
+ \advance\c_amp\m@ne \writeline\lee}
+ \else
+ \def\texto{#1}
+ \edef\tempa{\the\toksexceptions}
+ \ifx\tempa\empty\else\substituteifneeded\texto{#1}\fi
+ \toks@\expandafter{\texto}
+ \edef\tempa{\noexpand\linesofar{\the\linesofar\the\toks@\space}}
+ \tempa
+ \def\next{\lee}
+ \fi
+ \else
+ \tokscclv{#1}
+ \edef\texto{\the\pretemplate\the\tokscclv \the\posttemplate}
+ \let\ifappliedtemplate\iftrue\let\fi\fi
+ \def\next{\expandafter\lee\texto\let\ifappliedtemplate\iffalse\let\fi\fi \lee}
+ \fi
+%\fi
+\next
+}
+
+\def\procesamacro#1#2{
+\leemacro#2\qend
+\def\\##1{%
+ \edef\tempa{\the\tokslista\the\premacro##1\the\postmacro}
+ \tokslista\expandafter{\tempa}
+}
+\csname\macro\endcsname
+}
+\def\leemacro#1&#2#3\qend{
+\premacro={#1}
+\def\macro{#2}
+\postmacro={#3 }
+}
+
+\def\template#1{
+ \conditwrite\writeline
+ \bgroup
+ \savetemplate#1\qend
+ \let\ifappliedtemplate\iffalse
+ \lee
+}
+\def\endtemplate{\conditwrite\egroup\lee}
+
+\catcode`\$=6
+\catcode`\#=12
+\def\savetemplate$1#$2\qend{
+\pretemplate={$1}
+\posttemplate={$2 }
+}
+\catcode`\#=6
+
+\newtoks\premacro
+\newtoks\postmacro
+\newtoks\pretemplate
+\newtoks\posttemplate
+\newtoks\toksexceptions
+\newtoks\substitutions
+\def\pseudopatterns{
+ \makelists\wlog{}
+ \writeletters \iwrite{} %We cannot use newline
+ \iwrite{\string{\iffalse}\fi}
+ \edef\tempa{\the\toksencoding}
+ \ifx\tempa\empty\else\writeencodingreplacements \iwrite{}\fi
+ \conditwrite
+ \iwrite{\string\catcode13=10 }
+ \iwrite{\string\patterns\string{\iffalse}\fi}
+ \bgroup
+ \catcode`\#=12
+ \catcode`\&=12
+ \catcode`\,=12
+ \let\ifappliedtemplate\iftrue
+ \c_amp=0 %finally not used, but kept updated
+ \toksexceptions={}
+ \substitutions={}
+ \catcode`\^^M=10
+ \let\lee\~~lee
+ \halfcomments %this itself includes lee
+}
+\def\endpseudopatterns{\conditwrite\iwrite{\iffalse{\fi\string}}\egroup
+ \iwrite{\string\catcode13=5}\iwrite{\iffalse{\fi\string}}}
+
+{
+\catcode`\^^7f=13 \gdef^^7f#1{\expandafter\global\expandafter\linesofar\expandafter{\the\linesofar #1}\egroup\lee}
+\gdef\put{\bgroup
+ \catcode`\|=12
+ \count255='176 \@@count=256 \makeothers
+ \count255=0 \@@count='173 \makeothers
+ \catcode`\^^7f=13 ^^7f}
+}
+
+\def\nocomments{\catcode`\%=14 \lee}
+\def\keepcomments{\catcode`\%=12 \let\comment\copycomment\lee}
+\def\halfcomments{\catcode`\%=12 \let\comment\swallowcomment\lee}
+{\catcode13=12 %
+ \gdef\copycomment#1
+ {\tokscclv={#1}\conditwrite\iwrite{\the\tokscclv}\catcode13=10 \lee}%
+ \gdef\swallowcomment#1
+ {\catcode13=10 \lee}%
+}
+
+\def\appendtoks_fromdelimiter#1#2#3{
+\toks@=#1
+\tokscclv={#2#3?_qlast#3}
+\expandafter\ifx\csname _appendtoks_fromdelimiter#3\endcsname\relax %Don, this should be undefined
+ \expandafter\gdef\csname _appendtoks_fromdelimiter#3\endcsname##1#3{
+ \def\tempa{##1}
+ \ifx\tempa\_qlast
+ \else
+ \toks@\expandafter{\the\toks@\\{##1}}
+ \def\next{\expandafter\gobbles\csname _appendtoks_fromdelimiter#3\endcsname}
+ \expandafter\next
+ \fi
+ }
+\fi
+\edef\next{\noexpand\gobbles\expandafter\noexpand\csname _appendtoks_fromdelimiter#3\endcsname\the\tokscclv}
+\next
+#1=\toks@
+}
+
+\def\appendtoks_fromspace#1#2{\appendtoks_fromdelimiter#1{#2}{ }}
+\def\appendtoks_fromcomma#1#2{\appendtoks_fromdelimiter#1{#2}{,}}
+
+\def\exceptions#1{\catcode`\ =12 \_exceptions{#1}}
+\def\_exceptions#1#2{
+ \catcode`\ =10 %
+ \appendtoks_fromspace\toksexceptions{#1}
+ \def\tempa{#2}
+ \ifx\tempa\empty
+ \tokscclv={#1 ?_qlast }
+ \expandafter\gobbles\expandafter\makeemptysubs\the\tokscclv
+ \else
+ \appendtoks_fromcomma\substitutions{#2}
+ \fi
+ \lee
+}
+
+\def\makeemptysubs#1 {
+\def\tempa{#1}
+\ifx\tempa\_qlast
+\else
+ \countchars\@@count{#1}
+ \advance\@@count 1 %
+ \makeempty\tempa\@@count
+ \edef\next{\noexpand\substitutions{\the\substitutions\noexpand\\{\tempa}}}
+ \next
+ \def\next{\gobbles\makeemptysubs}
+ \expandafter\next
+\fi
+}
+
+\def\countchars#1#2{
+\count255=\m@ne
+\_countchars#2a\qend %Ensure that there is at least one token
+#1=\count255\relax
+}
+\def\_countchars#1#2{
+\ifx#2\qend\else
+\advance\count255 by 1\relax
+\def\next{\_countchars#2}
+\expandafter\next\fi
+}
+
+\def\makeempty#1#2{
+\def#1{}
+\def\next{\ifnum#2=0 \else\edef#1{#1 }\advance#2 \m@ne \expandafter\next\fi}
+\next
+}
+
+\def\substituteifneeded#1#2{
+ \def\tempb{#2}
+ \toks@={} \toks@ne={}
+ \def\\##1{\def\tempa{##1}
+ \ifx\tempa\qend
+ \toksexceptions\toks@
+ \toks@={}
+ \substitutions\toks@ne
+ \toks@ne={}
+ \else\ifx\tempa\tempb
+ \pop\toksexceptions
+ \edef\tempa{\global\noexpand\toksexceptions{\the\toks@\the\toksexceptions}}
+ \tempa
+ \pushpopmacro#1\substitutions
+ \edef\tempa{\global\noexpand\substitutions{\the\toks@ne\the\substitutions}}
+ \tempa
+ \def\\####1{} %gobble the remaining \\{...}
+ \ifnum\tracingexceptions>0 %
+ \wlog{Replacing the pattern {\tempb} with {#1}}
+ \fi
+ \else
+ \let\tempa\\
+ \pushpop\toks@\toksexceptions
+ \pushpop\toks@ne\substitutions
+ \let\\\tempa
+ \fi\fi
+ }
+ \the\toksexceptions\\{\qend}
+}
+
+\def\pop#1{
+\def\\##1##2//{#1={##2}}
+\the#1//
+}
+\def\pushpop#1#2{
+ \def\\##1##2//{
+ #1=\expandafter{\the#1\\{##1}}
+ #2={##2}
+ }
+ \the#2//
+}
+\def\pushpopmacro#1#2{
+ \def\\##1##2//{
+ \def#1{##1}
+ #2={##2}
+ }
+ \the#2//
+}
+
+\def\reportmissingexceptios{
+\def\\##1{\wlog{The exception {##1} did not arise.}}
+\the\toksexceptions
+}
+
+\def\mixtoks#1#2{
+\tokscclv=#1
+\toks@=#2
+#1={}
+\def\tempa##1{#1=\expandafter{\the#1\\{##1}}\let\\=\tempb \the#2//}
+\def\tempb##1##2//{#1=\expandafter{\the#1{##1}}#2={##2}\let\\=\tempa}
+\let\\=\tempa
+\the\tokscclv
+}
+
+\def\finalreplacement#1#2{#1={#2}}
+\def\charreplacement#1#2{
+#1={#2} %In case it is not found
+\def\tempa{#2}
+\let\oldslash\\
+\def\\##1##2{\def\tempb{##1}
+ \ifx\tempa\tempb
+ #1={##2}
+ \def\\####1####2{}
+ \fi
+}
+\the\toksencoding
+\let\\=\oldslash
+}
+
+\def\letters#1{\appendtoks_fromspace\toksletters{#1}}
+
+\def\encodingreplacements#1#2{
+\appendtoks_fromspace\toksv{#1}
+\appendtoks_fromspace\toksvi{#2}
+\mixtoks\toksv\toksvi
+\tokscclv=\toksv \toksv={}
+\def\\##1##2{\def\tempa{##1}\def\tempb{##2}\ifx\tempa\tempb\else
+ \toksv\expandafter{\the\toksv\\{##1}{##2}}\fi}
+\the\tokscclv
+\edef\next{\noexpand\toksencoding{\the\toksencoding\the\toksv}}
+\next
+}
+
+\catcode`\/=0
+\catcode`\\=12/relax
+
+/def/writeencodingreplacements{
+%/def/\##1##2{/iwrite{\def\foo{##2} \catcode`\##1=13 \edef##1{\foo}}}
+/def/\##1##2{/iwrite{\catcode`\##1=13 \edef##1{\string ##2}}
+ /wlog{Replacement: ##1->##2}}
+/the/toksencoding
+}
+
+/def/writeletters{
+/def/\##1{/charreplacement/toksv{##1}
+ /iwrite{\catcode`\/the/toksv=11 \lccode`\/the/toksv=`\/the/toksv}
+}
+/the/toksletters
+}
+/catcode`/\=0
+/catcode`//=12
+
+\def\makeletters{
+ \expandafter\catcode\count255=11\relax
+ \advance\count255 1\relax
+ \ifnum\count255<\@@count
+ \expandafter\makeletters
+ \fi
+}
+\def\makeothers{
+ \expandafter\catcode\count255=12\relax
+ \advance\count255 1\relax
+ \ifnum\count255<\@@count
+ \expandafter\makeothers
+ \fi
+}
+
+\def\code{
+\edef\code_percent{\the\catcode`\%}
+\catcode`\%=14
+\catcode`\#=6
+\catcode`\^=7
+\count255='50 \@@count='60
+\makeothers
+\catcode`\_=12
+\catcode`\~=12
+\catcode`\@=12
+\catcode`\!=12
+\catcode`\$=12
+\catcode`\&=12\relax
+}
+\def\endcode{
+\catcode`\#=11
+\catcode`\^=11
+\count255='50 \@@count='60
+\makeletters
+\catcode`\_=11
+\catcode`\~=11
+\catcode`\@=11
+\catcode`\!=11
+\catcode`\$=11
+\catcode`\&=13
+\catcode`\%=\code_percent\relax
+\lee
+}
+
+\let\if@patternscode\iffalse
+\def\patternscode{
+\begin{code}
+\catcode`\$=6
+\catcode`\#=12
+\catcode`\&=12
+\catcode`\,=12
+\let\if@patternscode\iftrue
+}
+\def\endpatternscode{
+\catcode`\,=11
+\catcode`\$=11
+\let\if@patternscode\iffalse
+\endcode
+}
+
+\def\templatedef{\if@patternscode\else\expandafter\patternscode\fi\let\if@patternscode\iffalse\@templatedef}
+\def\@templatedef#1#2{\expandafter\def\csname #1\endcsname{\template{#2}}
+ \expandafter\def\csname end#1\endcsname{\end{template}}
+ \if@patternscode\else\expandafter\endpatternscode\fi}
+
+\def\mkinput#1{\expandafter\lee\input #1 } %we are lucky this works
+\let\~~endinput\endinput
+% ...y la guinda:
+\def\mkendinput{\expandafter\lee} %Expand the end of the file before \lee. It works!
+\def\endinput{\expandafter\mkendinput\~~endinput}
+
+%Esto ya es para el fichero que siga
+\toksletters={}
+\toksencoding={}
+\newcount\c_amp
+
+\catcode`\!=11
+\catcode`\$=11
+\catcode`\&=13
+
+\count255='50 \@@count='60
+\makeletters
+
+\catcode`\[=11 \catcode`\]=11
+\catcode`\|=11
+
+\count255=129 \@@count=256
+\makeletters
+
+\catcode`\^^M=10
+\catcode`\^=11
+\let\~~lee\lee
+\let\lee\relax
+\endinput
diff --git a/Master/texmf-dist/tpm/mkpattern.tpm b/Master/texmf-dist/tpm/mkpattern.tpm
new file mode 100644
index 00000000000..142c49c98ed
--- /dev/null
+++ b/Master/texmf-dist/tpm/mkpattern.tpm
@@ -0,0 +1,28 @@
+<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd">
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/">
+ <rdf:Description about="http://texlive.dante.de/texlive/Package/mkpattern.zip">
+ <TPM:Name>mkpattern</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2007/04/24 00:28:00</TPM:Date>
+ <TPM:Version></TPM:Version>
+ <TPM:Creator>karl</TPM:Creator>
+ <TPM:Title>The mkpattern package.</TPM:Title>
+ <TPM:Description></TPM:Description>
+ <TPM:Author></TPM:Author>
+ <TPM:Size>95465</TPM:Size>
+ <TPM:License></TPM:License>
+ <TPM:Build/>
+ <TPM:RunFiles size="15534">
+texmf-dist/tex/plain/mkpattern/mkpatter.tex
+texmf-dist/tpm/mkpattern.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="80948">
+texmf-dist/doc/plain/mkpattern/README
+texmf-dist/doc/plain/mkpattern/mkpatdoc.tex
+texmf-dist/doc/plain/mkpattern/mkpatter.pdf
+texmf-dist/doc/plain/mkpattern/mkpattern-exmpl.tex
+ </TPM:DocFiles>
+ <TPM:Provides>Package/mkpattern</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
+