summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2006-10-12 01:40:37 +0000
committerNorbert Preining <preining@logic.at>2006-10-12 01:40:37 +0000
commita3e5f4189a145472017be9745847e9d05ebbc0a0 (patch)
treeabbb504a0ce2402455d54547f127c93a57a9b3fc /Master/texmf-dist
parent9078ab149a4827ec032de77b4d8b4ff8f48f4628 (diff)
add algorithmicx to ctan2tl (MAKEnosymlink), add algorithmicx to tpm-ctan-check,
update algorithmicx git-svn-id: svn://tug.org/texlive/trunk@2311 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/algorithmicx/README4
-rw-r--r--Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.pdfbin201459 -> 196147 bytes
-rw-r--r--Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.tex615
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algc.sty41
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algcompatible.sty89
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty15
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty636
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algpascal.sty37
-rw-r--r--Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty98
-rw-r--r--Master/texmf-dist/tpm/algorithmicx.tpm10
10 files changed, 1003 insertions, 542 deletions
diff --git a/Master/texmf-dist/doc/latex/algorithmicx/README b/Master/texmf-dist/doc/latex/algorithmicx/README
new file mode 100644
index 00000000000..97b93dc13cd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/algorithmicx/README
@@ -0,0 +1,4 @@
+This package provides many possibilities to customize the layout of algorithms.
+You can use one of the predefined layouts (pseudocode, pascal,
+c, and others), with or without modifications, or you can define a
+completely new layout for your specific needs. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.pdf b/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.pdf
index 9e837c377c0..a142d0135f8 100644
--- a/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.pdf
+++ b/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.tex b/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.tex
index c04febbb9e1..a92c017f7ae 100644
--- a/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.tex
+++ b/Master/texmf-dist/doc/latex/algorithmicx/algorithmicx.tex
@@ -1,25 +1,23 @@
\documentclass{article}
\usepackage{algorithmicx}
\usepackage[ruled]{algorithm}
-\usepackage[noset]{algpseudocode}
-\usepackage[noset]{algpascal}
-\usepackage[noset]{algc}
-
+\usepackage{algpseudocode}
+\usepackage{algpascal}
+\usepackage{algc}
+%\algdisablelines
\newcommand{\alg}{\texttt{algorithmicx}}
\newcommand{\old}{\texttt{algorithmic}}
\newcommand{\euk}{Euclid}
-\newenvironment{alginc}[1][pseudocode]{\medskip\algsetlanguage{#1}\begin{algorithmic}[1]}{\end{algorithmic}\medskip}
-\newenvironment{algi}[1][pseudocode]{\algsetlanguage{#1}\begin{algorithmic}[1]}{\end{algorithmic}}
-\newcommand\ASTART{\bigskip\noindent\begin{minipage}[c]{0.5\linewidth}}
-\newcommand\ACONTINUE{\end{minipage}\begin{minipage}[c]{0.5\linewidth}}
+\newcommand\ASTART{\bigskip\noindent\begin{minipage}[b]{0.5\linewidth}}
+\newcommand\ACONTINUE{\end{minipage}\begin{minipage}[b]{0.5\linewidth}}
\newcommand\AENDSKIP{\end{minipage}\bigskip}
\newcommand\AEND{\end{minipage}}
-\title{The \alg\ package\footnote{This is the documentation for the version 1.1
+\title{The \alg\ package\footnote{This is the documentation for the version 1.2
of the package. This package is released under LPPL.}}
\author{Sz\'asz J\'anos\\szaszjanos@users.sourceforge.net}
@@ -39,12 +37,12 @@ completely new layout for your specific needs.
\section{Introduction}
-All this begun in my last year at the university. The only thing that I knew of
+All this has begun in my last year at the university. The only thing that I knew of
\LaTeX\ was that it exists, and that it is ``good''. I started using it, but I needed to typeset some
-algorithms. So I begun searching for a good algorithmic style, and I found the \old\ package.
+algorithms. So I begun searching for a good algorithmic style, and I have found the \old\ package.
It was a great joy for me, and I started to use it\dots\
Well\dots\ Everything went nice, until I needed some block that wasn't defined in there. What to do?
-I wasn't a \LaTeX\ guru, in fact I only knew the few basic macros. But there was no other way, so I opened
+I was no \LaTeX\ guru, in fact I only knew the few basic macros. But there was no other way, so I opened
the style file, and I copied one existing block, renamed a few things, and voil\`a! This (and some other
small changes) where enough for me\dots
@@ -52,7 +50,7 @@ One year later --- for one good soul --- I had to make some really big changes o
a sunny day came the idea. What if I would write some macros to let others create blocks automatically?
And so I did! Since then the style was completely rewritten\dots\ several times\dots
-I had fun writing it, may you have fun using it! I am still not a \LaTeX\ guru, so if you are, and you find
+I had fun writing it, may you have fun using it! I am still no \LaTeX\ guru, so if you are, and you find
something really ugly in the style, please mail me! All ideas for improvements are welcome!
Thanks go to Benedek Zsuzsa, Ionescu Clara, Sz\H ocs Zolt\'an, Cseke Botond, Kanoc
@@ -62,73 +60,81 @@ and many-many others. Without them I would have never started or continued \text
-\section{The predefined layouts}
+\section{General informations}
+
+\subsection{The package}
The package \textbf{algorithmicx} itself doesn't define any algorithmic commands, but gives
-a set of macros to define such a command set. So you may use \textbf{algorithmicx}, and define
-the commands yourself, or use one of the predefined command sets.
+a set of macros to define such a command set. You may use only \textbf{algorithmicx}, and define
+the commands yourself, or you may use one of the predefined command sets.
-The following predefined command sets (layouts) are available:
+These predefined command sets (layouts) are:
\begin{description}
\item[algpseudocode] has the same look\footnote{almost :-)} as the one defined in the
\old\ package. The main difference is that while the \old\ package doesn't
allow you to modify predefined structures, or to create new ones, the \alg\
package gives you full control over the definitions (ok, there are some
limitations --- you can not send mail with a, say, \verb:\For: command).
+\item[algcompatible] is fully compatible with the \old\ package, it should be
+used only in old documents.
\item[algpascal] aims to create a formatted pascal program, it performs
automatic indentation (!), so you can transform a pascal program into an
\textbf{algpascal} algorithm description with some basic substitution rules.
-\item[algc] yeah, just like the \textbf{algpascal}\dots\ but for C\dots\
+\item[algc] -- yeah, just like the \textbf{algpascal}\dots\ but for c\dots\
This layout is incomplete.
\end{description}
+To create floating algorithms you will need \verb:algorithm.sty:. This file may or may not be
+included in the \alg\ package. You can find it on CTAN, in the \old\ package.
+
-\subsection{General informations}
+\subsection{The algorithmic block}
Each algorithm begins with the \verb:\begin{algorithmic}[lines]: command, the
optional \verb:lines: controls the line numbering: $0$ means no line numbering,
$1$ means number every line, and $n$ means number lines $n$, $2n$, $3n$\dots\ until the
-\verb:\end{algorithmic}: command, which ends the algorithm.
+\verb:\end{algorithmic}: command, witch ends the algorithm.
-\subsubsection{Simple lines}
-A simple line of text begins with \verb:\State:. This macro marks the begining of every
+
+\subsection{Simple lines}
+
+A simple line of text is beginned with \verb:\State:. This macro marks the begin of every
line. You don't need to use \verb:\State: before a command defined in the package, since
these commands use automatically a new line.
-To create a line that is not numbered, and not counted when numbering lines
+To obtain a line that is not numbered, and not counted when counting the lines for line numbering
(in case you choose to number lines), use the \verb:Statex: macro. This macro jumps into a new line,
the line gets no number, and any label will point to the previous numbered line.
-We will call \textit{statement\/}s the lines starting with \verb:\State:. The \verb:\Statex:
-lines are not statements.
+We will call \textit{statament\/}s the lines starting with \verb:\State:. The \verb:\Statex:
+lines are not stataments.
-\subsubsection{Placing comments in sources}\label{Putting comments in sources}
+\subsection{Placing comments in sources}\label{Putting comments in sources}
Comments may be placed everywhere in the source using the \verb:\Comment: macro
-(there are no limitations like those in the \old\ package), so feel the freedom!
-If you would like to change the form in which comments are displayed, just
+(there are no limitations like those in the \old\ package), feel the freedom!
+If you would like to change the form in witch comments are displayed, just
change the \verb:\algorithmiccomment: macro:
\begin{verbatim}
-\renewcommand{\algorithmiccomment}[1]{\hskip 3em$\rightarrow$ #1}
+\algrenewcommand{\algorithmiccomment}[1]{\hskip3em$\rightarrow$ #1}
\end{verbatim}
will result:
-{
-\begin{alginc}
-\renewcommand{\algorithmiccomment}[1]{\hskip 3em$\rightarrow$ #1}
+\medskip
+\begin{algorithmic}[1]
+\algrenewcommand{\algorithmiccomment}[1]{\hskip3em$\rightarrow$ #1}
\State $x\gets x+1$\Comment{Here is the new comment}
-\end{alginc}
-}
+\end{algorithmic}
-\subsubsection{Labels and references}
-Use the \verb:\label: macro, as usual, to label a line. When you use \verb:\ref: to reference
-the line, the \verb:\ref: will be substituted with the corresponding line number. When using the
-\textbf{algorithmicx} package together with the \textbf{algorithm} package, then you can label
+\subsection{Labels and references}
+Use the \verb:\label: macro, as usual to label a line. When you use \verb:\ref: to reference
+the line, the \verb:\ref: will be subtitued with the corresponding line number. When using the
+\textbf{algorithmicx} package togedher with the \textbf{algorithm} package, then you can label
both the algorithm and the line, and use the \verb:\algref: macro to reference a given line
from a given algorithm:
@@ -149,15 +155,42 @@ The \textbf{while} in algorithm \ref{euclid} ends in line \ref{euclidendwhile},
so \algref{euclid}{euclidendwhile} is the line we seek.
\end{minipage}
+\subsection{Breaking up long algorithms}
+
+Sometimes you have a long algorithm that needs to be broken into parts, each on a
+separate float. For this you can use the following:
+
+\begin{description}
+\item[]\verb:\algstore{<savename>}: saves the line number, indentation, open blocks of
+the current algorithm and closes all blocks. If used, then this must be the last command
+before closing the algorithmic block. Each saved algorithm must be continued later in the
+document.
+\item[]\verb:\algstore*{<savename>}: Like the above, but the algorithm must not be continued.
+\item[]\verb:\algrestore{<savename>}: restores the state of the algorithm saved under
+\verb:<savename>: in this algorithmic block. If used, then this must be the first command
+in an algorithmic block. A save is deleted while restoring.
+\item[]\verb:\algrestore*{<savename>}: Like the above, but the save will not be deleted, so it
+can be restored again.
+\end{description}
+
+See example in the \textbf{Examples} section.
+\subsection{Multiple layouts in the same document}
+You can load multiple algorithmicx layouts in the same document. You can switch between the layouts
+using the \verb:\alglanguage{<layoutname>}: command. After this command all new algorithmic
+environments will use the given layout until the layout is changed again.
+
+
+
+
+\section{The predefined layouts}
\subsection{The \textbf{algpseudocode} layout}\label{algpseudocode}
+\alglanguage{pseudocode}
If you are familiar with the \old\ package, then you'll find it easy to
-switch, and you have good chances to use previously written algorithms
-without changing them (some comments needs to be placed to their right
-place, but you will be happy to have them there). You only need to read the
-section \ref{Putting comments in sources} and \ref{algpseudocode package options}.
+switch. You can use the old algorithms with the \textbf{algcompatible} layout, but please
+use the \textbf{algpseudocode} layout for new algorithms.
To use \textbf{algpseudocode}, simply load \verb:algpseudocode.sty::
@@ -168,11 +201,12 @@ To use \textbf{algpseudocode}, simply load \verb:algpseudocode.sty::
You don't need to manually load the \textbf{algorithmicx} package, as this is done by
\textbf{algpseudocode}.
-Let's see for example the well known \textit{\euk's algorithm} (ok, an improved version):
-{
+The first algorithm one should write is the first algorithm ever (ok,
+an improved version), \textit{\euk's algorithm}:
+
\begin{algorithm}[H]
\caption{\euk's algorithm}\label{euclid}
-\begin{alginc}
+\begin{algorithmic}[1]
\Procedure{\euk}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
@@ -180,11 +214,11 @@ Let's see for example the well known \textit{\euk's algorithm} (ok, an improved
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
- \State \Return $b$\Comment{The g.c.d. is b}
+ \State \Return $b$\Comment{The gcd is b}
\EndProcedure
-\end{alginc}
+\end{algorithmic}
\end{algorithm}
-}
+
Created with the following source:
\begin{verbatim}
@@ -198,7 +232,7 @@ Created with the following source:
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
- \State \textbf{return} $b$\Comment{The g.c.d. is b}
+ \State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}
@@ -220,13 +254,12 @@ The indentation of the source doesn't matter, so
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Repeat
\Comment{forever}
\State this\Until{you die.}
-\end{algi}
-}
+\Statex
+\end{algorithmic}
\AENDSKIP
But, generally, it is a good idea to keep the source indented, since you will find
@@ -235,20 +268,20 @@ errors much easier. And your tex file looks better!
All examples and syntax descriptions will be shown as the previous
example --- the left side shows the \LaTeX\ input, and the right side
the algorithm, as it appears in your document. I'm cheating! Don't look
-in the \verb:tex: file! Believe what the examples state! I'm using some
-undocumented and dirty stuff to create all these examples. You may be more
+in the \verb:algorithmicx.tex: file! Believe what the examples state! I may use some
+undocumented and dirty stuff to create all these examples. You might be more
confused after opening \verb:algorithmicx.tex: as you was before.
In the case of syntax
-descriptions the text between "$<$" and "$>$" is symbolic, so if you type
+descriptions the text between $<$ and $>$ is symbolic, so if you type
what you see on the left side, you will not get the algorithm on the
-right side. But if you replace the text enclosed between "$<$" and "$>$" with a proper piece of
-algorithm, then you will get what you probably want. The parts between
-"$[$" and "$]$" are optional.
+right side. But if you replace the text between $<$ $>$ with a proper piece of
+algorithm, then you will probably get what you want. The parts between
+$[$ and $]$ are optional.
\subsubsection{The \textbf{for} block}
-The \textbf{for} block has the following syntax:
+The \textbf{for} block may have one of the forms:
\ASTART
\begin{verbatim}
@@ -257,13 +290,11 @@ The \textbf{for} block has the following syntax:
\EndFor
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\For{$<$text$>$}
\State $<$body$>$
\EndFor
-\end{algi}
-}
+\end{algorithmic}
\AEND
\ASTART
@@ -273,12 +304,11 @@ The \textbf{for} block has the following syntax:
\EndFor
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\ForAll{$<$text$>$}
\State $<$body$>$
\EndFor
-\end{algi}}
+\end{algorithmic}
\AENDSKIP
\noindent Example:
@@ -293,14 +323,13 @@ The \textbf{for} block has the following syntax:
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\State $sum\gets 0$
\For{$i\gets 1, n$}
\State $sum\gets sum+i$
\EndFor
-\end{algi}
-}
+\Statex
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{while} block}
@@ -313,13 +342,11 @@ The \textbf{while} block has the form:
\EndWhile
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\While{$<$text$>$}
\State $<$body$>$
\EndWhile
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
\noindent Example:
@@ -336,8 +363,6 @@ The \textbf{while} block has the form:
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\algsetlanguage{pseudocode}
\begin{algorithmic}[1]
\State $sum\gets 0$
\State $i\gets 1$
@@ -345,8 +370,8 @@ The \textbf{while} block has the form:
\State $sum\gets sum+i$
\State $i\gets i+1$
\EndWhile
+\Statex
\end{algorithmic}
-}
\AEND
\subsubsection{The \textbf{repeat} block}
@@ -359,13 +384,11 @@ The \textbf{repeat} block has the form:
\Until{<text>}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Repeat
\State $<$body$>$
\Until{$<$text$>$}
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
\noindent Example:
@@ -382,16 +405,15 @@ The \textbf{repeat} block has the form:
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\State $sum\gets 0$
\State $i\gets 1$
\Repeat
\State $sum\gets sum+i$
\State $i\gets i+1$
\Until{$i>n$}
-\end{algi}
-}
+\Statex
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{if} block}
@@ -413,22 +435,20 @@ The \textbf{if} block has the form:
\EndIf
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\If{$<$text$>$}
\State $<$body$>$
-\Statex \hskip-2\algorithmicindent[
+\Statex [
\ElsIf{$<$text$>$}
\State $<$body$>$
-\Statex \hskip-2\algorithmicindent...
-\Statex \hskip-2\algorithmicindent]
-\Statex \hskip-2\algorithmicindent[
+\Statex \dots
+\Statex ]
+\Statex [
\Else
\State $<$body$>$
-\Statex \hskip-2\algorithmicindent]
+\Statex ]
\EndIf
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
\noindent Example:
@@ -450,8 +470,7 @@ The \textbf{if} block has the form:
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\If{$quality\ge 9$}
\State $a\gets perfect$
\ElsIf{$quality\ge 7$}
@@ -463,8 +482,8 @@ The \textbf{if} block has the form:
\Else
\State $a\gets unusable$
\EndIf
-\end{algi}
-}
+\Statex
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{procedure} block}
@@ -477,13 +496,11 @@ The \textbf{procedure} block has the form:
\EndProcedure
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Procedure{$<$name$>$}{$<$params$>$}
\State $<$body$>$
\EndProcedure
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
\noindent Example: See \euk's\ algorithm on page \pageref{euclid}.
@@ -498,13 +515,11 @@ The \textbf{procedure} block has the form:
\EndFunction
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Function{$<$name$>$}{$<$params$>$}
\State $<$body$>$
\EndFunction
-\end{algi}
-}
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{loop} block}
@@ -517,32 +532,34 @@ The \textbf{loop} block has the form:
\EndLoop
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Loop
\State $<$body$>$
\EndLoop
-\end{algi}
-}
+\end{algorithmic}
\AEND
-\subsubsection{\textbf{Require} and \textbf{Ensure}}
+\subsubsection{Other commands in this layout}
The starting conditions for the algorithm can be described with the \textbf{require}
-instruction, and its result with the \textbf{ensure} instruction.:
+instruction, and its result with the \textbf{ensure} instruction.
+
+A procedure call can be formatted with \verb:\Call:.
\ASTART
\begin{verbatim}
\Require something
\Ensure something
+\Statex
+\State \Call{Create}{10}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}
+\begin{algorithmic}[1]
\Require something
\Ensure something
-\end{algi}
-}
+\Statex
+\State \Call{Create}{10}
+\end{algorithmic}
\AENDSKIP
\noindent Example:
@@ -559,16 +576,15 @@ instruction, and its result with the \textbf{ensure} instruction.:
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}
+\begin{algorithmic}[1]
\Require $x\ge5$
\Ensure $x\le-5$
\Statex
\While{$x>-5$}
\State $x\gets x-1$
\EndWhile
-\end{alginc}
-}
+\Statex
+\end{algorithmic}
\AEND
@@ -580,7 +596,8 @@ instruction, and its result with the \textbf{ensure} instruction.:
The \texttt{algpseudocode} package supports the following options:
\begin{description}
-\item[compatible/noncompatible]\ \\If you would like to use old
+\item[compatible/noncompatible]\ \textit{Obsolote, use the algcompatible layout instead.}\\
+If you would like to use old
algorithms, written with the \old\ package without (too much)
modification, then use the \textbf{compatible} option. This option
defines the uppercase version of the commands. Note that you still need
@@ -589,7 +606,7 @@ limitations in the \old\ package, these limitations and comments are gone now).
The default \textbf{noncompatible} does not define the all uppercase
commands.
\item[noend/end]\ \\With \textbf{noend} specified all \textbf{end \dots}
-lines are omitted. You get a somewhat smaller algorithm, and the odd
+lines are omitted. You get a somewhat smaller algorithm, and the ugly
feeling, that something is missing\dots{} The \textbf{end} value is the
default, it means, that all \textbf{end \dots} lines are in their right
place.
@@ -600,48 +617,45 @@ place.
One common thing for a pseudocode is to change the command names. Many people
use many different kind of pseudocode command names. In \textbf{algpseudocode}
all keywords are declared as \verb:\algorithmic<keyword>:. You can change them
-to output the text you need. For example, to obtain a hungarian translation, you write:
+to output the text you need:
\bigskip\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
-\renewcommand\algorithmicwhile{\textbf{am\'\i g}}
-\renewcommand\algorithmicdo{\textbf{ism\'eteld}}
-\renewcommand\algorithmicend{\textbf{v\'ege}}
+\algrenewcommand\algorithmicwhile{\textbf{am\'\i g}}
+\algrenewcommand\algorithmicdo{\textbf{v\'egezd el}}
+\algrenewcommand\algorithmicend{\textbf{v\'ege}}
\begin{algorithmic}[1]
\State $x \gets 1$
\While{$x < 10$}
- \State $x \gets x - 1$
+ \State $x \gets x + 1$
\EndWhile
\end{algorithmic}
\end{verbatim}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
-{
-\algsetlanguage{pseudocode}
\begin{algorithmic}[1]
-\renewcommand\algorithmicwhile{\textbf{am\'\i g}}
-\renewcommand\algorithmicdo{\textbf{ism\'eteld}}
-\renewcommand\algorithmicend{\textbf{v\'ege}}
+\algrenewcommand\algorithmicwhile{\textbf{am\'\i g}}
+\algrenewcommand\algorithmicdo{\textbf{v\'egezd el}}
+\algrenewcommand\algorithmicend{\textbf{v\'ege}}
\State $x \gets 1$
\While{$x < 10$}
- \State $x \gets x - 1$
+ \State $x \gets x + 1$
\EndWhile
\Statex
\end{algorithmic}
-}
\end{minipage}\bigskip
In some cases you may need to change even more (in the above example
\textbf{am\'\i g} and \textbf{v\'ege} should be interchanged in the \verb:\EndWhile:
text). Maybe the number of the parameters taken by some commands must be changed too.
-This can be done with the command text customizing macros (see section
+this can be done with the command text customizing macros (see section
\ref{custom text}). Here I'll give only some examples of the most common usage:
\bigskip\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
-\renewcommand\algorithmicwhile{\textbf{am\'\i g}}
-\renewcommand\algorithmicdo{\textbf{ism\'eteld}}
-\renewcommand\algorithmicend{\textbf{v\'ege}}
+\algrenewcommand\algorithmicwhile{\textbf{am\'\i g}}
+\algrenewcommand\algorithmicdo{\textbf{v\'egezd el}}
+\algrenewcommand\algorithmicend{\textbf{v\'ege}}
\algrenewtext{EndWhile}{\algorithmicwhile\ \algorithmicend}
\begin{algorithmic}[1]
\State $x \gets 1$
@@ -652,12 +666,10 @@ This can be done with the command text customizing macros (see section
\end{verbatim}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
-{
-\algsetlanguage{pseudocode}
\begin{algorithmic}[1]
-\renewcommand\algorithmicwhile{\textbf{am\'\i g}}
-\renewcommand\algorithmicdo{\textbf{ism\'eteld}}
-\renewcommand\algorithmicend{\textbf{v\'ege}}
+\algrenewcommand\algorithmicwhile{\textbf{am\'\i g}}
+\algrenewcommand\algorithmicdo{\textbf{v\'egezd el}}
+\algrenewcommand\algorithmicend{\textbf{v\'ege}}
\algrenewtext{EndWhile}{\algorithmicwhile\ \algorithmicend}
\State $x \gets 1$
\While{$x < 10$}
@@ -665,12 +677,11 @@ This can be done with the command text customizing macros (see section
\EndWhile
\Statex
\end{algorithmic}
-}
\end{minipage}
\bigskip\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
-\newcommand\algorithmicto{\textbf{to}}
+\algnewcommand\algorithmicto{\textbf{to}}
\algrenewtext{For}[3]%
{\algorithmicfor\ #1 \gets #2 \algorithmicto\ #3 \algorithmicdo}
\begin{algorithmic}[1]
@@ -682,10 +693,8 @@ This can be done with the command text customizing macros (see section
\end{verbatim}
\end{minipage}
\begin{minipage}[b]{0.5\linewidth}
-{
-\algsetlanguage{pseudocode}
\begin{algorithmic}[1]
-\newcommand\algorithmicto{\textbf{to}}
+\algnewcommand\algorithmicto{\textbf{to}}
\algrenewtext{For}[3]%
{\algorithmicfor\ $#1 \gets #2$ \algorithmicto\ $#3$ \algorithmicdo}
\State $p \gets 1$
@@ -694,10 +703,9 @@ This can be done with the command text customizing macros (see section
\EndFor
\Statex
\end{algorithmic}
-}
\end{minipage}\bigskip
-You might want to create translation packages, which included after the \textbf{algpseudocode}
+You could create a translation package, that included after the \textbf{algpseudocode}
package translates the keywords to the language you need.
@@ -705,12 +713,12 @@ package translates the keywords to the language you need.
\subsection{The \textbf{algpascal} layout}
+\alglanguage{pascal}
-
-The most important features of the \textbf{algpascal} layout is that
-\textit{it performs automatically the end-of-block indentation}. In
+The most important feature of the \textbf{algpascal} layout is that
+\textit{it performs automatically the block indentation}. In
section \ref{algorithmicx} you will see how to define such
automatically indented loops. Here is an example to demonstrate this
feature:
@@ -720,23 +728,22 @@ feature:
\begin{algorithmic}[1]
\Begin
\State $sum:=0$;
-\For{i=1}{n}
+\For{i=1}{n}\Comment{sum(i)}
\State $sum:=sum+i$;
\State writeln($sum$);
\End.
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}[pascal]
+\begin{algorithmic}[1]
\Begin
\State $sum:=0$;
-\For{i=1}{n}
+\For{i=1}{n}\Comment{sum(i)}
\State $sum:=sum+i$;
\State writeln($sum$);
\End.
-\end{algi}
-}
+\Statex
+\end{algorithmic}
\AENDSKIP
Note, that the \verb:\For: is not closed explicitly, its end is
@@ -747,20 +754,18 @@ mathematical mode.
\subsubsection{The \textbf{begin} \dots{} \textbf{end} block}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\Begin
<body>
\End
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}[pascal]
+\begin{algorithmic}[1]
\Begin
\State $<$body$>$
\End
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
The \verb:\Begin: \dots{} \verb:\End: block and the
@@ -773,18 +778,16 @@ after the following command (another loop, or a block).
\subsubsection{The \textbf{for} loop}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\For{<assign>}{<expr>}
<command>
\end{verbatim}
\ACONTINUE
-{
-\begin{algi}[pascal]
+\begin{algorithmic}[1]
\For{<$\relax$assign$\relax$>}{<$\relax$expr$\relax$>}
\State $<$command$>$
-\end{algi}
-}
+\end{algorithmic}
\AENDSKIP
The \textbf{For} loop (as all other loops) ends after the following command (a block counts
@@ -805,8 +808,7 @@ also as a single command).
\end{algorithmic}
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\Begin
\State $sum:=0$;
\State $prod:=1$;
@@ -816,48 +818,44 @@ also as a single command).
\State $prod:=prod*i$;
\End
\End.
-\end{alginc}
-}
+\Statex
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{while} loop}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\While{<expression>}
<command>
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\While{<$\relax$expression$\relax$>}
\State $<$command$>$
-\end{alginc}
-}
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{repeat}\dots\ \textbf{until} block}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\Repeat
<body>
\Until{<expression>}
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\Repeat
\State $<$body$>$
\Until{<$\relax$expression$\relax$>}
-\end{alginc}
-}
+\end{algorithmic}
\AEND
\subsubsection{The \textbf{if} command}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\If{<expression>}
<command>
@@ -867,51 +865,45 @@ also as a single command).
]
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\If{<$\relax$expression$\relax$>}
\State $<$command$>$
\Statex \hskip-\algorithmicindent\hskip-\algorithmicindent[
\Else
\State $<$command$>$
\Statex \hskip-\algorithmicindent\hskip-\algorithmicindent]
-\end{alginc}
-}
+\end{algorithmic}
\AENDSKIP
Every \verb:\Else: matches the nearest \verb:\If:.
\subsubsection{The \textbf{procedure} command}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\Procedure <some text>
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\Procedure $<$some text$>$
-\end{alginc}
-}
+\end{algorithmic}
\AENDSKIP
\verb:\Procedure: just writes the ``procedure'' word on a new
-line... You should put manually the \verb:\Begin:\dots\ \verb:\End:
+line... You will probably put a \verb:\Begin:\dots\ \verb:\End:
block after it.
\subsubsection{The \textbf{function} command}
-\noindent\begin{minipage}[c]{0.5\linewidth}
+\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\Function<some text>
\end{verbatim}
\ACONTINUE
-{
-\begin{alginc}[pascal]
+\begin{algorithmic}[1]
\Function $<$some text$>$
-\end{alginc}
-}
+\end{algorithmic}
\AENDSKIP
Just like \textbf{Procedure}.
@@ -920,7 +912,7 @@ Just like \textbf{Procedure}.
\subsection{The \textbf{algc} layout}
-Sorry, the \textbf{algc} layout is incomplete.
+Sorry, the \textbf{algc} layout is unfinished.
The commands defined are:
\begin{itemize}
@@ -938,6 +930,7 @@ The commands defined are:
\section{Custom algorithmic blocks}\label{algorithmicx}
+\alglanguage{default}
@@ -947,10 +940,10 @@ Most of the environments defined in the standard layouts (and most probably
the ones you will define) are divided in two categories:
\begin{description}
-\item[Blocks] are the environments which contain an arbitrary number of
+\item[Blocks] are the environments witch contain an arbitrary number of
commands or nested blocks. Each block has a name, begins with a starting command
and ends with an ending command. The commands in a block are
-indented by \verb:\algorithmicindent: (or another amount, as you will see later in this section).
+indented by \verb:\algorithmicindent: (or another amount).
If your algorithm ends without closing all blocks, the \alg\ package gives
you a nice error. So be good, and close them all!
@@ -965,8 +958,8 @@ your algorithm (or a block) ends before the single command of a loop,
then this is considered an empty command, and the loop is closed. Feel
free to leave open loops at the end of blocks!
-Most of the environments in the \verb:algpascal: and
-\verb:algc: packages are loops.
+Loops are most of the environments in the \verb:algpascal: and
+\verb:algc: packages.
\end{description}
For some rare constructions you can create mixtures of the two
@@ -1023,13 +1016,13 @@ macro will display the different texts you specified.
If in the above definitions the \verb:<block>: is missing, then the name of the starting command
is used as block name. If a block with the given name
-already exists, these macros won't define a new block, instead of this the defined block will be used.
-So both, the old and new starting and ending commands will open/close the block.
-If \verb:<start>: or \verb:<end>: is empty, then
+already exists, these macros don't define a new block, instead this it will be used the defined
+block. If \verb:<start>: or \verb:<end>: is empty, then
the definition does not define a new starting/ending command for the block, and then the
respective text must be missing from the definition. You may have more starting and ending commands
for one block. If the block name is missing, then a starting command must be given.
+
\bigskip\noindent\begin{minipage}[b]{0.5\linewidth}
\begin{verbatim}
\algblock[Name]{Start}{End}
@@ -1079,8 +1072,8 @@ for one block. If the block name is missing, then a starting command must be giv
\subsection{Defining loops}
The loop defining macros are similar to the block defining macros. A loop has no ending command
-and ends after the first statement, block or loop that follows the loop.
-Since loops have no ending command, the macro \verb:\algloopx: would not have much sense.
+and ends after the first state, block or loop that follows the loop.
+Since loops have no ending command, the macro \verb:\algloopx: would not have mutch sense.
The loop defining macros are:
\begin{verbatim}
@@ -1158,9 +1151,9 @@ then \verb:<continue>: is used as the new block name. It is not allowed to have
\verb:<old block>: block/loop and opens the \verb:<new block>: block. Since \verb:<continue>: may
end different blocks and loops, it can have different text
at the end of the different blocks/loops. If the \verb:<continue>: command doesn't find an
-\verb:<old block>: to close, an error is reported.
+\verb:<old block>: to close, then an error is reported.
-You can create continuing loops with the following macros:
+Create continuing loops with the followings:
\begin{verbatim}
\algcloop[<new loop>]{<old block>}{<continue>}
@@ -1195,7 +1188,7 @@ block/loop, and opens a \verb:<new loop>: loop.
\EndIf
\If
\EndIf
-\Eeee{Param}
+\Eeee{Creep}
\Oooo
\end{algorithmic}
\end{verbatim}
@@ -1220,7 +1213,7 @@ block/loop, and opens a \verb:<new loop>: loop.
\EndIf
\If
\EndIf
-\Eeee{Param}
+\Eeee{Creep}
\Oooo
\Statex
\end{algorithmic}
@@ -1266,8 +1259,8 @@ block/loop, and opens a \verb:<new loop>: loop.
\subsection{Even more customisation}\label{setblock}
With the following macros you can give the indentation used by the new block (or loop),
-and the number of statements after which the "block" is automatically closed. This value is $\infty$
-for blocks, 1 for loops, and 0 for statements. There is a special value, 65535, meaning that the
+and the number of stataments after that the "block" is automatically closed. This value is $\infty$
+for blocks, 1 for loops, and 0 for stataments. There is a special value, 65535, meaning that the
defined "block" does not end automatically, but if it is enclosed in a block, then the ending
command of the block closes this "block" as well.
@@ -1299,7 +1292,7 @@ command of the block closes this "block" as well.
[<endparamcount>][<default value>]{<end text>}
\end{verbatim}
-The \verb:<lifetime>: is the number of statements after that the block is closed. An empty
+The \verb:<lifetime>: is the number of stataments after that the block is closed. An empty
\verb:<lifetime>: field means $\infty$. The \verb:<indent>: gives the indentation of the block.
Leave this field empty for the default indentation. The rest of the parameters has the same
function as for the previous macros.
@@ -1367,7 +1360,7 @@ The created environments behave as follows:
\begin{itemize}
\item It starts with \verb:\Start:. The nested environments are
indented by 1 cm.
-\item If it is followed by at least 3 environments (statements), then it closes
+\item If it is followed by at least 3 environments (stataments), then it closes
automatically after the third one.
\item If you put a \verb:\Stop: before the automatic closure, then this
\verb:\Stop: closes the environment. \verb:CStart: closes a block called \verb:Name:
@@ -1381,7 +1374,7 @@ and opens a new one called \verb:CName: and having an indentaion of 2 cm.
\subsection{Parameters, custom text}\label{custom text}
With \verb:\algrenewtext: you can change the number of parameters, and the text displayed by the
-commands. With \verb:algnotext: you can make the whole output line disappear, but
+commands. With \verb:algnotext: you can makes the vole output line disappear, but
it works only for ending commands, for beginning commands you will get an incorrect output.
\begin{verbatim}
@@ -1401,12 +1394,12 @@ for this block), use \verb:\algdefaulttext:.
\algdefaulttext[<block>]{<command>}
\end{verbatim}
-If the \verb:<block>: is missing, the default text itself will be set to the default value
+If the \verb:<block>: is missing, than the default text itself will be set to the default value
(this is \verb:\textbf{<command>}:).
-\subsection{The base defining macro}
+\subsection{The ONE defining macro}
All block and loop defining macros call the same macro. You may use this macro to gain a
better acces to what will be defined. This macro is \verb:\algdef:.
@@ -1436,7 +1429,7 @@ xN&ending command, with no text for this block\\
\hline
b&block(default)\\
l&loop\\
-L&loop closes after the given number of statements\\
+L&loop closes after the given number of stataments\\
\hline
i&indentation specified\\
\hline
@@ -1504,7 +1497,7 @@ The block and loop defining macros call \verb:\algdef: with the following flags:
\vfill
\section{Examples}
-\subsection{A full pseudocode example}
+\subsection{A full example using \textbf{algpseudocode}}
\begin{verbatim}
@@ -1553,8 +1546,8 @@ The block and loop defining macros call \verb:\algdef: with the following flags:
\end{verbatim}
\eject
-{
-\algsetlanguage{pseudocode}
+
+\alglanguage{pseudocode}
\begin{algorithm}[h]
\caption{The Bellman-Kalaba algorithm}
\begin{algorithmic}[1]
@@ -1592,18 +1585,184 @@ The block and loop defining macros call \verb:\algdef: with the following flags:
\EndProcedure
\end{algorithmic}
\end{algorithm}
-}
+\eject
+
+
+
+
+\subsection{Breaking up an algorithm}
+
+
+\begin{verbatim}
+\documentclass{article}
+\usepackage{algorithm}
+\usepackage{algpseudocode}
+\begin{document}
+\begin{algorithm}
+\caption{Part 1}
+\begin{algorithmic}[1]
+\Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
+ \ForAll {$v \in V(G)$}
+ \State $l(v) \leftarrow \infty$
+ \EndFor
+ \State $l(u) \leftarrow 0$
+ \Repeat
+ \For {$i \leftarrow 1, n$}
+ \State $min \leftarrow l(v_i)$
+ \For {$j \leftarrow 1, n$}
+ \If {$min > e(v_i, v_j) + l(v_j)$}
+ \State $min \leftarrow e(v_i, v_j) + l(v_j)$
+ \State \Comment For some reason we need to break here!
+\algstore{bkbreak}
+\end{algorithmic}
+\end{algorithm}
+
+And we need to put some additional text between\dots
+
+\begin{algorithm}[h]
+\caption{Part 2}
+\begin{algorithmic}[1]
+\algrestore{bkbreak}
+ \State $p(i) \leftarrow v_j$
+ \EndIf
+ \EndFor
+ \State $l'(i) \leftarrow min$
+ \EndFor
+ \State $changed \leftarrow l \not= l'$
+ \State $l \leftarrow l'$
+ \Until{$\neg changed$}
+\EndProcedure
+\end{algorithmic}
+\end{algorithm}
+\end{document}
+\end{verbatim}
+\eject
+
+
+\alglanguage{pseudocode}
+\begin{algorithm}[h]
+\caption{Part 1}
+\begin{algorithmic}[1]
+\Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
+ \ForAll {$v \in V(G)$}
+ \State $l(v) \leftarrow \infty$
+ \EndFor
+ \State $l(u) \leftarrow 0$
+ \Repeat
+ \For {$i \leftarrow 1, n$}
+ \State $min \leftarrow l(v_i)$
+ \For {$j \leftarrow 1, n$}
+ \If {$min > e(v_i, v_j) + l(v_j)$}
+ \State $min \leftarrow e(v_i, v_j) + l(v_j)$
+ \State \Comment For some reason we need to break here!
+\algstore{bkbreak}
+\end{algorithmic}
+\end{algorithm}
+
+And we need to put some additional text between\dots
+
+\begin{algorithm}[h]
+\caption{Part 2}
+\begin{algorithmic}[1]
+\algrestore{bkbreak}
+ \State $p(i) \leftarrow v_j$
+ \EndIf
+ \EndFor
+ \State $l'(i) \leftarrow min$
+ \EndFor
+ \State $changed \leftarrow l \not= l'$
+ \State $l \leftarrow l'$
+ \Until{$\neg changed$}
+\EndProcedure
+\end{algorithmic}
+\end{algorithm}
+\eject
+
+
+
+
+\subsection{Using multiple layouts}
+
+
+\begin{verbatim}
+\documentclass{article}
+\usepackage{algorithm}
+\usepackage{algpseudocode}
+\usepackage{algpascal}
+\begin{document}
+
+\alglanguage{pseudocode}
+\begin{algorithm}
+\caption{A small pseudocode}
+\begin{algorithmic}[1]
+\State $s \gets 0$
+\State $p \gets 0$
+\For{$i \gets 1,\, 10$}
+ \State $s \gets s + i$
+ \State $p \gets p + s$
+\EndFor
+\end{algorithmic}
+\end{algorithm}
+
+\alglanguage{pascal}
+\begin{algorithm}
+\caption{The pascal version}
+\begin{algorithmic}[1]
+\State $s := 0$
+\State $p := 0$
+\For{i = 1}{10}
+ \Begin
+ \State $s := s + i$
+ \State $p := p + s$
+ \End
+\end{algorithmic}
+\end{algorithm}
+
+\end{document}
+\end{verbatim}
+\eject
+
+
+\alglanguage{pseudocode}
+\begin{algorithm}
+\caption{A small pseudocode}
+\begin{algorithmic}[1]
+\State $s \gets 0$
+\State $p \gets 0$
+\For{$i \gets 1,\, 10$}
+ \State $s \gets s + i$
+ \State $p \gets p + s$
+\EndFor
+\end{algorithmic}
+\end{algorithm}
+
+\alglanguage{pascal}
+\begin{algorithm}
+\caption{The pascal version}
+\begin{algorithmic}[1]
+\State $s := 0$
+\State $p := 0$
+\For{i = 1}{10}
+ \Begin
+ \State $s := s + i$
+ \State $p := p + s$
+ \End
+\end{algorithmic}
+\end{algorithm}
\eject
\section{Bugs}
-At this time there are no known bugs. If you find a bug, please create
-a small \LaTeX{} file to demonstrate this, and contact me on:
+If you have a question or find a bug you can contact me on:
\medskip
\textbf{szaszjanos@users.sourceforge.net}
+\medskip
+\noindent If possible, please create a small \LaTeX{} example related to your problem.
+
+
\end{document}
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algc.sty b/Master/texmf-dist/tex/latex/algorithmicx/algc.sty
index 60c39b7835c..c42b44f2d17 100644
--- a/Master/texmf-dist/tex/latex/algorithmicx/algc.sty
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algc.sty
@@ -1,8 +1,8 @@
-% C ALGORITHMIC STYLE -- Released 18 MAR 2004
+% C ALGORITHMIC STYLE -- Released 27 APR 2005
% for LaTeX version 2e
%
% Copyright Szasz Janos
-% E-mail szaszjanos@users.sourceforge.net
+% E-mail szaszjanos@sourceforge.net
%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{algc}%
@@ -10,49 +10,40 @@
\RequirePackage{algorithmicx}%
\typeout{Document Style - c/c++ environments for use with the `algorithmicx' style}%
%
-\def\ALG@setc{t}%
-\DeclareOption{noset}{\def\ALG@setc{}}%
-\DeclareOption{set}{\def\ALG@setc{t}}%
\ProcessOptions%
%
%
% *** DECLARATIONS ***
%
%
-\ALG@deflanguage{c}{\ALG@setc}%
-{%
+\algnewlanguage{c}%
+\alglanguage{c}%
%
% *** KEYWORDS ***
%
-\let\algorithmicbegin\{%
-\let\algorithmicend\}%
-\newcommand\textkeyword{\textbf}%
+\let\ALG@cbegin\{%
+\let\ALG@cend\}%
+\algnewcommand\algorithmicbegin{\ALG@cbegin}%
+\algnewcommand\algorithmicend{\ALG@cend}%
+\algnewcommand\textkeyword{\textbf}%
%
% *** DECLARED BLOCKS AND LOOPS ***
%
\algdef{SEi}{Begin}{End}{0cm}{\algorithmicbegin}{\algorithmicend}%
%
-\algdef{lS}{For}[3]{\textkeyword{for}\ (\(##1\); \(##2\); \(##3\))}%
-\algdef{lS}{While}[1]{\textkeyword{while}\ (\(##1\))}%
+\algdef{lS}{For}[3]{\textkeyword{for}\ (\(#1\); \(#2\); \(#3\))}%
+\algdef{lS}{While}[1]{\textkeyword{while}\ (\(#1\))}%
\algdef{lS}{Do}{\textkeyword{do}}%
\algdef{Lc}{Do}{While}{0}%
-\algdef{lS}{If}[1]{\textkeyword{if}\ (\(##1\))}%
+\algdef{lS}{If}[1]{\textkeyword{if}\ (\(#1\))}%
\algdef{lC}{If}{Else}{\textkeyword{else}}%
%
% *** OTHER DECLARATIONS ***
%
-\def\ALG@beginalgorithmic{\let\{\Begin\let\}\End}%
+%\def\ALG@beginalgorithmic{\let\{\Begin\let\}\End}%
%
-\newcommand\Function[3]{\State##1 ##32(##3)}%\textit{##2}(##3)}
-\newcommand\Return{\State\textkeyword{return}\space}%
+%\newcommand\Function[3]{\State#1 #32(#3)}%\textit{#2}(#3)}
+%\newcommand\Return{\State\textkeyword{return}\space}%
%
-\renewcommand\algorithmiccomment[1]{\hfill// ##1}%
-%
-%
-%
-}%
-%
-%
-%
-\let\ALG@setc\relax%
+\algrenewcomment[1]{\hfill// #1}%
%
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algcompatible.sty b/Master/texmf-dist/tex/latex/algorithmicx/algcompatible.sty
new file mode 100644
index 00000000000..075f8512e27
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algcompatible.sty
@@ -0,0 +1,89 @@
+% ALGORITHMIC STYLE -- Released 27 APR 2005
+% for LaTeX version 2e
+%
+% Copyright Szasz Janos
+% E-mail szaszjanos@users.sourceforge.net
+% Based on Peter Williams's algorithmic.sty
+%
+\NeedsTeXFormat{LaTeX2e}%
+\ProvidesPackage{algcompatible}%
+\RequirePackage{ifthen}%
+\RequirePackage{algorithmicx}%
+\typeout{Document Style - algorithmic compatible environments for the `algorithmicx' style}%
+%
+\def\ALG@noend{f}%
+%
+\DeclareOption{noend}{\def\ALG@noend{t}}%
+\DeclareOption{end}{\def\ALG@noend{f}}%
+\ProcessOptions%
+%
+% *** DECLARATIONS ***
+%
+\algnewlanguage{algorithmic}%
+\alglanguage{algorithmic}%
+%
+% *** KEYWORDS ***
+%
+\algnewcommand\algorithmicend{\textbf{end}}
+\algnewcommand\algorithmicdo{\textbf{do}}
+\algnewcommand\algorithmicwhile{\textbf{while}}
+\algnewcommand\algorithmicfor{\textbf{for}}
+\algnewcommand\algorithmicforall{\textbf{for all}}
+\algnewcommand\algorithmicloop{\textbf{loop}}
+\algnewcommand\algorithmicrepeat{\textbf{repeat}}
+\algnewcommand\algorithmicuntil{\textbf{until}}
+\algnewcommand\algorithmicif{\textbf{if}}
+\algnewcommand\algorithmicthen{\textbf{then}}
+\algnewcommand\algorithmicelse{\textbf{else}}
+\algnewcommand\algorithmicrequire{\textbf{Require:}}
+\algnewcommand\algorithmicensure{\textbf{Ensure:}}
+%
+% *** DECLARED LOOPS ***
+%
+% lines...
+\let\ALG@loopmark\ALG@x@nomark%
+% default line and marks
+\def\ALG@startmark{nomark}%
+\def\ALG@blockline{noline}%
+\def\ALG@continuemark{nomark}%
+\def\ALG@endmark{nomark}%
+%
+\newcommand\ALG@compatcomm[1]{\ifthenelse{\equal{#1}{default}}{}{\ \algorithmiccomment{#1}}}%
+\algrenewcomment[1]{\{#1\}}%
+\algdef{SE}[WHILE]{WHILE}{ENDWHILE}%
+ [2][default]{\algorithmicwhile\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicwhile}%
+\algdef{SE}[FOR]{FOR}{ENDFOR}%
+ [2][default]{\algorithmicfor\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicfor}%
+\algdef{S}[FOR]{FORALL}%
+ [2][default]{\algorithmicforall\ #2\ \algorithmicdo\ALG@compatcomm{#1}}%
+\algdef{SE}[LOOP]{LOOP}{ENDLOOP}%
+ [1][default]{\algorithmicloop\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicloop}%
+\algdef{SE}[REPEAT]{REPEAT}{UNTIL}%
+ [1][default]{\algorithmicrepeat\ALG@compatcomm{#1}}%
+ [1]{\algorithmicuntil\ #1}%
+\algdef{SE}[IF]{IF}{ENDIF}%
+ [2][default]{\algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}%
+ {\algorithmicend\ \algorithmicif}%
+\algdef{C}[IF]{IF}{ELSIF}%
+ [2][default]{\algorithmicelse\ \algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}%
+\algdef{Ce}[ELSE]{IF}{ELSE}{ENDIF}%
+ [1][default]{\algorithmicelse\ALG@compatcomm{#1}}%
+\algnewcommand\REQUIRE{\item[\algorithmicrequire]}%
+\algnewcommand\ENSURE{\item[\algorithmicensure]}%
+\algnewcommand\STATE{\State}%
+\algnewcommand\STATEx{\Statex}%
+\algnewcommand\COMMENT{\Comment}%
+%
+\ifthenelse{\equal{\ALG@noend}{t}}%
+ {%
+ \algtext*{ENDWHILE}%
+ \algtext*{ENDFOR}%
+ \algtext*{ENDLOOP}%
+ \algtext*{ENDIF}%
+ }{}%
+%
+\algrenewcommand\algorithmicindent{1em}%
+%
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty b/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty
index be33bf10b17..e274a7dfa99 100644
--- a/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algmatlab.sty
@@ -1,4 +1,4 @@
-% Matlab ALGORITHMIC STYLE -- Released 18 MAR 2004
+% Matlab ALGORITHMIC STYLE -- Released 27 APR 2005
% for LaTeX version 2e
%
% Copyright Szasz Janos
@@ -10,14 +10,12 @@
\RequirePackage{algorithmicx}%
\typeout{Document Style - matlab environments for use with the `algorithmicx' style}%
%
-\def\ALG@setmatlab{t}%
-\DeclareOption{noset}{\def\ALG@setmatlab{}}%
-\DeclareOption{set}{\def\ALG@setmatlab{t}}%
\ProcessOptions%
%
% *** DECLARATIONS ***
%
\algnewlanguage{matlab}%
+\alglanguage{matlab}%
%
% *** KEYWORDS ***
%
@@ -31,7 +29,7 @@
\algdef{Se}[IF]{If}{End}[1]{\textkeyword{if}\ #1}%
\algdef{C}[IF]{IF}{ElseIf}[1]{\textkeyword{else}\textkeyword{if}\ #1}%
\algdef{Ce}[ELSE]{IF}{Else}{End}{\textkeyword{else}}%
-\algdef{LSxN}[FUNCTION]{Function}{End}{65535}%
+\algdef{LSxnE}[FUNCTION]{Function}{End}{65535}%
[2]{\textkeyword{function}\ \textfunc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}%
%
\algdef{SxE}[SWITCH]{Switch}{End}[1]{\let\Case\ALG@thecase\textkeyword{switch}\ #1}%
@@ -66,10 +64,5 @@
%
% *** OTHER DECLARATIONS ***
%
-\def\ALG@beginalgorithmic{\let\leftbr[\let\rightbr]\def\[{\textbf{\leftbr}}\def\]{\textbf{\rightbr}}}%
-%
-%
-%
-\ifthenelse{\equal{\ALG@setmatlab}{t}}{\alglanguage{matlab}}{}%
-\let\ALG@setmatlab\relax%
+\algrenewcommand\ALG@beginalgorithmic{\let\leftbr[\let\rightbr]\def\[{\textbf{\leftbr}}\def\]{\textbf{\rightbr}}}%
%
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty b/Master/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
index 0b681debab7..bfb7dabafe4 100644
--- a/Master/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
@@ -1,97 +1,88 @@
-% ALGORITHMIC STYLE -- Released 18 MAR 2004
+% ALGORITHMIC STYLE -- Released 27 APR 2005
% for LaTeX version 2e
%
% Copyright Szasz Janos
% E-mail szaszjanos@users.sourceforge.net
-% Based on Peter Williams's algorithmic.sty
%
%
% *** INITIALISING ***
%
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{algorithmicx}[2004/03/18 v1.1 Algorithmicx]
+\ProvidesPackage{algorithmicx}[2005/04/27 v1.2 Algorithmicx]
\RequirePackage{ifthen}
-\typeout{Document Style algorithmicx 1.1 - a greatly improved `algorithmic' style}
+\typeout{Document Style algorithmicx 1.2 - a greatly improved `algorithmic' style}
%
\newcounter{ALG@line}
\newcounter{ALG@rem}
+\newcounter{ALG@nested}
\newlength{\ALG@tlm}
-\newlength{\ALG@ctlm}
-\newlength{\algorithmicindent}
-\setlength{\algorithmicindent}{1.5em}
+\newlength{\ALG@thistlm}
+\newcounter{ALG@Lnr}% the number of defined languages
+\setcounter{ALG@Lnr}{0}
\newcounter{ALG@blocknr}% the number of defined blocks
\setcounter{ALG@blocknr}{0}
+\newcounter{ALG@storecount}% number of stored but not restored algorithmic environments
+\setcounter{ALG@storecount}{0}
\newcounter{ALG@tmpcounter}% only to decrement things
-\def\algorithmicnoindent{-\ALG@tlm}
-\def\algbackskipbegin{\hskip\ALG@ctlm}
-\def\algbackskip{\hskip\ALG@ctlm\hskip-\ALG@tlm}
-\def\algbackskipend{\hskip-\ALG@tlm}
+\newlength\ALG@tmplength%
+%\def\algorithmicnoindent{-\ALG@tlm}
+% \def\algbackskipbegin{\hskip\ALG@ctlm}
+%\def\algbackskip{\hskip-\ALG@thistlm}
+%\def\algbackskipend{\hskip-\ALG@tlm}
\def\ALG@defaultindent{\algorithmicindent}
%
+% conditional states
+%
+\def\ALG@newcondstate#1%
+ {%
+ \expandafter\edef\csname ALG@x@#1\endcsname%
+ {\expandafter\noexpand\csname @@ALG@x@#1\endcsname}%
+ }%
+\ALG@newcondstate{notext}%
+\ALG@newcondstate{default}%
+%
%
% *** ALGORITHMIC ***
%
%
-\newenvironment{ALG@g}[1]% a list for the iner loops
+\newcommand\ALG@beginblock[1]% #1 - indentation
{%
- \begin{list}%
- {\ALG@step}%
- {%
- \itemsep\z@%
- \itemindent\z@%
- \listparindent2em% the indent given to multiline lines...
- \rightmargin\z@%
- \topsep\z@%
- \partopsep\z@%
- \parskip\z@%
- \parsep\z@%
- \leftmargin#1%
- \ALG@ctlm#1%
- \addtolength{\ALG@tlm}{\leftmargin}%
- \labelsep\ALG@tlm%
- \addtolength{\labelsep}{0.5em}%
- }%
- \global\@newlistfalse% give no error, if the list is empty
+ \ALG@thistlm\ALG@tlm%
+ \addtolength\ALG@tlm{#1}%
+ \addtocounter{ALG@nested}{1}%
+ \setlength\ALG@tmplength{#1}%
+ \expandafter\edef\csname ALG@ind@\theALG@nested\endcsname{\the\ALG@tmplength}%
+ }%
+\newcommand\ALG@endblock%
+ {%
+ \addtolength\ALG@tlm{-\csname ALG@ind@\theALG@nested\endcsname}%
+ \addtocounter{ALG@nested}{-1}%
+ \ALG@thistlm\ALG@tlm%
}%
- {\end{list}}%
%
% algorithmic environment
%
-\let\ALG@beginalgorithmic\relax% for user overrides
-\let\ALG@endalgorithmic\relax% for user overrides
+\def\ALG@step%
+ {%
+ \addtocounter{ALG@line}{1}%
+ \addtocounter{ALG@rem}{1}%
+ \ifthenelse{\equal{\arabic{ALG@rem}}{\ALG@numberfreq}}%
+ {\setcounter{ALG@rem}{0}\alglinenumber{\arabic{ALG@line}}}%
+ {}%
+ }%
\newenvironment{algorithmic}[1][0]%
{%
+ \edef\ALG@numberfreq{#1}%
\def\@currentlabel{\theALG@line}%
- \newcommand{\ALG@step}%
- {%
- \addtocounter{ALG@line}{1}%
- \addtocounter{ALG@rem}{1}%
- \ifthenelse{\equal{\arabic{ALG@rem}}{#1}}%
- {\setcounter{ALG@rem}{0}{\footnotesize \arabic{ALG@line}:}}%
- {}%
- }%
%
\setcounter{ALG@line}{0}%
\setcounter{ALG@rem}{0}%
%
- \let\@listii\@listi%
- \let\@listiii\@listi%
- \let\@listiv\@listi%
- \let\@listv\@listi%
- \let\@listvi\@listi%
- \let\@listvii\@listi%
- \renewcommand{\@toodeep}{}%
+ \let\\\algbreak%
%
- \renewcommand{\\}% for multiline parameters !!! needs fix
- {%
- \item%
- \hskip\ALG@parindent%!!! not yet implemented
-% \hskip-\algorithmicindent%
- }%
- %
- \edef\ALG@currentitem{0}%
- \let\ALG@currentvalue\relax%
+ \expandafter\edef\csname ALG@currentblock@\theALG@nested\endcsname{0}%
+ \expandafter\let\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
%
\begin{list}%
{\ALG@step}%
@@ -99,23 +90,22 @@
\rightmargin\z@%
\itemsep\z@ \itemindent\z@ \listparindent2em%
\partopsep\z@ \parskip\z@ \parsep\z@%
- \labelsep 0.5em \topsep 0.0em%\skip 1.2em
+ \labelsep 0.5em \topsep 0.2em%\skip 1.2em
\ifthenelse{\equal{#1}{0}}%
{\labelwidth 0.5em}%
{\labelwidth 1.2em}%
\leftmargin\labelwidth \addtolength{\leftmargin}{\labelsep}% Ok. the perfect leftmargin :-))
- \ALG@tlm 0em%
- \ALG@ctlm\ALG@tlm%
+ \ALG@tlm\z@%
}%
+ \setcounter{ALG@nested}{0}%
\ALG@beginalgorithmic%
}%
{% end{algorithmic}
-% \global\@newlistfalse% protects against empty algorithms, not needed
% check if all blocks are closed
\ALG@closeloops%
- \ifnum0=\ALG@currentitem\relax%
+ \expandafter\ifnum\csname ALG@currentblock@\theALG@nested\endcsname=0\relax%
\else%
- \PackageError{algorithmicx}{Some blocks are not closed!!!}{Yes, you have some open blocks.}%
+ \PackageError{algorithmicx}{Some blocks are not closed!!!}{}%
\fi%
\ALG@endalgorithmic%
\end{list}%
@@ -125,107 +115,126 @@
% *** Functional core ***
%
%
-\def\ALG@makeentitie#1% execute the entitie (#1)
+\def\ALG@makeentity#1% execute the entity (#1)
{%
- \expandafter\ifx\csname ALG@b@#1@0\endcsname\relax%
- \ALG@makenobegin{#1}% this entitie ends or continues blocks
+ \def\ALG@thisentity{#1}%
+ \expandafter\ifx\csname ALG@b@\ALG@L @#1@0\endcsname\relax%
+ \let\ALG@makenobeginrepeat\ALG@makenobegin\ALG@makenobeginrepeat% this entitie ends or continues blocks
\else%
- \ALG@makebegin{#1}% this entitie can open blocks
+ \let\ALG@makebeginrepeat\ALG@makebegin\ALG@makebeginrepeat% this entitie can open blocks
\fi%
\ALG@entitiecommand%
}%
%
-\def\ALG@makebegin#1% executes an entitie (#1) that can open blocks
+\def\ALG@makebegin% executes an entitie that can open blocks
{%
- \ifx\ALG@currentvalue\relax%
- \ALG@openblock{0}{#1}% in infinite block I can open my block
+ \expandafter\let\expandafter\ALG@thislifetime\csname ALG@currentlifetime@\theALG@nested\endcsname%
+ \ifx\ALG@thislifetime\relax%
+ \let\ALG@makebeginrepeat\ALG@doentity% in infinite block I can open my block
\else%
- \ifnum0<\ALG@currentvalue\relax%
- \ifnum\ALG@currentvalue>65534\else%
- \setcounter{ALG@tmpcounter}{\ALG@currentvalue}% the block has 'space' for another included block
+ \ifnum\ALG@thislifetime>0\relax%
+ \ifnum\ALG@thislifetime>65534\else%
+ \setcounter{ALG@tmpcounter}{\ALG@thislifetime}% the block has 'space' for another included block
\addtocounter{ALG@tmpcounter}{-1}%
- \edef\ALG@currentvalue{\arabic{ALG@tmpcounter}}%
+ \expandafter\edef\csname ALG@currentlifetime@\theALG@nested\endcsname{\arabic{ALG@tmpcounter}}%
\fi%
- \ALG@openblock{0}{#1}%
+ \let\ALG@makebeginrepeat\ALG@doentity%
\else% the block needs to be closed
- \expandafter\ifx\csname ALG@b@#1@\ALG@currentitem\endcsname\relax%
- \end{ALG@g}% I can not close this block, continue after it is closed by force
- \ALG@makebegin{#1}%
+ \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\csname ALG@currentblock@\theALG@nested\endcsname\endcsname\relax%
+ \ALG@closebyforce% I can not close this block, continue after it is closed by force
+% \ALG@makebegin%
\else%
- \ALG@changeblock{#1}% close this block
+ % the block would be closed automatically, but this entitie can close it, so let's do it with the entity
+ \let\ALG@makebeginrepeat\ALG@doentity%
\fi%
\fi%
\fi%
+ \ALG@makebeginrepeat%
}%
%
-\def\ALG@makenobegin#1% executes an entitie (#1) that can not open blocks
+\def\ALG@makenobegin% executes an entitie that can not open blocks
{%
- \ifx\ALG@currentvalue\relax%
- \ALG@changeblock{#1}% an infinite block must be broken
+ \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
+ \let\ALG@makenobeginrepeat\ALG@doentity% an infinite block must be broken
\else%
- \expandafter\ifx\csname ALG@b@#1@\ALG@currentitem\endcsname\relax%
- \end{ALG@g}% the block must be ended by force,
- \ALG@makenobegin{#1}% the command still runs
+ \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\csname ALG@currentblock@\theALG@nested\endcsname\endcsname\relax%
+ \ALG@closebyforce% the block must be ended by force,
\else%
- \ALG@changeblock{#1}% i can continue / end this block, let's do it
+ \let\ALG@makenobeginrepeat\ALG@doentity% I can continue / end this block, let's do it
\fi%
\fi%
+ \ALG@makenobeginrepeat%
}%
%
-\def\ALG@ifnotrelax#1#2#3% #1 - the number of the closed block, #2 - the entitie, #3 - things to be done
+\def\ALG@dobegin%
{%
- \edef\ALG@tmpcmd{\expandafter\noexpand\csname algorithmic#2\endcsname}%
- \expandafter\ifx\csname ALG@t@#1@#2\endcsname\relax\else%
- \expandafter\ifx\csname ALG@t@#1@#2\endcsname\ALG@tmpcmd%
- \expandafter\ifx\csname algorithmic#2\endcsname\relax\else%
- #3%
- \fi%
- \else%
- #3%
- \fi%
+ \ALG@beginblock{\csname ALG@i@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
+ \expandafter\edef\csname ALG@currentblock@\theALG@nested\endcsname{\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
+ \expandafter\ifx\csname ALG@c@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\relax%
+ \expandafter\let\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
+ \else%
+ \expandafter\edef\csname ALG@currentlifetime@\theALG@nested\endcsname{\csname ALG@c@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname}%
\fi%
}%
%
-\def\ALG@closeblock#1#2% #1 - the number of the closed block, #2 - the entitie
+\def\ALG@doend%
{%
- \ALG@ifnotrelax{#1}{#2}{\item}%
- \expandafter\let\expandafter\ALG@entitiecommand\csname ALG@t@#1@#2\endcsname%
+ \ALG@endblock%
}%
%
-\def\ALG@openblock#1#2% #1 - the number of the closed block, #2 - the entitie
+\def\ALG@doentity% the number of the closed block, the entitie
{%
- \item[]%
- \begin{ALG@g}{\csname ALG@i@#2@#1\endcsname}%
- \edef\ALG@currentitem{\csname ALG@b@#2@#1\endcsname}%
- \expandafter\ifx\csname ALG@c@#2@#1\endcsname\relax%
- \let\ALG@currentvalue\relax%
+ \edef\ALG@thisblock{\csname ALG@currentblock@\theALG@nested\endcsname}%
+ \expandafter\ifx\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\relax%
+ \def\ALG@thisblock{0}%
+ \fi%
+ \ALG@getentitytext%
+ \ifnum\ALG@thisblock=0\else\ALG@doend\fi%
+ \ifx\ALG@text\ALG@x@notext%
+ \item[]\nointerlineskip%\vskip-\prevdepth\nointerlineskip% bug: if there are no text and no lines, then this is wrong
\else%
- \edef\ALG@currentvalue{\csname ALG@c@#2@#1\endcsname}%
+ \item%
\fi%
- \ALG@ifnotrelax{#1}{#2}%
- {%
- \item\hskip-\ALG@ctlm% default spacing
- }%
- \expandafter\let\expandafter\ALG@entitiecommand\csname ALG@t@#1@#2\endcsname%
+ \noindent\hskip\ALG@tlm%
+ \expandafter\ifnum0=\csname ALG@b@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname\else%
+ \ALG@dobegin%
+ \fi%
+ \def\ALG@entitiecommand{\ALG@displayentity}%
}%
%
-\def\ALG@changeblock#1% #1 - the entitie
+\def\ALG@getentitytext%
{%
- \setcounter{ALG@tmpcounter}{\ALG@currentitem}%
- \expandafter\ifnum0=\csname ALG@b@#1@\ALG@currentitem\endcsname\relax%
- \end{ALG@g}%
- \ALG@closeblock{\arabic{ALG@tmpcounter}}{#1}%
- \else%
- \end{ALG@g}%
- \ALG@openblock{\arabic{ALG@tmpcounter}}{#1}%
+ \expandafter\let\expandafter\ALG@text\csname ALG@t@\ALG@L @\ALG@thisentity @\ALG@thisblock\endcsname%
+ \ifx\ALG@text\ALG@x@default%
+ % block specific - default
+ \expandafter\let\expandafter\ALG@text\csname ALG@t@\ALG@L @\ALG@thisentity\endcsname%
+ \ifx\ALG@text\ALG@x@default%
+ % block specific - default, language specific - default
+ \def\ALG@text{\ALG@deftext{\ALG@thisentity}}%
+ \fi%
\fi%
}%
%
+\def\ALG@deftext{\csname ALG@deftext@\ALG@L\endcsname}%
+%
+\def\ALG@displayentity%
+ {%
+ \ifx\ALG@text\ALG@x@notext%
+ \let\ALG@text\relax%
+ \fi
+ \ALG@text%
+ }%
+%
+\def\ALG@closebyforce%
+ {%
+ \ALG@endblock%
+ }%
+%
\def\ALG@closeloops% closes all finite blocks
{%
- \ifx\ALG@currentvalue\relax%
+ \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
\else% only if it is finite
- \end{ALG@g}% the block must be ended by force,
+ \ALG@closebyforce% the block must be ended by force,
\ALG@closeloops% the command still runs
\fi%
}%
@@ -241,40 +250,33 @@
%
\def\ALG@createblock#1% create the block #1, if it does not exists
{%
- \@ifundefined{ALG@bl@#1}% needs to be created?
+ \@ifundefined{ALG@bl@\ALG@Ld @#1}% needs to be created?
{%
\addtocounter{ALG@blocknr}{1}% increment the block counter
- \expandafter\edef\csname ALG@bl@#1\endcsname{\arabic{ALG@blocknr}}% set the block number
+ \expandafter\edef\csname ALG@bl@\ALG@Ld @#1\endcsname{\arabic{ALG@blocknr}}% set the block number
}%
{}%
}%
%
% Get the block number
%
-\def\ALG@getblocknumber#1{\csname ALG@bl@#1\endcsname}%
+\def\ALG@getblocknumber#1{\csname ALG@bl@\ALG@Ld @#1\endcsname}%
%
% Create an entitie
%
\def\ALG@createentitie#1% create the entitie #1, if it does not exists
{%
- \@ifundefined{#1}% needs to be created?
+ \expandafter\ALG@edefcmd\csname #1\endcsname{\noexpand\ALG@makeentity{#1}}%
+ \@ifundefined{ALG@t@\ALG@Ld @#1}% the entity text is defined in this language?
{%
- \expandafter\edef\csname #1\endcsname{\noexpand\ALG@makeentitie{#1}}%
- \@ifundefined{algorithmic#1}% \algorithmic#1 exists?
- {%
- \expandafter\edef\csname algorithmic#1\endcsname{\noexpand\textbf{#1}}%
- }%
- {}%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#1\endcsname\ALG@x@default%
}%
{}%
}%
%
-\def\ALG@createtext#1#2% #1 = closed block; #2 = entitie; creates \ALG@t@#1@#2
+\def\ALG@createtext#1#2% #1 = closed block; #2 = entitie; creates \ALG@t@#2@#1
{%
- \expandafter\edef\csname ALG@t@#1@#2\endcsname%
- {%
- \expandafter\noexpand\csname algorithmic#2\endcsname%
- }%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#2@#1\endcsname\ALG@x@default%
}%
%
% End and Continue block
@@ -286,31 +288,27 @@
\ALG@createentitie{#3}% create the entitie
\ALG@createblock{#2}% create the old block, if needed
\ifthenelse{\equal{#1}{}}% whe need to open a new block?
- {\expandafter\edef\csname ALG@b@#3@\ALG@getblocknumber{#2}\endcsname{0}}% no, just close the old one
+ {\expandafter\edef\csname ALG@b@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{0}}% no, just close the old one
{% yes,
\ALG@createblock{#1}% create the block
- \expandafter\edef\csname ALG@b@#3@\ALG@getblocknumber{#2}\endcsname{\ALG@getblocknumber{#1}}% ending the old block opens a new one
+ \expandafter\edef\csname ALG@b@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{\ALG@getblocknumber{#1}}% ending the old block opens a new one
\ifthenelse{\equal{#4}{}}% infinite or finite credits?
- {\expandafter\let\csname ALG@c@#3@\ALG@getblocknumber{#2}\endcsname\relax}% infinite credits
- {\expandafter\edef\csname ALG@c@#3@\ALG@getblocknumber{#2}\endcsname{#4}}% finite credits
+ {\expandafter\let\csname ALG@c@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname\relax}% infinite credits
+ {\expandafter\edef\csname ALG@c@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{#4}}% finite credits
\ifthenelse{\equal{#5}{}}% default or specified indentation
- {\expandafter\let\csname ALG@i@#3@\ALG@getblocknumber{#2}\endcsname\ALG@defaultindent}% default indentation
- {\expandafter\edef\csname ALG@i@#3@\ALG@getblocknumber{#2}\endcsname{#5}}% indentation is specified
+ {\expandafter\let\csname ALG@i@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname\ALG@defaultindent}% default indentation
+ {\expandafter\edef\csname ALG@i@\ALG@Ld @#3@\ALG@getblocknumber{#2}\endcsname{#5}}% indentation is specified
}%
\ALG@createtext{\ALG@getblocknumber{#2}}{#3}%
}%
}%
%
-%
-% *** NEW VERSION ***
-%
-%
-% used macros
+% macros used in declarations
%
\def\ALG@p@endtext@E{\algrenewtext{\ALG@v@end}}%
\def\ALG@p@endtext@xE{\algrenewtext[\ALG@v@newblock]{\ALG@v@end}}%
-\def\ALG@p@endtext@N{\algnotext{\ALG@v@end}}%
-\def\ALG@p@endtext@xN{\algnotext[\ALG@v@newblock]{\ALG@v@end}}%
+\def\ALG@p@endtext@nE{\algnotext{\ALG@v@end}}%
+\def\ALG@p@endtext@xnE{\algnotext[\ALG@v@newblock]{\ALG@v@end}}%
\def\ALG@p@endtext@{}%
% starttext defines are more compex -- care must be taken for the optional parameters
\def\ALG@p@starttext@S{\ALG@p@s@process{\algrenewtext}}%
@@ -334,6 +332,9 @@
\def\ALG@p@s@param#1#2#3{#1{\ALG@v@start}[#2]{#3}\ALG@p@endtext}%
\def\ALG@p@s@defparam#1#2#3#4{#1{\ALG@v@start}[#2][#3]{#4}\ALG@p@endtext}%
% the rest of the crew
+\def\ALG@p@starttext@nS{\algnotext{\ALG@v@start}\ALG@p@endtext}%
+\def\ALG@p@starttext@nC{\algnotext{\ALG@v@start}\ALG@p@endtext}%
+\def\ALG@p@starttext@xnC{\algnotext[\ALG@v@oldblock]{\ALG@v@start}\ALG@p@endtext}%
\def\ALG@p@starttext@{\ALG@p@endtext}%
\def\ALG@p@indent@def#1{\def\ALG@v@indent{#1}\ALG@p@setup}%
\def\ALG@p@indent@{\def\ALG@v@indent{}\ALG@p@setup}%
@@ -381,40 +382,91 @@
\def\ALG@p@onS{\ALG@p@def{start}\ALG@p@def[S]{starttext}}%
\def\ALG@p@onc{\ALG@p@def{oldblock}\ALG@p@def{start}}%
\def\ALG@p@onC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[C]{starttext}}%
-\def\ALG@p@onxC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[xC]{starttext}}%
\def\ALG@p@one{\ALG@p@def{end}}%
\def\ALG@p@onE{\ALG@p@def{end}\ALG@p@def[E]{endtext}}%
+\def\ALG@p@onxC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[xC]{starttext}}%
\def\ALG@p@onxE{\ALG@p@def{end}\ALG@p@def[xE]{endtext}}%
-\def\ALG@p@onN{\ALG@p@def{end}\ALG@p@def[N]{endtext}}%
-\def\ALG@p@onxN{\ALG@p@def{end}\ALG@p@def[xN]{endtext}}%
+\def\ALG@p@onnS{\ALG@p@def{start}\ALG@p@def[nS]{starttext}}%
+\def\ALG@p@onnC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[nC]{starttext}}%
+\def\ALG@p@onnE{\ALG@p@def{end}\ALG@p@def[nE]{endtext}}%
+\def\ALG@p@onxnC{\ALG@p@def{oldblock}\ALG@p@def{start}\ALG@p@def[xnC]{starttext}}%
+\def\ALG@p@onxnE{\ALG@p@def{end}\ALG@p@def[xnE]{endtext}}%
\def\ALG@p@onb{\def\ALG@v@credits{}}%
\def\ALG@p@onl{\def\ALG@v@credits{1}}%
\def\ALG@p@onL{\ALG@p@def{credits}}%
\def\ALG@p@oni{\ALG@p@def{indent}}%
-\expandafter\def\csname ALG@p@on]\endcsname{\let\ALG@p@rec\relax}%
-%
-% param processing
%
-\def\ALG@p@process#1%
+\def\ALG@p@main#1%
{%
- \@ifundefined{ALG@p@on#1}%
- {\typeout{algdef: Ignoring unknown token #1}}%
- {\csname ALG@p@on#1\endcsname}%
- \ALG@p@rec%
- }%
-%
-\def\ALG@p@onx{\let\ALG@p@rec\ALG@p@processx}%
-%
-\def\ALG@p@processx#1%
- {%
- \@ifundefined{ALG@p@onx#1}%
+ \@ifundefined{ALG@ps@\ALG@p@state @#1}%
+ {%
+ \csname ALG@ps@\ALG@p@state @other\endcsname{#1}%
+ }%
{%
- \typeout{algdef: Ignoring sole x}%
- \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@process\ALG@p@process#1}%
+ \csname ALG@ps@\ALG@p@state @#1\endcsname%
}%
- {\csname ALG@p@onx#1\endcsname\let\ALG@p@rec\ALG@p@process}%
\ALG@p@rec%
}%
+% STATE : <<starting state>>
+\expandafter\def\csname ALG@ps@@]\endcsname{\let\ALG@p@rec\relax}%
+\def\ALG@ps@@s{\ALG@p@ons}%
+\def\ALG@ps@@S{\ALG@p@onS}%
+\def\ALG@ps@@c{\ALG@p@onc}%
+\def\ALG@ps@@C{\ALG@p@onC}%
+\def\ALG@ps@@e{\ALG@p@one}%
+\def\ALG@ps@@E{\ALG@p@onE}%
+\def\ALG@ps@@N{\typeout{algdef: 'N' obsoloted, use 'nE'.}\ALG@p@onnE}%
+\def\ALG@ps@@b{\ALG@p@onb}%
+\def\ALG@ps@@l{\ALG@p@onl}%
+\def\ALG@ps@@L{\ALG@p@onL}%
+\def\ALG@ps@@i{\ALG@p@oni}%
+\def\ALG@ps@@x{\def\ALG@p@state{x}}%
+\def\ALG@ps@@n{\def\ALG@p@state{n}}%
+\def\ALG@ps@@other#1{\typeout{algdef: Ignoring unknown token #1}}%
+% STATE : x
+\def\ALG@ps@x@C{\def\ALG@p@state{}\ALG@p@onxC}%
+\def\ALG@ps@x@E{\def\ALG@p@state{}\ALG@p@onxE}%
+\def\ALG@ps@x@N{\def\ALG@p@state{}\typeout{algdef: 'xN' obsoloted, use 'xnE'.}\ALG@p@onxnE}%
+\def\ALG@ps@x@n{\def\ALG@p@state{xn}}%
+\def\ALG@ps@x@other#1%
+ {%
+ \typeout{algdef: Ignoring 'x' before '#1'.}%
+ \def\ALG@p@state{}%
+ \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
+ }%
+% STATE : n
+\def\ALG@ps@n@S{\def\ALG@p@state{}\ALG@p@onnS}%
+\def\ALG@ps@n@C{\def\ALG@p@state{}\ALG@p@onnC}%
+\def\ALG@ps@n@E{\def\ALG@p@state{}\ALG@p@onnE}%
+\def\ALG@ps@n@x{\def\ALG@p@state{nx}}%
+\def\ALG@ps@n@other#1%
+ {%
+ \typeout{algdef: Ignoring 'n' before '#1'.}%
+ \def\ALG@p@state{}%
+ \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
+ }%
+% STATE : xn
+\def\ALG@ps@xn@C{\def\ALG@p@state{}\ALG@p@onxnC}%
+\def\ALG@ps@xn@E{\def\ALG@p@state{}\ALG@p@onxnE}%
+\def\ALG@ps@xn@x{\typeout{algdef: Ignoring 'x' after 'xn'.}}%
+\def\ALG@ps@xn@n{\typeout{algdef: Ignoring 'n' after 'xn'.}}%
+\def\ALG@ps@xn@other#1%
+ {%
+ \typeout{algdef: Ignoring 'xn' before '#1'.}%
+ \def\ALG@p@state{}%
+ \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
+ }%
+% STATE : nx
+\def\ALG@ps@nx@C{\def\ALG@p@state{}\ALG@p@onxnC}%
+\def\ALG@ps@nx@E{\def\ALG@p@state{}\ALG@p@onxnE}%
+\def\ALG@ps@nx@x{\typeout{algdef: Ignoring 'x' after 'nx'.}}%
+\def\ALG@ps@nx@n{\typeout{algdef: Ignoring 'n' after 'nx'.}}%
+\def\ALG@ps@nx@other#1%
+ {%
+ \typeout{algdef: Ignoring 'nx' before '#1'.}%
+ \def\ALG@p@state{}%
+ \def\ALG@p@rec{\let\ALG@p@rec\ALG@p@main\ALG@p@rec#1}%
+ }%
%
%
% *** User level block/entitie commands ***
@@ -433,7 +485,8 @@
\ALG@p@undef{indent}%
\ALG@p@undef{starttext}%
\ALG@p@undef{endtext}%
- \let\ALG@p@rec\ALG@p@process%
+ \def\ALG@p@state{}%
+ \let\ALG@p@rec\ALG@p@main%
\ALG@p@rec#1]%
\ALG@p@newblock%
}%
@@ -465,70 +518,269 @@
{%
\ifthenelse{\equal{#2}{}}{}%
{%
- \algnotext[#1]{#2}%
\ifthenelse{\equal{#1}{}}%
{%
- \expandafter\newcommand\csname algorithmic#2\endcsname%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#2\endcsname\relax%
+ \expandafter\newcommand\csname ALG@t@\ALG@Ld @#2\endcsname%
}%
{%
- \expandafter\newcommand\csname ALG@t@\ALG@getblocknumber{#1}@#2\endcsname%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname\relax%
+ \expandafter\newcommand\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname%
}%
}%
}%
%
-\newcommand\algnotext[2][]% [block]{entity}
+\def\ALG@letentitytext#1#2% [block]{entity}
{%
\ifthenelse{\equal{#2}{}}{}%
{%
\ifthenelse{\equal{#1}{}}%
{%
- \expandafter\let\csname algorithmic#2\endcsname\relax%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#2\endcsname%
}%
{%
- \expandafter\let\csname ALG@t@\ALG@getblocknumber{#1}@#2\endcsname\relax%
+ \expandafter\let\csname ALG@t@\ALG@Ld @#2@\ALG@getblocknumber{#1}\endcsname%
}%
}%
}%
%
+\newcommand\algnotext[2][]% [block]{entity}
+ {%
+ \ALG@letentitytext{#1}{#2}\ALG@x@notext%
+ }%
+%
\newcommand\algdefaulttext[2][]% [block]{entity}
{%
- \ifthenelse{\equal{#1}{}}%
+ \ALG@letentitytext{#1}{#2}\ALG@x@default%
+ }%
+%
+\def\ALG@notext*{\algnotext}%
+\def\algtext{\@ifnextchar{*}{\ALG@notext}{\algrenewtext}}%
+%
+%
+% *** LANGUAGE SWITCHING ***
+%
+%
+%
+\newcommand\algnewlanguage[1]%
+ {%
+ \@ifundefined{ALG@L@#1}% needs to be created?
+ {}%
{%
- \expandafter\def\csname algorithmic#2\endcsname{\textbf{#2}}%
+ \PackageError{algorithmicx}{Language '#1' already defined!}{}%
}%
+ \addtocounter{ALG@Lnr}{1}% increment the language counter
+ \expandafter\edef\csname ALG@L@#1\endcsname{\arabic{ALG@Lnr}}% set the language number
+ \edef\ALG@Ld{\csname ALG@L@#1\endcsname}%
+ \expandafter\let\csname ALG@bl@\ALG@Ld @\endcsname\ALG@bl@% the BIG block
+ \expandafter\let\csname ALG@bl@\ALG@Ld @@\endcsname\ALG@bl@% the BIG block
+ \algdef{SL}[STATE]{State}{0}{}%
+ \expandafter\def\csname ALG@deftext@\ALG@Ld\endcsname{\textbf}%
+ \algnewcommand\algorithmiccomment[1]{\hfill\(\triangleright\) ##1}%
+ \algnewcommand\algorithmicindent{1.5em}%
+ \algnewcommand\alglinenumber[1]{\footnotesize ##1:}%
+ \algnewcommand\ALG@beginalgorithmic\relax% for user overrides
+ \algnewcommand\ALG@endalgorithmic\relax% for user overrides
+ }%
+%
+\newcommand\algsetlanguage[1]%
+ {%
+ \@ifundefined{ALG@L@#1}% needs to be created?
{%
- \ALG@createtext{\ALG@getblocknumber{#1}}{#2}%
- }%
+ \PackageError{algorithmicx}{Language '#1' is not yet defined!}{}%
+ }{}%
+ \edef\ALG@L{\csname ALG@L@#1\endcsname}%
+ }%
+%
+\newcommand\algdeflanguage[1]%
+ {%
+ \@ifundefined{ALG@L@#1}% needs to be created?
+ {%
+ \PackageError{algorithmicx}{Language '#1' is not yet defined!}{}%
+ }{}%
+ \edef\ALG@Ld{\csname ALG@L@#1\endcsname}%
+ }%
+%
+\newcommand\alglanguage[1]%
+ {%
+ \algdeflanguage{#1}%
+ \algsetlanguage{#1}%
}%
%
-\def\ALG@notext*{\algnotext}%
-\def\algtext{\@ifnextchar{*}{\ALG@notext}{\algrenewtext}}%
+%
+% *** Defining language dependent stuff ***
+%
+%
+\def\ALG@eatoneparam#1{}%
+\def\ALG@defbasecmd#1#2%
+ {%
+ \edef\ALG@tmp{\expandafter\ALG@eatoneparam\string #2}%
+ \@ifundefined\ALG@tmp{\edef #2{\noexpand\csname ALG@cmd@\noexpand\ALG@L @\ALG@tmp\endcsname}}{}%
+ \expandafter#1\csname ALG@cmd@\ALG@Ld @\ALG@tmp\endcsname%
+ }%
+\newcommand\algnewcommand{\ALG@defbasecmd\newcommand}%
+\newcommand\algrenewcommand{\ALG@defbasecmd\renewcommand}%
+\def\ALG@letcmd{\ALG@defbasecmd\let}%
+\def\ALG@defcmd{\ALG@defbasecmd\def}%
+\def\ALG@edefcmd{\ALG@defbasecmd\edef}%
%
%
% *** OTHERS ***
%
%
-\algdef{SL}[STATE]{State}{0}{}%
\def\BState{\State \algbackskip}%
\def\Statex{\item[]}% an empty line
-\newcommand\algorithmiccomment[1]{\hfill\(\triangleright\) #1}%
+\newcommand\algrenewcomment{\algrenewcommand\algorithmiccomment}%
\def\Comment{\algorithmiccomment}%
\def\algref#1#2{\ref{#1}.\ref{#2}}%
+\algnewlanguage{default}%
+\algsetlanguage{default}%
%
%
-% *** LANGUAGE SWITCHING ***
+% *** Line breaks ***
%
%
-\newcommand\ALG@deflanguage[3]%#1#2#3%
+\newcommand\algbreak% for multiline parameters !!! needs fix
{%
- \ifthenelse{\equal{#2}{}}%
- {\expandafter\def\csname ALG@setlanguage@#1\endcsname{#3}}%
- {\def\ALG@tmp{\let\ALG@tmp\relax#3}\ALG@tmp}%
+ \item%
+% \hskip\ALG@parindent%!!! not yet implemented
+% \hskip-\algorithmicindent%
+ }%
+%
+\def\ALG@noputindents%
+ {%
+ \hskip\ALG@tlm%
}%
%
-\def\algsetlanguage#1%
+%
+% *** algorithm store / restore ***
+%
+%
+% store
+%
+\ALG@newcondstate{mustrestore}%
+\def\algstore%
{%
- \csname ALG@setlanguage@#1\endcsname%
+ \renewcommand\ALG@beginblock%
+ {%
+ \PackageError{algorithmicx}{The environment must be closed after store!}{}%
+ }%
+ \@ifstar{\ALG@starstore}{\ALG@nostarstore}%
+ }%
+\def\ALG@nostarstore#1% save all infos into #1 and terminate the algorithmic block
+ {%
+ \addtocounter{ALG@storecount}{1}%
+ \expandafter\global\expandafter\let\csname ALG@save@mustrestore@#1\endcsname\ALG@x@mustrestore%
+ \ALG@starstore{#1}%
+ }%
+\def\ALG@starstore#1%
+ {%
+ \@ifundefined{ALG@save@line@#1}{}%
+ {\PackageError{algorithmicx}{This save name '#1' is already used!}{}}%
+ \def\ALG@savename{#1}%
+ \expandafter\xdef\csname ALG@save@totalnr@\ALG@savename\endcsname{\theALG@nested}%
+ \expandafter\xdef\csname ALG@save@line@\ALG@savename\endcsname{\theALG@line}%
+ \expandafter\xdef\csname ALG@save@numberfreq@\ALG@savename\endcsname{\ALG@numberfreq}%
+ \expandafter\xdef\csname ALG@save@rem@\ALG@savename\endcsname{\theALG@rem}%
+ \let\ALG@storerepeat\ALG@store%
+ \ALG@storerepeat%
+ }%
+\def\ALG@store% simply terminate all open blocks
+ {%
+ \ifnum\theALG@nested=0\let\ALG@storerepeat\relax%
+ \else%
+ \expandafter\xdef\csname ALG@save@currentblock@\ALG@savename @\theALG@nested\endcsname%
+ {\csname ALG@currentblock@\theALG@nested\endcsname}%
+ \expandafter\ifx\csname ALG@currentlifetime@\theALG@nested\endcsname\relax%
+ \else%
+ \expandafter\xdef\csname ALG@save@currentlifetime@\ALG@savename @\theALG@nested\endcsname%
+ {\csname ALG@currentlifetime@\theALG@nested\endcsname}%
+ \fi%
+ \expandafter\xdef\csname ALG@save@ind@\ALG@savename @\theALG@nested\endcsname%
+ {\csname ALG@ind@\theALG@nested\endcsname}%
+ \ALG@closebyforce%
+ \fi%
+ \ALG@storerepeat%
}%
%
+% restore
%
+\def\algrestore%
+ {%
+ \@ifstar{\ALG@starrestore}{\ALG@nostarrestore}%
+ }%
+\def\ALG@starrestore%
+ {%
+ \let\ALG@restorerem\relax%
+ \let\ALG@restorereprem\relax%
+ \ALG@restoremain%
+ }%
+\def\ALG@nostarrestore%
+ {%
+ \let\ALG@restorerem\ALG@restoreremovesave%
+ \let\ALG@restorereprem\ALG@restorerepremovesave%
+ \ALG@restoremain%
+ }%
+\def\ALG@restoreremovesave%
+ {%
+ \expandafter\global\expandafter\let\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@line@\ALG@savename\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@rem@\ALG@savename\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@numberfreq@\ALG@savename\endcsname\relax%
+ }%
+\def\ALG@restorerepremovesave%
+ {%
+ \expandafter\global\expandafter\let\csname ALG@save@currentblock@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
+ \expandafter\global\expandafter\let\csname ALG@save@ind@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
+ }%
+\def\ALG@restoremain#1% restore all infos from #1 in an open algorithmic block
+ {%
+ \ifnum\theALG@line=0%
+ \else\PackageError{algorithmicx}{Restore might be used only at the beginning of the environment!}{}%
+ \fi%
+ \def\ALG@savename{#1}%
+ \expandafter\ifx\csname ALG@save@totalnr@\ALG@savename\endcsname\relax%
+ \PackageError{algorithmicx}{Save '\ALG@savename'\space not defined!!!}{}%
+ \fi%
+ \@ifundefined{ALG@save@mustrestore@\ALG@savename}{}%
+ {%
+ \addtocounter{ALG@storecount}{-1}%
+ \expandafter\global\expandafter\let\csname ALG@save@mustrestore@\ALG@savename\endcsname\relax%
+ }%
+ \setcounter{ALG@line}{\csname ALG@save@line@\ALG@savename\endcsname}%
+ \edef\ALG@numberfreq{\csname ALG@save@numberfreq@\ALG@savename\endcsname}%
+ \setcounter{ALG@rem}{\csname ALG@save@rem@\ALG@savename\endcsname}%
+ \setcounter{ALG@tmpcounter}{\csname ALG@save@totalnr@\ALG@savename\endcsname}%
+ \setcounter{ALG@nested}{0}%
+ \ALG@restorerem%
+ \let\ALG@restorerepeat\ALG@restore%
+ \ALG@restorerepeat%
+ }%
+\def\ALG@restore%
+ {%
+ \ifnum\theALG@tmpcounter>0%
+ \expandafter\edef\csname ALG@currentblock@\theALG@tmpcounter\endcsname%
+ {\csname ALG@save@currentblock@\ALG@savename @\theALG@tmpcounter\endcsname}%
+ \expandafter\ifx\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname\relax%
+ \expandafter\let\csname ALG@currentlifetime@\theALG@tmpcounter\endcsname\relax%
+ \else%
+ \expandafter\edef\csname ALG@currentlifetime@\theALG@tmpcounter\endcsname%
+ {\csname ALG@save@currentlifetime@\ALG@savename @\theALG@tmpcounter\endcsname}%
+ \fi%
+ %
+ \ALG@beginblock{\csname ALG@save@ind@\ALG@savename @\theALG@tmpcounter\endcsname}%
+ \ALG@restorereprem%
+ \addtocounter{ALG@tmpcounter}{-1}%
+ \else\let\ALG@restorerepeat\relax%
+ \fi%
+ \ALG@restorerepeat%
+ }%
+\AtEndDocument%
+ {%
+ \ifnum\theALG@storecount>0\relax%
+ \PackageError{algorithmicx}{Some stored algorithms are not restored!}{}%
+ \fi%
+ }%
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algpascal.sty b/Master/texmf-dist/tex/latex/algorithmicx/algpascal.sty
index df4c81e37e6..0c9a57779f4 100644
--- a/Master/texmf-dist/tex/latex/algorithmicx/algpascal.sty
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algpascal.sty
@@ -1,8 +1,8 @@
-% A PASCAL LIKE ALGORITHMIC STYLE -- Released 18 MAR 2004
+% A PASCAL LIKE ALGORITHMIC STYLE -- Released 27 APR 2005
% for LaTeX version 2e
%
% Copyright Szasz Janos
-% E-mail szaszjanos@users.sourceforge.net
+% E-mail szaszjanos@sourceforge.net
%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{algpascal}%
@@ -10,46 +10,35 @@
\RequirePackage{algorithmicx}%
\typeout{Document Style - pascal environments for the `algorithmicx' style}%
%
-\def\ALG@setpascal{t}%
-\DeclareOption{noset}{\def\ALG@setpascal{}}%
-\DeclareOption{set}{\def\ALG@setpascal{t}}%
\ProcessOptions%
%
%
% *** DECLARATIONS ***
%
%
-\ALG@deflanguage{pascal}{\ALG@setpascal}%
-{%
+\algnewlanguage{pascal}%
+\alglanguage{pascal}%
%
% *** KEYWORDS ***
%
-\newcommand\textkeyword{\textbf}%
+\algnewcommand\textkeyword{\textbf}%
%
% *** DECLARED BLOCKS AND LOOPS ***
%
\algdef{SEi}{Begin}{End}{0cm}{\textkeyword{begin}}{\textkeyword{end}}%
\algdef{Sei}{Asm}{End}{0cm}{\textkeyword{asm}}%
%
-\algdef{lS}{For}[2]{\textkeyword{for} \(##1\) \textkeyword{to} \(##2\) \textkeyword{do}}%
-\algdef{lS}{While}[1]{\textkeyword{while} \(##1\) \textkeyword{do}}%
-\algdef{lS}{With}[1]{\textkeyword{with}\ \(##1\) \textkeyword{do}}%
-\algdef{SE}{Repeat}{Until}{\textkeyword{repeat}}[1]{\textkeyword{until}\ \(##1\)}%
-\algdef{lS}{If}[1]{\textkeyword{if}\ \(##1\) \textkeyword{then}}%
+\algdef{lS}{For}[2]{\textkeyword{for} \(#1\) \textkeyword{to} \(#2\) \textkeyword{do}}%
+\algdef{lS}{While}[1]{\textkeyword{while} \(#1\) \textkeyword{do}}%
+\algdef{lS}{With}[1]{\textkeyword{with}\ \(#1\) \textkeyword{do}}%
+\algdef{SE}{Repeat}{Until}{\textkeyword{repeat}}[1]{\textkeyword{until}\ \(#1\)}%
+\algdef{lS}{If}[1]{\textkeyword{if}\ \(#1\) \textkeyword{then}}%
\algdef{lC}{If}{Else}{\textkeyword{else}}%
%
% *** OTHER DECLARATIONS ***
%
-\def\Procedure{\State\textkeyword{procedure}\space}%
-\def\Function{\State\textkeyword{function}\space}%
+\algnewcommand\Procedure{\State\textkeyword{procedure}\space}%
+\algnewcommand\Function{\State\textkeyword{function}\space}%
%
-\renewcommand\algorithmiccomment[1]{\hfill\{##1\}}%
-%
-%
-%
-}%
-%
-%
-%
-\let\ALG@setpascal\relax%
+\algrenewcomment[1]{\hfill\{#1\}}%
%
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty b/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
index ba7a5d57329..fca966ac658 100644
--- a/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
+++ b/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
@@ -1,4 +1,4 @@
-% PSEUDOCODE ALGORITHMIC STYLE -- Released 18 MAR 2004
+% PSEUDOCODE ALGORITHMIC STYLE -- Released 27 APR 2005
% for LaTeX version 2e
%
% Copyright Szasz Janos
@@ -11,63 +11,59 @@
\RequirePackage{algorithmicx}%
\typeout{Document Style - pseudocode environments for use with the `algorithmicx' style}%
%
-\def\ALG@setpseudocode{t}%
-\newboolean{ALG@noend}%
-\setboolean{ALG@noend}{false}%
+\def\ALG@noend{f}%
\newboolean{ALG@compatible}%
\setboolean{ALG@compatible}{false}%
%
-\DeclareOption{noset}{\def\ALG@setpseudocode{}}%
-\DeclareOption{set}{\def\ALG@setpseudocode{t}}%
-\DeclareOption{noend}{\setboolean{ALG@noend}{true}}%
-\DeclareOption{end}{\setboolean{ALG@noend}{false}}%
-\DeclareOption{compatible}{\setboolean{ALG@compatible}{true}}%
+\DeclareOption{noend}{\def\ALG@noend{t}}%
+\DeclareOption{end}{\def\ALG@noend{f}}%
+\DeclareOption{compatible}{\typeout{For compatibility mode use algcompatible.sty!!!}\setboolean{ALG@compatible}{true}}%
\DeclareOption{noncompatible}{\setboolean{ALG@noncompatible}{false}}%
\ProcessOptions%
%
% *** DECLARATIONS ***
%
-\ALG@deflanguage{pseudocode}{\ALG@setpseudocode}%
-{%
+\algnewlanguage{pseudocode}%
+\alglanguage{pseudocode}%
%
% *** KEYWORDS ***
%
-\newcommand\algorithmicend{\textbf{end}}
-\newcommand\algorithmicdo{\textbf{do}}
-\newcommand\algorithmicwhile{\textbf{while}}
-\newcommand\algorithmicfor{\textbf{for}}
-\newcommand\algorithmicforall{\textbf{for all}}
-\newcommand\algorithmicloop{\textbf{loop}}
-\newcommand\algorithmicrepeat{\textbf{repeat}}
-\newcommand\algorithmicuntil{\textbf{until}}
-\newcommand\algorithmicprocedure{\textbf{procedure}}
-\newcommand\algorithmicfunction{\textbf{function}}
-\newcommand\algorithmicif{\textbf{if}}
-\newcommand\algorithmicthen{\textbf{then}}
-\newcommand\algorithmicelse{\textbf{else}}
-\newcommand\algorithmicrequire{\textbf{Require:}}
-\newcommand\algorithmicensure{\textbf{Ensure:}}
-\newcommand{\algorithmicreturn}{\textbf{return}}
-\newcommand\textproc{\textsc}
+\algnewcommand\algorithmicend{\textbf{end}}
+\algnewcommand\algorithmicdo{\textbf{do}}
+\algnewcommand\algorithmicwhile{\textbf{while}}
+\algnewcommand\algorithmicfor{\textbf{for}}
+\algnewcommand\algorithmicforall{\textbf{for all}}
+\algnewcommand\algorithmicloop{\textbf{loop}}
+\algnewcommand\algorithmicrepeat{\textbf{repeat}}
+\algnewcommand\algorithmicuntil{\textbf{until}}
+\algnewcommand\algorithmicprocedure{\textbf{procedure}}
+\algnewcommand\algorithmicfunction{\textbf{function}}
+\algnewcommand\algorithmicif{\textbf{if}}
+\algnewcommand\algorithmicthen{\textbf{then}}
+\algnewcommand\algorithmicelse{\textbf{else}}
+\algnewcommand\algorithmicrequire{\textbf{Require:}}
+\algnewcommand\algorithmicensure{\textbf{Ensure:}}
+\algnewcommand\algorithmicreturn{\textbf{return}}
+\algnewcommand\textproc{\textsc}
%
% *** DECLARED LOOPS ***
%
-\algdef{SE}[WHILE]{While}{EndWhile}[1]{\algorithmicwhile\ ##1\ \algorithmicdo}{\algorithmicend\ \algorithmicwhile}%
-\algdef{SE}[FOR]{For}{EndFor}[1]{\algorithmicfor\ ##1\ \algorithmicdo}{\algorithmicend\ \algorithmicfor}%
-\algdef{S}[FOR]{ForAll}[1]{\algorithmicforall\ ##1\ \algorithmicdo}%
+\algdef{SE}[WHILE]{While}{EndWhile}[1]{\algorithmicwhile\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicwhile}%
+\algdef{SE}[FOR]{For}{EndFor}[1]{\algorithmicfor\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicfor}%
+\algdef{S}[FOR]{ForAll}[1]{\algorithmicforall\ #1\ \algorithmicdo}%
\algdef{SE}[LOOP]{Loop}{EndLoop}{\algorithmicloop}{\algorithmicend\ \algorithmicloop}%
-\algdef{SE}[REPEAT]{Repeat}{Until}{\algorithmicrepeat}[1]{\algorithmicuntil\ ##1}%
-\algdef{SE}[IF]{If}{EndIf}[1]{\algorithmicif\ ##1\ \algorithmicthen}{\algorithmicend\ \algorithmicif}%
-\algdef{C}[IF]{IF}{ElsIf}[1]{\algorithmicelse\ \algorithmicif\ ##1\ \algorithmicthen}%
+\algdef{SE}[REPEAT]{Repeat}{Until}{\algorithmicrepeat}[1]{\algorithmicuntil\ #1}%
+\algdef{SE}[IF]{If}{EndIf}[1]{\algorithmicif\ #1\ \algorithmicthen}{\algorithmicend\ \algorithmicif}%
+\algdef{C}[IF]{IF}{ElsIf}[1]{\algorithmicelse\ \algorithmicif\ #1\ \algorithmicthen}%
\algdef{Ce}[ELSE]{IF}{Else}{EndIf}{\algorithmicelse}%
\algdef{SE}[PROCEDURE]{Procedure}{EndProcedure}%
- [2]{\algorithmicprocedure\ \textproc{##1}\ifthenelse{\equal{##2}{}}{}{(##2)}}%
+ [2]{\algorithmicprocedure\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}%
{\algorithmicend\ \algorithmicprocedure}%
\algdef{SE}[FUNCTION]{Function}{EndFunction}%
- [2]{\algorithmicfunction\ \textproc{##1}\ifthenelse{\equal{##2}{}}{}{(##2)}}%
+ [2]{\algorithmicfunction\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}%
{\algorithmicend\ \algorithmicfunction}%
%
-\ifthenelse{\boolean{ALG@noend}}%
+\ifthenelse{\equal{\ALG@noend}{t}}%
{%
\algtext*{EndWhile}%
\algtext*{EndFor}%
@@ -79,32 +75,18 @@
%
% *** OTHER DECLARATIONS ***
%
-\def\Require{\item[\algorithmicrequire]}
-\def\Ensure{\item[\algorithmicensure]}
-\def\Return{\algorithmicreturn{} }%
+\algnewcommand\Require{\item[\algorithmicrequire]}%
+\algnewcommand\Ensure{\item[\algorithmicensure]}%
+\algnewcommand\Return{\algorithmicreturn{} }%
+\algnewcommand\Call[2]{\textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}%
%
%
%
\ifthenelse{\boolean{ALG@compatible}}%
{%
- \let\WHILE\While\let\ENDWHILE\EndWhile%
- \let\FOR\For\let\FORALL\ForAll\let\ENDFOR\EndFor%
- \let\LOOP\Loop\let\ENDLOOP\EndLoop%
- \let\REPEAT\Repeat\let\UNTIL\Until%
- \let\PROCEDURE\Procedure\let\ENDPROCEDURE\EndProcedure%
- \let\FUNCTION\Function\let\ENDFUNCTION\EndFunction%
- \let\IF\If\let\ELSIF\ElsIf\let\ELSE\Else\let\ENDIF\EndIf%
- \let\REQUIRE\Require\let\ENSURE\Ensure%
- \let\STATE\State\let\STATEx\Statex%
- \let\COMMENT\Comment%
+ \ifthenelse{\equal{\ALG@noend}{t}}%
+ {\RequirePackage[noend]{algcompatible}}%
+ {\RequirePackage{algcompatible}}%
}%
{}%
%
-%
-%
-}%
-%
-%
-%
-\let\ALG@setpseudocode\relax%
-%
diff --git a/Master/texmf-dist/tpm/algorithmicx.tpm b/Master/texmf-dist/tpm/algorithmicx.tpm
index ad3788a49f2..f0730fa91e1 100644
--- a/Master/texmf-dist/tpm/algorithmicx.tpm
+++ b/Master/texmf-dist/tpm/algorithmicx.tpm
@@ -3,7 +3,7 @@
<rdf:Description about="http://texlive.dante.de/texlive/Package/algorithmicx.zip">
<TPM:Name>algorithmicx</TPM:Name>
<TPM:Type>Package</TPM:Type>
- <TPM:Date>2006/01/09 00:44:40</TPM:Date>
+ <TPM:Date>2005/04/28 13:47:00</TPM:Date>
<TPM:Version></TPM:Version>
<TPM:Creator>rahtz</TPM:Creator>
<TPM:Title>The algorithmic style you always wanted!</TPM:Title>
@@ -17,17 +17,19 @@ language.
[description copied from TeX Catalogue]
</TPM:Description>
<TPM:Author>Szasz Janos</TPM:Author>
- <TPM:Size>270201</TPM:Size>
+ <TPM:Size>285941</TPM:Size>
<TPM:Build/>
- <TPM:RunFiles size="26588">
+ <TPM:RunFiles size="39710">
texmf-dist/tex/latex/algorithmicx/algc.sty
+texmf-dist/tex/latex/algorithmicx/algcompatible.sty
texmf-dist/tex/latex/algorithmicx/algmatlab.sty
texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
texmf-dist/tex/latex/algorithmicx/algpascal.sty
texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
texmf-dist/tpm/algorithmicx.tpm
</TPM:RunFiles>
- <TPM:DocFiles size="243613">
+ <TPM:DocFiles size="243420">
+texmf-dist/doc/latex/algorithmicx/README
texmf-dist/doc/latex/algorithmicx/algorithmicx.pdf
texmf-dist/doc/latex/algorithmicx/algorithmicx.tex
</TPM:DocFiles>