summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fmp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-11 23:03:17 +0000
committerKarl Berry <karl@freefriends.org>2006-01-11 23:03:17 +0000
commitecf966f305f6aeff2bbdf42c82d8425921aa9eda (patch)
treedb606a57e3619610e4c35cae849d41cf4e0937d5 /Master/texmf-dist/source/latex/fmp
parentac3c55a3216b5988f0e48ba9414ddb059f19a699 (diff)
source 1
git-svn-id: svn://tug.org/texlive/trunk@105 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fmp')
-rw-r--r--Master/texmf-dist/source/latex/fmp/fmp-doc.hs37
-rw-r--r--Master/texmf-dist/source/latex/fmp/fmp.dtx675
-rw-r--r--Master/texmf-dist/source/latex/fmp/fmp.ins72
3 files changed, 784 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/fmp/fmp-doc.hs b/Master/texmf-dist/source/latex/fmp/fmp-doc.hs
new file mode 100644
index 00000000000..cbece3f2337
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fmp/fmp-doc.hs
@@ -0,0 +1,37 @@
+--
+-- This is file `fmp-doc.hs',
+-- generated with the docstrip utility.
+--
+-- The original source files were:
+--
+-- fmp.dtx (with options: `examples')
+--
+-- Example source code for the FMP package
+--
+module FMPDoc where
+import FMP
+import FMPTree
+
+example1 = binom 5
+ where
+ ce = circle empty
+ binom 0 = node ce []
+ binom n = node ce [edge (binom i)
+ | i <- [(n-1),(n-2)..0]]
+ #setAlign AlignRight
+
+example2 = box (math "U" |||
+ ooalign [toPicture [cArea a 0.7,
+ cArea b 0.7,
+ cArea ab 0.4],
+ bOverA])
+ where
+ cArea a c = toArea a #setColor c
+ bOverA = column [math "B" #setBGColor white,
+ vspace 50,
+ math "A" #setBGColor white]
+ a = transformPath (scaled 30) fullcircle
+ b = transformPath (scaled 30 & shifted (0,-30))
+ fullcircle
+ ab = buildCycle a b
+
diff --git a/Master/texmf-dist/source/latex/fmp/fmp.dtx b/Master/texmf-dist/source/latex/fmp/fmp.dtx
new file mode 100644
index 00000000000..9384c0f008a
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fmp/fmp.dtx
@@ -0,0 +1,675 @@
+% \iffalse meta-comment
+%
+% Copyright 2001 Marco Kuhlmann
+%
+% This program is distributed under the conditions of the
+% LaTeX Project Public License, which can be found in
+% http://www.latex-project.org/lppl.txt
+%
+% This program consists of the files fmp.ins and fmp.dtx
+%
+% \fi
+%
+%
+% \CheckSum{260}
+%
+% \changes{v1.0a}{2001/04/03}{%
+% Initial release.}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \title{Functional {\MP} for {\LaTeX}\thanks{%
+% This file has version number \fileversion.}}
+% \author{Marco Kuhlmann\thanks{%
+% E-Mail: \texttt{marco.kuhlmann@gmx.net}}}
+% \date{\filedate}
+% \maketitle
+%
+%
+% \begin{abstract}
+% Functional {\MP} (\FMP) is a powerful frontend to the {\MP}
+% language. This package adds basic {\FMP} support to {\LaTeX},
+% enabling users to keep {\FMP} source code within their
+% documents and, by a two-run mechanism, including
+% automatically generated {\FMP} figures.
+% \end{abstract}
+%
+%
+% \section{Introduction}
+%
+% Functional {\MP} by Joachim Korittky (\cite{Diplomarbeit}) adds
+% a high-level interface to the {\MP} language (\cite{MetaPost1},
+% \cite{MetaPost2}), enabling the user to program their graphics
+% using the Haskell language. Impressive examples of Functional
+% {\MP} can be found in Korittky's diploma thesis; some of them
+% will be given below. The system and the documentation can be
+% downloaded from
+% \begin{quote}
+% \texttt{http://www.informatik.uni-bonn.de/\~{}ralf/software.html}
+% \end{quote}
+%
+% Using Functional {\MP} as my standard graphics developing tool,
+% I felt a need to write a {\LaTeX} package which smoothly
+% integrates {\FMP} into daily work, similar to the |emp| package
+% by Thorsten Ohl (\cite{EMP}); this is how |fmp| came to being.
+% The earliest version supported only the possibility to
+% automatically produce shell-scripts for graphics generation.
+% Since then, I have added the possibility to encapsulate {\FMP}
+% code -- though I still ask myself if this way of maintaining
+% code is as natural for {\FMP} as it is for pure {\MP} in |emp|.
+%
+% In case you have any questions or comments on this package,
+% feel free to send me an email. May |fmp| help {\FMP} to spread
+% around the world. \texttt{:-)}
+%
+%
+% \subsection{Examples of Functional {\MP}}
+%
+% Before I start to present the |fmp| package, let me first give
+% you two mouth-watering examples of {\FMP} (the Haskell code for
+% them can be found at the end of this document):
+% figure~\ref{figure:example1} gives a binominal tree of
+% rank~$5$, figure~\ref{figure:example2} shows a simple Venn
+% diagram. Among other things, these examples exhibit two
+% features in which {\FMP} is superior to many other graphics
+% drawing packages around:
+% \begin{itemize}
+% \item By embedding {\MP} into the Haskell programming language,
+% {\FMP} gives the user (and especially users who have previous
+% experience in functional programming) a great tool to program
+% graphics on a very high-level level of abstraction. This not
+% only helps you to focus on the logical structure rather than
+% on layout questions, but also is especially important if you
+% want to scale and re-use old material.
+% \item {\FMP} can be easily extended. For example, for
+% figure~\ref{figure:example1}, the core language has been
+% augmented by tree drawing features, using much better
+% algorithms than those of any other tree drawing package
+% around. This is especially good news for computer scientists,
+% who need trees very often, but did not yet have a package to
+% draw them on such a level of abstraction.
+% \end{itemize}
+%
+% \begin{figure}
+% \begin{center}
+% \fmpfigure{example1}
+% \end{center}
+% \caption{A binominal tree of rank~$5$}
+% \label{figure:example1}
+% \end{figure}
+%
+% \begin{figure}
+% \begin{center}
+% \fmpfigure{example2}
+% \end{center}
+% \caption{A Venn diagram (cf.\ figure~22 in \cite{MetaPost2})}
+% \label{figure:example2}
+% \end{figure}
+%
+% To be able to use {\FMP}, you need a Haskell interpreter, such
+% as |hugs|, and the {\MP} program, which should be part of any
+% somewhat complete distribution of {\LaTeX}. Having produced a
+% Haskell source, you feed it into |hugs| and issue the
+% |generate| command provided by {\FMP}. This will translate your
+% code into low-level {\MP} commands, and finally produce a
+% ready-to use PostScript file.
+%
+% \subsection{How this package works}
+%
+% Calling |hugs| and typing in the generation commands is a
+% tedious job if you keep more than but a few illustrations
+% around. This package offers the |\fmpfigure| command, which
+% generates a shell script (at present, this only works for
+% $*$n$*$x), which you then can execute to have all the graphics
+% files generated at once. At the next run of {\LaTeX}, these
+% graphic files will appear at their proper positions. Besides,
+% |fmp| enables you to store Haskell code within a {\LaTeX} file,
+% in case you want to have all the code for one document at one
+% place.
+%
+%
+% \section{Usage}
+%
+% \subsection{Including graphics}
+%
+% \changes{v1.0b}{2001/10/22}{%
+% Documentation: Improvements as suggested by Peter Bartke.}
+% Using \verb|fmp| to include graphics from some {\FMP} source is
+% straightforward. Let us assume that you keep two {\FMP} figures
+% (Haskell values) \verb|example1| and \verb|example2| in a file
+% called \verb|fmp-doc.hs|. A minimal document using the package to
+% include these two figures would then look like this:
+%
+% \medskip\noindent\bgroup\small
+% \verb|\documentclass{article}|\\
+% \verb|\usepackage{fmp}|\\
+% \verb|\fmpsourcefilename{fmp-doc}|\\
+% \verb|\begin{document}|\\
+% \verb|\fmpfigure{example1}|\\
+% \verb|\fmpfigure{example2}|\\
+% \verb|\end{document}|\\
+% \verb|\end{verbatim}|
+% \medskip\par\egroup
+%
+% \DescribeMacro{\fmpfigure} You include a figure into your
+% {\LaTeX} document by using the |\fmpfigure| macro. It takes, as
+% its mandatory argument, the string identifying the figure in
+% the Haskell source, and creates a shell script containing all
+% the |hugs| calls needed for the actual generation. After the
+% shell script has been written, you can execute it and run
+% {\LaTeX} again; if everything went right, the graphics file
+% will appear at the place where you issued the |\fmpfigure|
+% command.
+%
+% \changes{v1.1a}{2001/11/19}{%
+% Documentation: Optional arguments to \cs{fmpfigure} are now
+% passed to the \texttt{graphicx} package.}
+% Any optional arguments to |\fmpfigure| will be passed to the
+% |graphicx| package and interpreted as if they appeared together
+% with a |\includegraphics| command. This allows you to change
+% the visual appearance of the included figure (e.\,g., the size
+% to which the figure shall be scaled). Refer to \cite{graphicx}
+% for more information about possible paramters.
+%
+% \subsection{Including code}
+%
+% \DescribeEnv{fmp} You can also store your {\FMP} code in the same
+% file than your {\LaTeX} source, included within the |fmp|
+% environment. During compilation, the contents of this environment
+% are written to an external file (see below).
+%
+% \subsection{Changing file names}
+%
+% \DescribeMacro{\fmpsourcefilename}
+% \DescribeMacro{\fmpscriptfilename}
+% \DescribeMacro{\fmpfigurebasename}
+% You can control the names of three different files:
+% \begin{itemize}
+% \item the Haskell source (|\fmpsourcefilename|, defaults to
+% \meta{jobname}|.hs|),
+% \item the shell script (|\fmpscriptfilename|, defaults to
+% |fmpgenerate.sh|) and
+% \item the graphics file base name (|\fmpfigurebasename|,
+% defaults to |fmpfigure|), which is the base file name of the
+% graphics files that will be generated by |hugs|. (An index
+% number specifying their order in the document will be
+% appended to this name.)
+% \end{itemize}
+% You can modify all three file names by calling the respective
+% macros, each of which takes the new name as its argument.
+%
+% \subsection{Preamble and postamble}
+%
+% \DescribeMacro{\fmpsourcepreamble}
+% \DescribeMacro{\fmpaddtosourcepreamble}
+% \DescribeMacro{\fmpscriptpreamble}
+% \DescribeMacro{\fmpaddtoscriptpreamble}
+% \DescribeMacro{\fmpsourcepostamble}
+% \DescribeMacro{\fmpaddtosourcepostamble}
+% \DescribeMacro{\fmpscriptpostamble}
+% \DescribeMacro{\fmpaddtoscriptpostamble}
+% Before something is written to the source file or the shell
+% script file, the package will output a \emph{preamble} to that
+% file. The source code preamble could contain everything from
+% comments to Haskell module identifications and basic imports,
+% while the shell script preamble should probably contain the
+% line that calls |hugs| and tells it to input the rest of the
+% file as comment. Have a sample run to see the default contents
+% of the preamble. If you wish to change the text: you can set a
+% new preamble by the |\fmpsourcepreamble| command, and you can
+% append a new line to the current preamble calling
+% |\fmpaddtosourcepreamble|. (Similar commands are available for
+% the shell script preamble.) There is also a postamble, which is
+% written as the very last thing to the source code or shell
+% script.
+%
+% \MP\ uses the environment variable \verb|$TEX| to determine which
+% \TeX\ it has to call when generating labels etc. On many systems,
+% this variable defaults to \verb|tex|, which is certainly not what
+% you want in conjunction with \verb|fmp|. One common usage for the
+% preamble therefore is to include a line like
+% \verb|export TEX=latex| (or something similar, depending on your
+% shell) into the generation script.
+%
+% \subsection{Graphics file formats}
+%
+% The |graphicx| package is used to handle the inclusion of
+% generated {\FMP} figures. If |fmp| is called from within
+% |pdflatex|, |graphicx| is loaded with the |pdftex| driver
+% option. In this case, the fall-back behaviour when
+% encountering an |\fmpfigure| command is to read the
+% corresponding graphics file as |mps| ({\MP} output); it will
+% then internally be converted to \textsc{pdf} by |graphicx|.
+% When called from within normal |latex|, graphics files are
+% handled as |eps| (encapsulated PostScript). You probably need
+% to load a specific PostScript driver for |graphicx| in this
+% case -- do so by supplying |fmp| with the same package option
+% that you would use for |graphicx| (see the |graphicx| user
+% manual for further information on that).
+%
+%
+% \subsection*{Acknowledgements}
+%
+% The help of Ralf Hinze and the suggestions of Peter Bartke and
+% Ferenc Wagner are gratefully acknowledged.
+%
+%
+% \section*{Source code for the examples}
+%
+% \verbatiminput{fmp-doc.hs}
+%
+%
+% \StopEventually{%
+% \begin{thebibliography}{XXX99}
+% \bibitem[Hob89]{MetaPost1}
+% \textsc{John D.\ Hobby:}
+% \emph{A {\MF}-like System with PostScript Output.}
+% TUGboat vol.~10, no.~2, pp.\ 505--512, 1989
+% \bibitem[Hob92]{MetaPost2}
+% \textsc{John D.\ Hobby:}
+% \emph{A User's manual for {\MP}.}
+% Computing Science Technical Report no.~162, AT\&T Bell
+% Laboratories, Murray Hill, New Jersey, 1992
+% \bibitem[Kor98]{Diplomarbeit}
+% \textsc{Joachim Korittky:}
+% \emph{functional {\MP}. Eine Beschreibungsspra\-che
+% f\"ur Grafiken.}
+% Diplomarbeit an der Rheinischen
+% Friedrich-Wilhelms-Universit\"at Bonn, 1998
+% \bibitem[Ohl97]{EMP}
+% \textsc{Thorsten Ohl:}
+% \emph{EMP: Encapsulated {\MP} for {\LaTeX}.}
+% Technische Hochschule Darmstadt, 1998
+% \bibitem[Car99]{graphicx}
+% \changes{v1.1a}{2001/11/19}{%
+% Added to bibliography: Reference to \texttt{graphicx}
+% package user documentation.}
+% \textsc{David Carlisle:}
+% \emph{Packages in the `graphics' bundle.}
+% User documentation, 1999
+% \end{thebibliography}}
+%
+%
+% \section{The Documentation Driver File}
+%
+% \begin{macrocode}
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{fmp}
+\usepackage{mflogo}
+\OnlyDescription
+\GetFileInfo{fmp.sty}
+\newcommand*{\FMP}{\textsc{fmp}}
+\fmpsourcefilename{fmp-doc}
+\setcounter{topnumber}{1}
+\makeatletter
+\let\verbatim@oldfont=\verbatim@font
+\def\verbatim@font{\small\verbatim@oldfont}
+\makeatother
+\tolerance=2000
+\emergencystretch=20pt
+\RecordChanges
+\begin{document}
+\DocInput{fmp.dtx}
+\PrintChanges
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+%
+% \section{The Implementation}
+%
+% \subsection{Setup}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% We start with the usual identification procedure. All the
+% options that |fmp| cannot cater for itself are passed to the
+% |graphicx| package, as they probably are requests for special
+% PostScript drivers (see above).
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1995/05/16]
+\ProvidesPackage{fmp}
+[2001/11/19 v1.1a Support for Functional MetaPost]
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}
+\ProcessOptions
+% \end{macrocode}
+%
+% Depending on whether or not |fmp| is called from within
+% |pdflatex|, the |graphicx| package has to be loaded with or
+% without the |pdftex| option. A fall-back rule is declared for
+% |\includegraphics| commands.
+% \begin{macrocode}
+\@ifundefined{pdfoutput}{%
+ \RequirePackage{graphicx}[1999/02/16]%
+ \DeclareGraphicsRule{*}{eps}{*}{}}{%
+ \RequirePackage[pdftex]{graphicx}[1994/12/15]%
+ \DeclareGraphicsRule{*}{mps}{*}{}}
+% \end{macrocode}
+%
+% The |verbatim| package is used for writing the contents of the
+% |fmp| environment (see below) into a file.
+% \begin{macrocode}
+\RequirePackage{verbatim}
+% \end{macrocode}
+%
+% We set up new streams |\fmp@sourceout| and |\fmp@scriptout| for
+% the Haskell source and the shell script to be written, as well
+% as conditionals to remember whether or not we have already
+% opened these streams.
+% \begin{macrocode}
+\newwrite\fmp@sourceout
+\newwrite\fmp@scriptout
+\newif\iffmp@sourceio
+\fmp@sourceiofalse
+\newif\iffmp@scriptio
+\fmp@scriptiofalse
+% \end{macrocode}
+%
+% Finally, we need a counter for the figures that we want to
+% generate.
+% \begin{macrocode}
+\newcounter{fmpfigure}
+% \end{macrocode}
+%
+% \subsection{Writing the source code}
+%
+% \begin{environment}{fmp}
+% The |fmp| environment writes its contents into the
+% |\fmp@sourceout| stream. This is done in an almost
+% ``classical'' way, employing the |verbatim| package.
+% \begin{macrocode}
+\newenvironment*{fmp}{}{}
+\def\fmp{%
+ \begingroup
+ \@bsphack
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active
+ \def\verbatim@processline{\fmp@sourcewrite{\the\verbatim@line}}%
+ \verbatim@start}
+\def\endfmp{%
+ \@esphack
+ \endgroup}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\fmp@sourcewrite}
+% This is the wrapper used for writing to the source file. Every
+% time it is called, it checks whether or not the
+% |\fmp@sourceout| stream has already been opened. If not, it
+% calls |\fmp@sourceopen| to do so. (I do so because I want to
+% avoid situations like in the |emp| package, where the outstream
+% is opened and a file is created, even when at the end nothing
+% is written to it. Is this too expensive?)
+% \begin{macrocode}
+\def\fmp@sourcewrite#1{%
+ \iffmp@sourceio \else \global\fmp@sourceiotrue\fmp@sourceopen \fi%
+ \immediate\write\fmp@sourceout{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@sourceopen}
+% Opens the output stream for the source file and writes the
+% preamble.
+% \begin{macrocode}
+\def\fmp@sourceopen{%
+ \immediate\openout\fmp@sourceout\fmp@sourcefilename%
+ \edef\@tempa{\the\fmp@sourcepreamble}%
+ \immediate\write\fmp@sourceout{\@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmpsourcefilename}
+% \begin{macro}{\fmp@sourcefilename}
+% Set the filename of the source file.
+% \begin{macrocode}
+\newcommand*{\fmpsourcefilename}[1]{%
+ \gdef\fmp@sourcefilename{#1}}
+\@onlypreamble{\fmpsourcefilename}
+\def\fmp@sourcefilename{\jobname.hs}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fmp@sourcepreamble}
+% \begin{macro}{\fmpsourcepreamble}
+% \begin{macro}{\fmpaddtosourcepreamble}
+% Sets up the preamble for the source file, as well as macros to
+% reset them or append new lines to it.
+% \begin{macrocode}
+\newtoks\fmp@sourcepreamble
+\newcommand*{\fmpsourcepreamble}[1]{%
+ \global\fmp@sourcepreamble={#1}}
+\@onlypreamble{\fmpsourcepreamble}
+\newcommand*{\fmpaddtosourcepreamble}[1]{%
+ \fmp@sourcepreamble=\expandafter{\the\fmp@sourcepreamble#1}}
+\@onlypreamble{\fmpaddtosourcepreamble}
+\fmp@sourcepreamble={-- This is file `\fmp@sourcefilename',
+ created automatically. Do not edit!^^J}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fmp@sourceclose}
+% This is added to \LaTeX's |\@enddocumenthook|. It writes the
+% postamble to the source file and closes the output stream.
+% \begin{macrocode}
+\def\fmp@sourceclose{%
+ \iffmp@sourceio
+ \edef\@tempa{\the\fmp@sourcepostamble}%
+ \fmp@sourcewrite{\@tempa}%
+ \immediate\closeout\fmp@sourceout
+ \fi}
+\AtEndDocument{\fmp@sourceclose}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@sourcepostamble}
+% \begin{macro}{\fmpsourcepostamble}
+% \begin{macro}{\fmpaddtosourcepostamble}
+% Sets up the postamble for the source file, as well as macros to
+% reset and update it.
+% \begin{macrocode}
+\newtoks\fmp@sourcepostamble
+\newcommand*{\fmpsourcepostamble}[1]{%
+ \global\fmp@sourcepostamble={#1}}
+\@onlypreamble{\fmpsourcepostamble}
+\newcommand*{\fmpaddtosourcepostamble}[1]{%
+ \fmp@sourcepostamble=\expandafter{\the\fmp@sourcepostamble#1}}
+\@onlypreamble{\fmpaddtosourcepostamble}
+\fmp@sourcepostamble={^^J-- End of file `\fmp@sourcefilename'}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Writing the shell script}
+%
+% \begin{macro}{\fmpfigure}
+% \changes{v1.1a}{2001/11/19}{%
+% Pass through optional arguments to the \texttt{graphicx}
+% package, as suggested by Ferenc Wagner.}
+% Writes a new line to the |\fmp@scriptout| stream, which is
+% connected to the generation shell script file, telling |hugs|
+% to generate a graphics file with the name specified. Any
+% optional argument is passed to the |graphicx| package.
+% \begin{macrocode}
+\newcommand*{\fmpfigure}[2][]{%
+ \fmp@scriptwrite{%
+ generate "\fmp@figurebasename" \thefmpfigure\space #2}%
+ \fmp@includegraphics{#1}{\fmp@figurebasename}{\thefmpfigure}%
+ \refstepcounter{fmpfigure}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@scriptwrite}
+% Wrapper for writing to the shell script file.
+% \begin{macrocode}
+\def\fmp@scriptwrite#1{%
+ \iffmp@scriptio \else \global\fmp@scriptiotrue\fmp@scriptopen \fi%
+ \immediate\write\fmp@scriptout{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@scriptopen}
+% Opens the output stream for the shell script file and writes
+% the preamble.
+% \begin{macrocode}
+\def\fmp@scriptopen{%
+ \immediate\openout\fmp@scriptout\fmp@scriptfilename%
+ \edef\@tempa{\the\fmp@scriptpreamble}%
+ \immediate\write\fmp@scriptout{\@tempa}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@scriptpreamble}
+% \begin{macro}{\fmpscriptpreamble}
+% \begin{macro}{\fmpaddtoscriptpreamble}
+% Set up the preamble for the shell script file as well as macros
+% to reset and append information to it.
+% \begin{macrocode}
+\newtoks\fmp@scriptpreamble
+\newcommand*{\fmpscriptpreamble}[1]{%
+ \global\fmp@scriptpreamble={#1}}
+\@onlypreamble{\fmpscriptpreamble}
+\newcommand*{\fmpaddtoscriptpreamble}[1]{%
+ \fmp@scriptpreamble=\expandafter{\the\fmp@scriptpreamble#1}}
+\@onlypreamble{\fmpaddtoscriptpreamble}
+\fmp@scriptpreamble={hugs \fmp@sourcefilename\space <<!}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fmpscriptfilename}
+% \begin{macro}{\fmp@scriptfilename}
+% This sets the filename of the shell script which can be used
+% for generation.
+% \begin{macrocode}
+\newcommand*{\fmpscriptfilename}[1]{%
+ \gdef\fmp@scriptfilename{#1}}
+\@onlypreamble{\fmpscriptfilename}
+\def\fmp@scriptfilename{fmpgenerate.sh}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fmpfigurebasename}
+% \begin{macro}{\fmp@figurebasename}
+% This sets the base name for the graphics files that will be
+% created by |hugs|.
+% \begin{macrocode}
+\newcommand*{\fmpfigurebasename}[1]{%
+ \gdef\fmp@figurebasename{#1}}
+\@onlypreamble{\fmpfigurebasename}
+\def\fmp@figurebasename{fmpfigure}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\fmp@includegraphics}
+% \changes{v1.1a}{2001/11/19}{%
+% Pass through optional arguments to the \texttt{graphicx}
+% package, as suggested by Ferenc Wagner.}
+% This is a wrapper for the |\includegraphics| command. If the
+% |graphicx| package has been loaded correctly, it should be able
+% to import the graphics file, either directly in |eps| format,
+% or after a transformation to |pdf| by the Con{\TeX}t macros
+% included in the |pdftex| driver.
+% \begin{macrocode}
+\def\fmp@includegraphics#1#2#3{%
+ \leavevmode
+ \IfFileExists{#2.#3}%
+ {\includegraphics[#1]{#2.#3}}%
+ {\typeout{fmp: Could not find file #2.#3}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@scriptclose}
+% Write the shell script postamble and close the output stream.
+% \begin{macrocode}
+\def\fmp@scriptclose{%
+ \iffmp@scriptio
+ \edef\@tempa{\the\fmp@scriptpostamble}%
+ \fmp@scriptwrite{\@tempa}%
+ \immediate\closeout\fmp@scriptout
+ \fi}
+\AtEndDocument{\fmp@scriptclose}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\fmp@scriptpostamble}
+% \begin{macro}{\fmpscriptpostamble}
+% \begin{macro}{\fmpaddtoscriptpostamble}
+% Set up the postamble for the shell script file as well as macros
+% to reset and append information to it.
+% \begin{macrocode}
+\newtoks\fmp@scriptpostamble
+\newcommand*{\fmpscriptpostamble}[1]{%
+ \global\fmp@scriptpostamble={#1}}
+\@onlypreamble{\fmpscriptpostamble}
+\newcommand*{\fmpaddtoscriptpostamble}[1]{%
+ \fmp@scriptpostamble=\expandafter{\the\fmp@scriptpostamble#1}}
+\@onlypreamble{\fmpaddtoscriptpostamble}
+\fmp@scriptpostamble={:quit}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+%
+% \Finale
+%
+%
+%<*examples>
+module FMPDoc where
+import FMP
+import FMPTree
+
+example1 = binom 5
+ where
+ ce = circle empty
+ binom 0 = node ce []
+ binom n = node ce [edge (binom i)
+ | i <- [(n-1),(n-2)..0]]
+ #setAlign AlignRight
+
+example2 = box (math "U" |||
+ ooalign [toPicture [cArea a 0.7,
+ cArea b 0.7,
+ cArea ab 0.4],
+ bOverA])
+ where
+ cArea a c = toArea a #setColor c
+ bOverA = column [math "B" #setBGColor white,
+ vspace 50,
+ math "A" #setBGColor white]
+ a = transformPath (scaled 30) fullcircle
+ b = transformPath (scaled 30 & shifted (0,-30))
+ fullcircle
+ ab = buildCycle a b
+%</examples>
+
+
+
diff --git a/Master/texmf-dist/source/latex/fmp/fmp.ins b/Master/texmf-dist/source/latex/fmp/fmp.ins
new file mode 100644
index 00000000000..b2bbf98bb42
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fmp/fmp.ins
@@ -0,0 +1,72 @@
+%
+% fmp.ins
+%
+% Copyright 2001 Marco Kuhlmann
+%
+% This program is distributed under the conditions of the
+% LaTeX Project Public License, which can be found in
+% http://www.latex-project.org/lppl.txt
+%
+% This program consists of the files fmp.ins and fmp.dtx
+%
+
+\input docstrip
+\keepsilent
+
+% Produce documentation
+
+\preamble
+
+Copyright 2001 Marco Kuhlmann
+
+This program may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version
+1.2 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.2 or later is part of all distributions of LaTeX
+version 1999/12/01 or later.
+
+This program consists of the files fmp.ins and fmp.dtx
+
+\endpreamble
+
+\generate{\file{fmp.sty}{\from{fmp.dtx}{package}}}
+
+\def\MetaPrefix{--}
+
+% Produce example source code
+
+\preamble
+
+Example source code for the FMP package
+
+\endpreamble
+
+\nopostamble
+
+\generate{\file{fmp-doc.hs}{\from{fmp.dtx}{examples}}}
+
+% That's all, folks!
+
+\Msg{*****************************************************************}
+\Msg{*}
+\Msg{* To complete the installation, move `fmp.sty' to a place where}
+\Msg{* LaTeX can find it.}
+\Msg{*}
+\Msg{* To produce the documentation run}
+\Msg{* - latex fmp.dtx}
+\Msg{* - makeindex -s gglo.ist -o fmp.gls fmp.glo}
+\Msg{* - sh fmpgenerate.sh}
+\Msg{* - latex fmp.dtx}
+\Msg{*}
+\Msg{* (This assumes that you have the hugs Haskell compiler installed}
+\Msg{* and a working version of Functional MetaPost running.)}
+\Msg{*}
+\Msg{* Happy FMPing!}
+\Msg{*}
+\Msg{*****************************************************************}
+
+\endbatchfile