summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-06 23:44:11 +0000
committerKarl Berry <karl@freefriends.org>2013-01-06 23:44:11 +0000
commita9ec77a042693fd60429f18a8c4a095105f624e6 (patch)
treee6f0cdca1f7ad0051416bb767c2e409995a1aaf1 /Master/texmf-dist/doc/latex
parentee04c8f00d7e705f71d02aa40a312252423dd4f3 (diff)
algorithm2e (6jan13)
git-svn-id: svn://tug.org/texlive/trunk@28749 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdfbin400133 -> 487487 bytes
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex970
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex04.tex3
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex05.tex2
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exProg.tex6
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric.tex36
-rw-r--r--Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exswitch.tex2
7 files changed, 667 insertions, 352 deletions
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf
index b0a7c08dd82..2b19fceb269 100644
--- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex
index 3bc2c09baed..496cc8f6e36 100644
--- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex
@@ -1,12 +1,12 @@
% algorithm2e.tex --- doc of the package file for algorithms
%
% (c) 1995-1997 Christophe Fiorio, Tu-Berlin, Germany
-% (c) 1998-2009 Christophe Fiorio, Montpellier 2 University, France
+% (c) 1998-2013 Christophe Fiorio, Montpellier 2 University, France
%
% Report bugs and comments to:
% christophe.fiorio@univ-montp2.fr
%
-% $Id: algorithm2e.tex,v 1.38 2009/12/15 08:54:36 cfiorio Exp $
+% $Id: algorithm2e.tex,v 5.0 2013/01/06 14:44:54 cfiorio Exp $
%
\documentclass[a4paper]{article}
@@ -40,6 +40,7 @@
\newcommand\almacpppp[5]{$\backslash$\texttt{#1\{#2\}\{#3\}\{#4\}\{#5\}}\index{#1@\texttt{$\protect\backslash$#1}|textit}}
\newcommand\almacpsix[7]{$\backslash$\texttt{#1\{#2\}\{#3\}\{#4\}\{#5\}\{#6\}\{#7\}}\index{#1@\texttt{$\protect\backslash$#1}|textit}}
\newcommand\almacphuit[9]{$\backslash$\texttt{#1\{#2\}\{#3\}\{#4\}\{#5\}\{#6\}\{#7\}\{#8\}\{#9\}}\index{#1@\texttt{$\protect\backslash$#1}|textit}}
+\newcommand\Alenv[1]{\texttt{#1}\index{#1@\texttt{#1}|textbf}}
\newcommand\Almac[1]{$\backslash$\texttt{#1}\index{#1@\texttt{$\protect\backslash$#1}|textbf}}
\newcommand\Almacp[2]{$\backslash$\texttt{#1\{#2\}}\index{#1@\texttt{$\protect\backslash$#1}|textbf}}
\newcommand\Almacpp[3]{$\backslash$\texttt{#1\{#2\}\{#3\}}\index{#1@\texttt{$\protect\backslash$#1}|textbf}}
@@ -57,9 +58,12 @@
%
\newcommand{\optslide}{\textsf{slide}\index{french@\textsf{slide}|textit}\xspace}
\newcommand{\optalgoe}{\textsf{algo2e}\index{french@\textsf{algo2e}|textit}\xspace}
-\newcommand{\optfrench}{\textsf{french}\index{french@\textsf{french}|textit}\xspace}
\newcommand{\optenglish}{\textsf{english}\index{english@\textsf{english}|textit}\xspace}
+\newcommand{\optfrench}{\textsf{french}\index{french@\textsf{french}|textit}\xspace}
\newcommand{\optgerman}{\textsf{german}\index{german@\textsf{german}|textit}\xspace}
+\newcommand{\optngerman}{\textsf{ngerman}\index{ngerman@\textsf{ngerman}|textit}\xspace}
+\newcommand{\optspanish}{\textsf{spanish}\index{spanish@\textsf{spanish}|textit}\xspace}
+\newcommand{\optcroatian}{\textsf{croatian}\index{croatian@\textsf{croatian}|textit}\xspace}
\newcommand{\optportuguese}{\textsf{portuguese}\index{portuguese@\textsf{portuguese}|textit}\xspace}
\newcommand{\optczech}{\textsf{czech}\index{czech@\textsf{czech}|textit}\xspace}
\newcommand{\optitaliano}{\textsf{italiano}\index{italiano@\textsf{italiano}|textit}\xspace}
@@ -98,11 +102,15 @@
\newcommand{\optprocnumbered}{\textsf{procnumbered}\index{procnumbered@\textsf{procnumbered}|textit}\xspace}
\newcommand{\optoldcommands}{\textsf{oldcommands}\index{oldcommands@\textsf{oldcommands}|textit}\xspace}
\newcommand{\optnokwfunc}{\textsf{nokwfunc}\index{nokwfunc@\textsf{nokwfunc}|textit}\xspace}
+\newcommand{\optblockmarkers}{\textsf{displayblockmarkers}\index{displayblockmarkers@\textsf{displayblockmarkers}|textit}\xspace}
%
\newcommand{\Optfrench}{\textsf{french}\index{french@\textsf{french}|textbf}\xspace}
\newcommand{\Optenglish}{\textsf{english}\index{english@\textsf{english}|textbf}\xspace}
-\newcommand{\Optgerman}{\textsf{german}\index{german@\textsf{german}|textit}\xspace}
-\newcommand{\Optportugues}{\textsf{portugues}\index{portugues@\textsf{portugues}|textit}\xspace}
+\newcommand{\Optgerman}{\textsf{german}\index{german@\textsf{german}|textbf}\xspace}
+\newcommand{\Optngerman}{\textsf{ngerman}\index{ngerman@\textsf{ngerman}|textbf}\xspace}
+\newcommand{\Optspanish}{\textsf{spanish}\index{spanish@\textsf{spanish}|textbf}\xspace}
+\newcommand{\Optcroatian}{\textsf{croatian}\index{croatian@\textsf{croatian}|textbf}\xspace}
+\newcommand{\Optportugues}{\textsf{portugues}\index{portugues@\textsf{portugues}|textbf}\xspace}
\newcommand{\Optczech}{\textsf{czech}\index{czech@\textsf{czech}|textbf}\xspace}
\newcommand{\Optitaliano}{\textsf{italiano}\index{italiano@\textsf{italiano}|textbf}\xspace}
\newcommand{\Optslovak}{\textsf{slovak}\index{slovak@\textsf{slovak}|textbf}\xspace}
@@ -140,6 +148,7 @@
\newcommand{\Optprocnumbered}{\textsf{procnumbered}\index{procnumbered@\textsf{procnumbered}|textbf}\xspace}
\newcommand{\Optoldcommands}{\textsf{oldcommands}\index{oldcommands@\textsf{oldcommands}|textbf}\xspace}
\newcommand{\Optnokwfunc}{\textsf{nokwfunc}\index{nokwfunc@\textsf{nokwfunc}|textbf}\xspace}
+\newcommand{\Optblockmarkers}{\textsf{displayblockmarkers}\index{displayblockmarkers@\textsf{displayblockmarkers}|textbf}\xspace}
%%%
\newcommand{\ExampleOfAlgo}[1]{%
\begin{minipage}{.4\textwidth}%
@@ -152,21 +161,21 @@
\end{minipage}%
}
%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\algocfversion}{release 4.01} \title{algorithm2e.sty --- package for algorithms\\
- {\large\algocfversion}}
+\newcommand{\algocfversion}{release 5.0}
+\title{algorithm2e.sty --- package for algorithms\\ {\large\algocfversion}}
\author{(c) 1995-1997 Christophe Fiorio, Tu-Berlin, Germany\\
- (c) 1998-2009 Christophe Fiorio, LIRMM, Montpellier 2 University, France\\
- Report bugs and comments to christophe.fiorio@univ-montp2.fr\\
+(c) 1998-2013 Christophe Fiorio, LIRMM, Montpellier 2 University, France\\
+ Report bugs and comments to cfiorio@um2.fr\\
algorithm2esty-annonce@lirmm.fr mailing list for announcements\\
- algorithm2esty-discussion@lirmm.fr mailing list for discussion\thanks{The author is very grateful to David
- Carlisle, one of the authors of the LaTeX Companion book, for his advices} \thanks{Martin Blais for his
- suggestions} \thanks{David A. Bader for his new option \texttt{noend}} \thanks{Gilles Geeraerts for his new
- command \texttt{SetKwIfElseIf}} \thanks{Ricardo Fukasawa for the portuguese keywords} \thanks{Christian Icking
- for the german translation of keywords} \thanks{Arnaud Giersch for his suggestions and corrections on
- SetKwComments} \thanks{Nathan Tallent for his $\backslash$SetKwHangingKw macro} \thanks{and the many users as
- Jean-Baptiste Rouquier for their remarks} }
-
-\date{december 14 2009}
+ algorithm2esty-discussion@lirmm.fr mailing list for discussion\thanks{The author is very grateful
+ to David Carlisle, one of the authors of the LaTeX Companion book, for his advices} \thanks{Martin Blais for his
+ suggestions} \thanks{David A. Bader for his new option
+ \texttt{noend}} \thanks{Gilles Geeraerts for his new
+ command \texttt{SetKwIfElseIf}} \thanks{Ricardo Fukasawa for the portuguese keywords} \thanks{Christian Icking
+ for the german translation of keywords}
+ \thanks{Arnaud Giersch for his suggestions and corrections on SetKwComments}
+\thanks{and the many users as Jean-Baptiste Rouquier
+ for their remarks} } \date{january 06 2013}
\makeindex
@@ -195,8 +204,8 @@ In order to subscribe to the mailing lists you have to send an email to
Name} or\\\texttt{subscribe algorithm2e-discussion Firstname
Name} in the body of the message.\makeatother
-Changes from one release to the next are indicated in release notes at the beginning of the packages. For release
-4.0, changes are indicated at the end of this document.
+Changes from one release to the next are indicated in release notes at the beginning of the packages. For this
+release (5.0), changes are indicated at the end of this document.
\section{How to use it: abstract}
@@ -306,15 +315,160 @@ The \LaTeX2e code on next page gives \autoref{IR}. Here lines are not autonumber
individually with \almac{nl} command as for \autoref{InRes1} or \autoref{InRes2}. You even can set your own
reference with \almac{nlset} command and get back this reference by simply using classical \almac{ref}. For
example \texttt{$\backslash$ref\{InResR\}} gives \ref{InResR}.\par
+{%
\RestyleAlgo{algoruled}\SetAlgoVlined\LinesNotNumbered\input{algorithm2e_exIR.tex}
\noindent\fbox{%
\begin{minipage}[c]{\textwidth}%
\verbatiminput{algorithm2e_exIR.tex}%
\end{minipage}\label{code:algoIR}%
-}%
+}}%
\par
\clearpage
+%%%%%%%%%%%%%
+\section{Genericity and example of languages}
+
+In this section, we will try to show you main macros and how you can use this package to
+suit your need. Based on one example using most popular algorithms expressions, we will
+show you how it can be configured to be display in pseudo-code, in python or in C.
+
+The following code shows how is typeset the generic example we'll use in this section:\par
+{%
+\noindent\fbox{%
+ \begin{minipage}[c]{\textwidth}%
+ \verbatiminput{algorithm2e_exgeneric}%
+ \end{minipage}\label{code:exgeneric}%
+}}%
+\par\medskip
+To handle \texttt{if} condition, use a macro to be abble to change it according to
+language syntax, in particular we will change it for python-style and c-style. We also
+define a function to write algorithm as a recursive function. These macros are defined as:\vspace{-1.5ex}
+\begin{verbatim}
+\newcommand{\forcond}{$i=0$ \KwTo $n$}
+\SetKwFunction{FRecurs}{FnRecursive}%
+\end{verbatim}
+
+The \autoref{algo:pseudocode} shows how algorithm is displayed in pseudo-code with default
+behaviour and options \texttt{boxed}, \texttt{commentsnumbered} and \texttt{longend}
+set. Note that by default, lines are used to show block of code. Note also that
+\texttt{longend} option makes package use special \emph{end} keyword for each
+command\footnote{Default behaviour uses \emph{short end} keywords, it means typeseting only
+ \emph{end}.}.
+\SetKwProg{Fn}{Function}{}{end}\SetKwFunction{FRecurs}{FnRecursive}%
+\newcommand{\forcond}{$i=0$ \KwTo $n$}
+\begin{algorithm}\SetAlgoLongEnd
+ \caption{Generic example with most classical expressions derived in pseudo-code}%
+ \label{algo:pseudocode}
+ \input{algorithm2e_exgeneric}
+\end{algorithm}
+
+The \autoref{algo:pseudocodeblock} shows how algorithm is displayed using automatic block
+display (new feature since relase 5.0). To achieve this display, we only add following
+macros at start of the algorithm:\vspace{-1.5ex}
+\begin{verbatim}
+\AlgoDisplayBlockMarkers\SetAlgoBlockMarkers{begin}{end}%
+\SetAlgoNoEnd
+\end{verbatim}
+\vspace{-1.5ex}First one tells package to display blocks with keyword markers. Note that
+the definition of block markers are the one by default. Last macro remove end keywords of
+commands to avoid a double end (the one of block marker and the one of command).
+\begin{algorithm}\AlgoDisplayBlockMarkers\SetAlgoNoEnd\SetAlgoBlockMarkers{begin}{end}
+ \caption{Generic example in pseudo-code with begin-end block set}\label{algo:pseudocodeblock}
+ \input{algorithm2e_exgeneric}
+\end{algorithm}\medskip
+
+The \autoref{algo:pythoncodeblock} shows how algorithm looks like with a python-style
+syntax. To achieve this display, we need to make following changes before the algorithm:\vspace{-1.5ex}
+\begin{verbatim}
+\SetStartEndCondition{ }{}{}%
+\SetKwProg{Fn}{def}{\string:}{}
+\SetKwFunction{Range}{range}%%
+\SetKw{KwTo}{in}\SetKwFor{For}{for}{\string:}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{:}{elif}{else:}{}%
+\SetKwFor{While}{while}{:}{fintq}%
+\renewcommand{\forcond}{$i$ \KwTo\Range{$n$}}
+\AlgoDontDisplayBlockMarkers\SetAlgoNoEnd\SetAlgoNoLine%
+\end{verbatim}
+\vspace{-1.5ex}\texttt{SetStartEndCondition} is used to display alternatives and loops
+conditions according to python syntax: it means a space before condition, and no space
+after since ':' marks end of condition. Functions are defined with \emph{def} in python,
+so we redefine \texttt{$\backslash$Fn} macro. \texttt{Range} is a new macro for
+\emph{range} python function. Next are redefined \emph{For}, \emph{If} and \emph{While}
+commands accordingly to python syntax. Note that we do nothing for \emph{repeat-until}
+command since it doesn't exist in python. For condition is redefined to match python
+behaviour. At last we tell package to not display block, to
+not display end keyword and to not print line according to python syntax.%
+\renewcommand{\forcond}{$i$ \KwTo\Range{$n$}}
+\begin{algorithm} \AlgoDontDisplayBlockMarkers\SetAlgoNoEnd\SetAlgoNoLine%
+\SetStartEndCondition{ }{}{}%
+\SetKwProg{Fn}{def}{\string:}{}%
+\SetKw{KwTo}{in}\SetKwFunction{Range}{range}%
+\SetKwFor{For}{for}{\string:}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{:}{elif}{else:}{}%
+\SetKwFor{While}{while}{:}{fintq}%
+ \caption{Generic example in python-style like syntax}\label{algo:pythoncodeblock}
+ \input{algorithm2e_exgeneric}
+\end{algorithm}
+
+ The \autoref{algo:ccodeblock} shows how algorithm looks like with a c-style
+syntax. To achieve this display, we need to make following changes before the algorithm:\vspace{-1.5ex}
+\begin{verbatim}
+\SetStartEndCondition{ (}{)}{)}\SetAlgoBlockMarkers{\{}{\}}%
+\SetKwProg{Fn}{}{}{}\SetKwFunction{FRecurs}{void FnRecursive}%
+\SetKwFor{For}{for}{}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{}{elif}{else}{}%
+\SetKwFor{While}{while}{}{}%
+\SetKwRepeat{Repeat}{repeat}{until}%
+\AlgoDisplayBlockMarkers\SetAlgoNoLine%
+\end{verbatim}
+\vspace{-1.5ex} \texttt{SetStartEndCondition} set braces around conditions like in C. We
+want that each block is marked with \{ at start and \} at end, so we set it thanks to
+\texttt{$\backslash$SetAlgoBlockMarkers} macro. \texttt{$\backslash$Fn} is redefined with
+no keyword since in C, name of function defines it. Then we redefin \texttt{FnRecursive}
+with its type. Next, \emph{For}, \emph{If}, \emph{While} and \emph{Repeat} are redefined
+accordingly to C syntax. At last, we tell the package to display block markers.
+\SetKwFunction{FRecurs}{void FnRecursive}%
+\begin{algorithm}\AlgoDisplayBlockMarkers\SetAlgoNoLine%
+\SetStartEndCondition{ (}{)}{)}\SetAlgoBlockMarkers{\{}{\}}%
+\SetKwProg{Fn}{}{}{}%
+\SetKwFor{For}{for}{}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{}{elif}{else}{}%
+\SetKwFor{While}{while}{}{}%
+\SetKwRepeat{Repeat}{repeat}{until}%
+ \caption{Generic example in c-style like syntax}\label{algo:ccodeblock}
+ \input{algorithm2e_exgeneric}
+\end{algorithm}
+
+The \autoref{algo:ccodeblockcf} shows how algorithm looks like with a c-style
+syntax and a more compact way to mark blocks. To achieve this display, we need to make following changes before the algorithm:\vspace{-1.5ex}
+\begin{verbatim}
+\SetStartEndCondition{ (}{)}{)}\SetAlgoBlockMarkers{}{\}}%
+\SetKwProg{Fn}{}{\{}{}\SetKwFunction{FRecurs}{void FnRecursive}%
+\SetKwFor{For}{for}{\{}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{\{}{elif}{else\{}{}%
+\SetKwFor{While}{while}{\{}{}%
+\SetKwRepeat{Repeat}{repeat\{}{until}%
+\AlgoDisplayBlockMarkers\SetAlgoNoLine%
+\end{verbatim}
+\vspace{-1.5ex} If you look at \autoref{algo:pseudocode}, you can see that some command
+doesn't put a end. For example, it is a case for a \emph{if} followed by an \emph{else},
+same thing for a \emph{else if}. In C, there is always an end marker. So, to achieve our
+goal we need to use end marker of blocks. But we don't want displaying begin marker as in
+\autoref{algo:pseudocodeblock} or \autoref{algo:ccodeblock}. If begin block marker is set to
+empty, then nothing is written (especially not a blank line). So we tell package to use
+block markers with an empty marker for begin and a \} for end. Now we have to tell package
+to write a \{ on the same line as commands. This is achieve by redefining \emph{If},
+\emph{For}, \emph{While} and \emph{Repeat} command.
+\begin{algorithm}\AlgoDisplayBlockMarkers\SetAlgoLongEnd\SetAlgoNoLine%
+\SetStartEndCondition{ (}{)}{)}\SetAlgoBlockMarkers{}{\}}%
+\SetKwProg{Fn}{}{\{}{}%
+\SetKwFor{For}{for}{\{}{}%
+\SetKwIF{If}{ElseIf}{Else}{if}{\{}{elif}{else\{}{}%
+\SetKwFor{While}{while}{\{}{}%
+\SetKwRepeat{Repeat}{repeat\{}{until}%
+ \caption{Generic example in c-style like syntax with compact block}\label{algo:ccodeblockcf}
+ \input{algorithm2e_exgeneric}
+\end{algorithm}
%%%%%%%%%%%%%
@@ -411,7 +565,7 @@ If you don't like algorithm or look for something else, you can change the name
below:
\begin{description}
\item[\almacppp{SetAlgorithmName}{algorithmname}{algorithmautorefname}{list of algorithms name}] which redefines
- name of the algorithms and the sentence list of algorithms. Example: \almacpp{SetAlgorithmName}{Protocol}{List of
+ name of the algorithms and the sentence list of algorithms. Example:\\\noindent\almacpp{SetAlgorithmName}{Protocol}{List of
protocols} if you prefer protocol than algorithm. Second argument is the name that \almac{autoref}, from
\texttt{hyperref}\index{hyperref} package, will use.
\end{description}
@@ -430,23 +584,19 @@ keep its original name:
\section{The options of the package\label{sec_options}}
+
+%--------------------------------------------------------------------------
+\subsection{language option}
+\label{sec:option:language}
\begin{description}
-\item[\optalgoe:] changes the name of environment algorithm into algorithm2e
- and so allows to use the package with some journal style which already define
- an algorithm environment. Changes also the command name for the list of
- algorithms, it becomes \Almac{listofalgorithmes}
-\item[\optslide:] require package color. To be used with slide class in order to have correct margins.
-\item[\Optnorelsize:] starting from this release v4.00, algorithm2e package uses relsize package in order to get
- relative size for lines numbers; but it seems that some rare classes (such as inform1.cls) are not compatible
- with relsize; to have algorithm2e working, this option makes algorithm2e not to load relsize package and go back
- to previous definition by using \scriptsize font for lines numbers.
-\medskip
+\item[\Optcroatian:] to have for example \textsl{Algoritam:} instead of \textsl{algorithm:}. \medskip
+\item[\Optczech:] to have for example \textsl{Algoritmus:} instead of \textsl{algorithm:}.
\item[\Optenglish:] the default.
\item[\Optfrench:] to have for example \textsl{algorithme\ :} instead of \textsl{algorithm:}.
\item[\Optgerman:] to have for example \textsl{Prozedur\ :} instead of \textsl{procedure:}. \medskip
+\item[\Optngerman:] to have german option as babel
\item[\Optportugues:] to have for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip
-\item[\Optczech:] to have for example \textsl{Algoritmus:} instead of
- \textsl{algorithm:}.
+\item[\Optspanish:] to have for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip
\item[\Optonelanguage:] allows, if using standard keywords listed below, to switch from one language to another
without changing keywords by using appropriate language option:
\begin{itemize}
@@ -459,27 +609,85 @@ keep its original name:
\item \texttt{Switch, Case, Other}
\item \texttt{For, ForPar, ForEach, ForAll, While}
\end{itemize}
-\medskip
-\item[\Optfigure :] algorithms are put in classical figures and so are numbered as
- figures and putted in the $\backslash$\texttt{listoffigures}.\par
+\end{description}
+
+%--------------------------------------------------------------------------
+\subsection{compatibility issue}
+\label{sec:option:compatibility}
+
+\begin{description}
+\item[\optalgoe:] changes the name of environment algorithm into algorithm2e
+ and so allows to use the package with some journal style which already define
+ an algorithm environment. Changes also the command name for the list of
+ algorithms, it becomes \Almac{listofalgorithmes}
\item[\Optendfloat:] endfloat packages doesn't allow float environment inside other environment. So using it with
figure option of algorithm2e makes error. This option enables a new environment algoendfloat to be used instead
of algorithm environment that put algorithm at the end. algoendfloat environment make algorithm acting as
endfloat figures. This option load endfloat package, so it is required to have it.
-\medskip
-\item[\optalgopart :] algorithms are numbered within part numbers.
-\item[\optalgochapter :] algorithms are numbered within chapter numbers.
-\item[\optalgosection :] (default) algorithms are numbered within section numbers.
-\item[\Optprocnumbered:] makes the procedure and function to be numbered as algorithm.
-\medskip
+\item[\Optnorelsize:] starting from this release (v4.00), algorithm2e package uses relsize package in order to get
+ relative size for lines numbers; but it seems that some rare classes (such as inform1.cls) are not compatible
+ with relsize; to have algorithm2e working, this option makes algorithm2e not to load relsize package and go back
+ to previous definition by using $\backslash$\texttt{scriptsize} font for lines numbers.
+\item[\optslide:] require package color. To be used with slide class in order to have correct margins.
+\item[\Optnokwfunc] disable the setting in \almac{KwFunction} of procedure's or function's name (see \autoref{sec_envi})
+ of function and procedure environment. Useful if you use name of procedure or function that cannot be a command
+ name as a math display for example.
+\end{description}
+
+%--------------------------------------------------------------------------
+\subsection{environment display and use}
+\label{sec:option:envdisplay}
+
+%---------------------------------
+\subsubsection{boxed, ruled, plain environment}
+\label{sec:option:envdisplay:box}
+
+\begin{description}
\item[\Optboxed :] to have algorithms enclosed in a box.
\item[\Optboxruled :] surround algorithm by a box, puts caption above and add a line after caption.
\item[\Optruled :] to have algorithms with a line at the top and the bottom. Note that the caption is not centered
under the algorithm anymore but is set at the beginning of the algorithm.
\item[\Optalgoruled :] as above but with extra spaces after the rules.
\item[\Opttworuled:] tworuled acts like ruled but doesn't put a line after the title.
-\item[\Optplain :] the default, with no feature.
-\medskip
+\item[\Optplain :] the default, with no feature.\par
+\end{description}
+
+%---------------------------------
+\subsubsection{algorithm numbering}
+\label{sec:option:envdisplay:numbers}
+
+\begin{description}
+\item[\optalgochapter :] algorithms are numbered within chapter numbers.
+\item[\optalgosection :] (default) algorithms are numbered within section numbers.
+\item[\optalgopart :] algorithms are numbered within part numbers.\par\medskip
+\item[\Optprocnumbered:] makes the procedure and function to be numbered as algorithm.
+\end{description}
+
+%---------------------------------
+\subsubsection{figure and toc}
+\label{sec:option:envdisplay:figuretoc}
+
+\begin{description}
+\item[\Optfigure :] algorithms are put in classical figures and so are numbered as
+ figures and putted in the $\backslash$\texttt{listoffigures}.\par
+\item[\Optdotocloa] adds an entry in the toc for the list of algorithms. This option loads package
+ \texttt{tocbibind} if not already done and so list of figures and list of tables are also added in
+ the toc. If you want to control which ones of the lists will be added in the toc, please load
+ package \texttt{tocbibind} before package algorithm and give it the options you want.
+\end{description}
+
+%--------------------------------------------------------------------------
+\subsection{code typesetting}
+\label{sec:option:algodisplay}
+
+%---------------------------------
+\subsubsection{blocks display}
+\label{sec:option:algodisplay:blocks}
+
+\paragraph{lines}
+\label{sec:option:algodisplay:blocks:lines}
+
+\begin{description}
\item[\Optlined:] \almac{SetAlgoLined} becomes the default, see
\autoref{sec_styleoptions} for explanations about the
\almac{SetAlgoLined} macros.
@@ -489,7 +697,45 @@ keep its original name:
\item[\Optnoline:] \almac{SetNoline} becomes the default, see
\autoref{sec_styleoptions} for explanations about the
\almac{SetNoline} macros.
-\medskip
+\end{description}
+
+\paragraph{block markers}
+\label{sec:option:algodisplay:blocks:markers}
+
+\begin{description}
+\item[\Optblockmarkers] \almac{AlgoDisplayBlockMarkers} becomes the default, see \autoref{sec_styleoptions}
+ for explanations about the \almac{AlgoDisplayBlockMarkers} macro.
+\end{description}
+
+%---------------------------------
+\subsubsection{end keywords}
+\label{sec:option:algodisplay:endkeywords}
+
+\begin{description}
+\item[\Optlongend] the end keyword are longer and different for
+ each macro. For example \emph{endif} for a if-then-else macro.
+\item[\Optshortend] the ``end keyword'' of the macros is just
+ \emph{end} (default).
+\item[\Optnoend] the ``end keyword'' of the macros is not printed.
+\end{description}
+
+%---------------------------------
+\subsubsection{comments}
+\label{sec:option:algodisplay:comments}
+
+\begin{description}
+\item[\Optscright (default)] right justified side comments (side comments are flushed to the right)
+\item[\Optscleft] left justified side comments (side comments are put right after the code line)
+\item[\Optfillcomment (default)] end mark of comment is flushed to the right so comments fill all
+ the width of text
+\item[\Optnofillcomment] end mark of comment is put right after the comment
+\end{description}
+
+%---------------------------------
+\subsubsection{lines numbers}
+\label{sec:optin:algodisplay:linenumber}
+
+\begin{description}
\item[\Optlinesnumbered:] lines of the algorithms are numbered except for
comments and input/output (KwInput and KwInOut). You must use \almacp{nllabel}{label}
to label thoses lines.
@@ -498,18 +744,8 @@ keep its original name:
put.
\item[\Optcommentsnumbered:] makes comments be numbered if numbering is active.
\item[\Optinoutnumbered:] makes data input/output be numbered if numbering is active.
-\item[\Optrightnl:] put lines numbers to the right of the algorithm instead of left.
-\medskip
-\item[\Opttitlenumbered :] \almacp{TitleOfAlgo}{title}
- prints \textsl{Algorithm n: thetitle} where \emph{n} is the counter
- of the algo.\\
- \textbf{Beware}: \almac{TitleOfAlgo} don't insert an entry in the
- list of algorithms. So do not use \almac{TitleOfAlgo} with a caption.
- Both increment the counter of the algorithms.
-\item[\Opttitlenotnumbered (default)] the macro
- \texttt{$\backslash$TitleOfAlgo\{title\}} doesn't number the algorithm.
-\medskip
-
+\item[\Optrightnl:] put lines numbers to the right of the algorithm instead of
+ left.\par\medskip
\item[\Optresetcount] the line numbers are reset to 0 at the beginning of
each algorithm (by default).
\item[\Optnoresetcount] the contreverse of the precedent. To reset
@@ -519,23 +755,21 @@ keep its original name:
current algorithm. \textbf{Take care} to set the caption of the
algorithm at the beginning of the environnement, else you will have
the precedent algorithm number as the current one.
-\item[\Optlongend] the end keyword are longer and different for
- each macro. For example \emph{endif} for a if-then-else macro.
-\item[\Optshortend] the ``end keyword'' of the macros is just
- \emph{end} (default).
-\item[\Optnoend] the ``end keyword'' of the macros is not printed.
-\item[\Optdotocloa] adds an entry in the toc for the list of algorithms. This option loads package
- \texttt{tocbibind} if not already done and so list of figures and list of tables are also added in
- the toc. If you want to control which ones of the lists will be added in the toc, please load
- package \texttt{tocbibind} before package algorithm and give it the options you want.
-\item[\Optscright (default)] right justified side comments (side comments are flushed to the right)
-\item[\Optscleft] left justified side comments (side comments are put right after the code line)
-\item[\Optfillcomment (default)] end mark of comment is flushed to the right so comments fill all
- the width of text
-\item[\Optnofillcomment] end mark of comment is put right after the comment
-\item[\Optnokwfunc] unable the setting in \almac{KwFunction} of procedure's or function's name (see \autoref{sec_envi})
- of function and procedure environment. Useful if you use name of procedure or function that cannot be a command
- name as a math display for example.
+\end{description}
+
+%---------------------------------
+\subsubsection{title of algorithms}
+\label{sec:option:algodisplay:title}
+
+\begin{description}
+\item[\Opttitlenumbered :] \almacp{TitleOfAlgo}{title}
+ prints \textsl{Algorithm n: thetitle} where \emph{n} is the counter
+ of the algo.\\
+ \textbf{Beware}: \almac{TitleOfAlgo} don't insert an entry in the
+ list of algorithms. So do not use \almac{TitleOfAlgo} with a caption.
+ Both increment the counter of the algorithms.
+\item[\Opttitlenotnumbered (default)] the macro
+ \texttt{$\backslash$TitleOfAlgo\{title\}} doesn't number the algorithm.
\end{description}
@@ -543,37 +777,34 @@ keep its original name:
\section{Typesetting}
-There are six text types in an algorithm environment:
+There are eight text types in an algorithm environment:
\begin{enumerate}
-\item The keywords (\textbf{Kw}): Macros which usually indicate words
- of the language. Some are predefined and given with \emph{the
- algorithm package}.
-
- The user can define his own language keywords by using the
- different macros presented in \autoref{sec_deflanguage} (see
- below for a short, non exhaustive list). He can also define simple
- keywords with the \almacpp{SetKw}{Kw}{thetext} macro.
-\item The Functions: (\textbf{Func}) Macros defined by the user which
- denote local functions or other algorithms defined in the text.
-
- They are defined using \almacpp{SetKwFunction}{KwFn}{Fn} where
- $\backslash$KwFn will be the macro and \FuncSty{Fn} the text
- printed.
+\item The keywords (\textbf{Kw}): Macros which usually indicate words of the language. Some are predefined and
+ given with \emph{the algorithm package}.
+
+ The user can define his own language keywords by using the different macros presented in
+ \autoref{sec_deflanguage} (see below for a short, non exhaustive list). He can also define simple keywords with
+ the \almacpp{SetKw}{Kw}{thetext} macro.
+\item The Functions: (\textbf{Func}) Macros defined by the user which denote local functions or other algorithms
+ defined in the text. (See also function environment at~\autoref{sec_envi}, which defines not only function
+ keyword but algorithm of the function.
+
+ They are defined using \almacpp{SetKwFunction}{KwFn}{Fn} where $\backslash$KwFn will be the macro and
+ \FuncSty{Fn} the text printed.
\item The Arguments (\textbf{Arg}): The arguments of the \emph{Kw} or
\emph{Func} macros.
-\item The procedure and function name environment style (\almac{ProcNameSty}):
- The type style of the caption of \emph{procedure} and \emph{function}
- environment.
-\item The arguments of procedure and function environments style
- (\almac{ProcArgSty}): the type style of the argument of \emph{procedure} and
- \emph{function} environments.
-\item Data (\textbf{Data}): A type of text different from the default.
- You can use it as you want, and can be useful for example to emphasize a Data
- structure or denotes some important variables.
-
- They are defined with the help of the
- \almacpp{SetKwData}{KwDat}{data} macro, where $\backslash$KwDat will
- be the macro and \DataSty{data} the text printed.
+\item The procedure and function name environment style (\almac{ProcNameSty} and \almac{ProcNameFnt}): The type
+ style of the caption of \emph{procedure} and \emph{function} environment.
+\item The arguments of procedure and function environments style (\almac{ProcArgSty} and \almac{ProcArgFnt}): the
+ type style of the argument of \emph{procedure} and \emph{function} environments.
+\item Data (\textbf{Data}): A type of text different from the default. You can use it as you want, and can be
+ useful for example to emphasize a Data structure or denotes some important variables.
+
+ They are defined with the help of the \almacpp{SetKwData}{KwDat}{data} macro, where $\backslash$KwDat will be the
+ macro and \DataSty{data} the text printed.
+\item Block markers: style of keywords that are print at begin and end of block when
+ \optblockmarkers option is set or \almac{AlgoDisplayBlockMarkers} macro used. By default,
+ \almac{BlockMarkersSty} is set to \almac{KwSty}.
\item The text (the default): All the remaining text of the algorithm.
\end{enumerate}
@@ -587,7 +818,7 @@ particular, you can use them inside all algorithms without redefining them. Be c
beginning a block outside an algorithm environment.
%----------
-\subsection{basic typesetting commands}\label{sec:basiccommands}
+\subsection{global code typesetting commands}\label{sec:basiccommands}
\begin{description}
\item[\Almac{;}] marks the end of a line. \textbf{Don't forget it !}. By
@@ -600,6 +831,19 @@ beginning a block outside an algorithm environment.
vertical space of one \texttt{ex}.
\item[\Almac{Indp}] indents plus $\rightarrow$ the text is shifted to the right.
\item[\Almac{Indm}] indents minus $\rightarrow$ the text is shifted to the left.
+\item[\Almacppp{SetStartEndCondition}{typo1}{typo2}{typo3}] which sets typo around
+ condition in \texttt{For}, \texttt{If}, \texttt{Switch}, \texttt{Case} and
+ \texttt{Repeat} macros. First two are used around \texttt{For}, \texttt{If},
+ \texttt{Switch} conditions, First and third are used for \texttt{Case} and
+ \texttt{Repeat} condition. Default definition is:\\ \verb+\SetStartEndCondition{ }{ }{}+.\\
+ A common alternative is \verb+\SetStartEndCondition{ (}{) }{)}+.\\
+ It can also be used to remove space around condition, for example if you want python style
+ commands: \verb+\SetStartEndCondition{ }{}{}+ and \verb+\SetKwFor{For}{for}{:}{}+
+\item[\Almac{AlgoDisplayBlockMarkers}] that prints begin and end markers at the start and end
+ of all block. These begin and end keywords could be specified by using
+ \almacpp{SetAlgoBlockMarkers{begin keywords}{end keywords}} command. By default, these
+ keywords are not printed but \emph{begin} and \emph{end} are default keywords used if
+ \verb+\AlgoDisplayBlockMarkers+ is called.
\end{description}
%----------
@@ -667,7 +911,7 @@ The following commands help you to define the style and the layout of the captio
\end{description}
Note that two length control the layout of ruled, algoruled, boxruled algorithms
-caption. \Almac{interspacetitleruled} and \Almac{interspaceboxruled} are described \autoref{sec_styleoptions}.
+caption. \Almac{interspacetitleruled} and \Almac{interspacetitleboxruled} are described \autoref{sec_styleoptions}.
%----------
\subsection{line numbering}\label{sec:linenumbering}
@@ -704,7 +948,7 @@ following commands:
\almac{label}.
\end{description}
-\subsubsection{setting style of lines}
+\subsubsection{setting style of lines numbers}
\label{sec:linestyle}
The following command allows you to change the way line numbers are printed:
@@ -719,6 +963,20 @@ The following command allows you to change the way line numbers are printed:
\almacp{SetAlgoNlRelativeSize}{$0$} sets it to the same size, \almacp{SetAlgoNlRelativeSize}{$-1$} to one size
smaller and \almacp{SetAlgoNlRelativeSize}{$1$} to one size bigger.
\end{description}
+Example below shows use of these macros:\par\smallskip\noindent%
+{\RestyleAlgo{tworuled}\ExampleOfAlgo{algorithm2e_exnlsty.tex}}
+
+%----------
+
+\subsection{math display}
+\label{sec:mathdisplay}
+
+If you need to use math display to handle complex mathematics as matrix, using standard
+$\backslash$[ $\backslash$] or \$\$ will not allow correct numbering and end line
+management. If you don't need line numbers, there is no problem. If you want line numbers,
+please use \Alenv{algomathdisplay} environment instead of $\backslash$[ $\backslash$] or
+\$\$. It will work as standard math display but line spacing, line numbers, end line will
+be managed correcly
%----------
@@ -746,48 +1004,108 @@ commands'' (see \autoref{sec:setfntsty})
\item[\Almacp{NlSty}{$<$text$>$}] sets $<$text$>$ in number line typography.
\medskip
-\item[\Almacp{ProcNameSty}{$<$text$>$}] sets $<$text$>$ in caption typography of procedure and function environment (by
- default the same as \almacp{AlCapSty}).
-\item[\Almacp{ProcArgSty}{$<$text$>$}] sets $<$text$>$ in argument typography of procedure and function environment
- (by default the same as \almacp{AlCapNameSty}).
+\item[\Almacp{ProcNameSty}{$<$text$>$}] sets $<$text$>$ in procedure style of procedure and function environment (by
+ default the same as \almacp{AlCapSty}). (see \autoref{sec:captionsty} for more explanations and details)
+\item[\Almacp{ProcFnt}{$<$text$>$}] sets $<$text$>$ in procedure typography of procedure and function environment (by
+ default the same as \almacp{AlCapFnt}). (see \autoref{sec:captionsty} for more explanations and details)
+\item[\Almacp{ProcArgSty}{$<$text$>$}] sets $<$text$>$ in argument style of procedure and function environment
+ (by default the same as \almacp{AlCapNameSty}). (see \autoref{sec:captionsty} for more explanations and details)
+\item[\Almacp{ProcArgFnt}{$<$text$>$}] sets $<$text$>$ in argument typography of procedure and function environment
+ (by default the same as \almacp{AlCapNameFnt}). (see \autoref{sec:captionsty} for more explanations and details)
+\item[\Almacp{BlockMarkersSty}{$<$text$>$}] sets $<$text$>$ in block markers typography
+ (by default the same as \almacp{KwSty}) (see \autoref{sec_styleoptions} for more
+ explanations and details on block markers).
\end{description}
\subsubsection{caption and title font style}
\label{sec:captionsty}
-\almac{AlCapSty}, \almac{AlCapNameSty}, \almac{AlCapFnt}, \almac{AlCapNameFnt} and corresponding
+\almac{AlCapSty}, \almac{AlCapNameSty}, \almac{AlCapFnt}, \almac{AlCapNameFnt}, \almac{ProcSty}, \almac{ProcFnt},
+\almac{ProcNameSty}, \almac{ProcNameFnt}, \almac{ProgArgSty}, \almac{ProgArgFnt} and corresponding
``\texttt{$\backslash$Set} commands'' (see \autoref{sec:setcaptionfntsty}) \almac{SetAlCapSty},
-\almac{SetAlCapNameSty}, \almac{SetAlCapFnt}, \almac{SetAlCapNameFnt} control the way caption is
-printed. \almac{AlCapSty} and \almac{AlCapFnt} are used to define style and font shape of ``\texttt{Algorithm
- \#:}'' in caption. \almac{AlCapNameSty} and \almac{AlCapNameFnt} are used to define style and font shape of the
-caption text. In fact a caption \almacp{my algorithm} is printed as follow :\\
-\almacp{AlCapSty}{\almacp{AlCapFnt}{Algorithm \#:}}\almacp{AlCapNameSty}{\almacp{AlCapNameFnt}{my algorithm}}.\\
+\almac{SetAlCapNameSty}, \almac{SetAlCapFnt}, \almac{SetAlCapNameFnt}, \almac{SetProcSty}, \almac{SetProcFnt},
+\almac{SetProcNameSty}, \almac{SetProcNameFnt}, \almac{SetProgArgSty}, \almac{SetProgArgFnt} control the way
+caption of algorithm and procedure/function environment are printed.
+
+\almac{AlCapSty} and \almac{AlCapFnt} are used to define style and font shape of ``\texttt{Algorithm \#:}'' in
+caption. \almac{AlCapNameSty} and \almac{AlCapNameFnt} are used to define style and
+font shape of the caption text. In fact a caption \almacp{caption}{my algorithm} is printed as follow :\medskip
+
+\noindent\almacp{AlCapSty}{\almac{AlCapFnt} Algorithm \#:}\almacp{AlCapNameSty}{\almac{AlCapNameFnt} my algorithm}.
+\medskip
+
By default, \almac{AlCapSty} is \texttt{textbf} and \almac{AlCapFnt} is nothing. \almac{AlCapNameSty} keeps text as
it is, and \almac{AlCapNameFnt} do nothing.
+
+\almac{ProcSty} and \almac{ProcFnt} are used to define style and font shape of ``\texttt{Procedure}'' in caption of
+procedure and function environment. \almac{ProcNameSty} and \almac{ProcNameFnt} are used to define style and font
+shape of the procedure or function name. \almac{ProcArgSty} and \almac{ProgArgFnt} are used to define style and
+font shape of arguments in procedure/function environment. In fact a caption \almacp{caption}{Proc(int i)} of
+procedure/function environment is printed as follow :\medskip
+
+\noindent\almacp{ProcSty}{\almac{ProcFnt} Procedure}\almacp{ProcNameSty}{\almac{ProcNameFnt} Proc(}\%\\%
+\almacp{ProgArgSty}{\almac{ProgArgFnt} int i}\almacp{ProcNameSty}{\almac{ProcNameFnt} )}.\medskip
+
+By default, \almac{ProcSty} is \almac{AlCapSty} and \almac{ProcFnt} is \almac{AlCapFnt}. \almac{ProcNameSty} keeps text as
+it is, and \almac{ProcNameFnt} do nothing.
+
\begin{description}
\item[\Almacp{AlCapSty}{$<$text$>$}] sets $<$text$>$ in caption title typography, that is the same used, together
with \almac{AlCapFnt}, to print \texttt{Algorithm \#:}, more precisely it is printed as follow:\\
- \almacp{AlCapSty}{\almacp{AlCapFnt}{Algorithm \#:}}\\
+ \almacp{AlCapSty}{\almac{AlCapFnt} Algorithm \#:}\\
which gives actually ``\AlCapSty{\AlCapFnt Algorithm \#:}''. By default \almac{AlCapSty} is \texttt{textbf}.
\item[\Almacp{AlCapNameSty}{$<$text$>$}] sets $<$text$>$ in caption name typography, that is the same used,
together with \almac{AlCapNameFnt} to print the name of caption you set by calling \almacp{caption}{name}. More
precisely it is printed as follow:\\
- \almacp{AlCapNameSty}{\almacp{AlCapNameFnt}{name}}\\
+ \almacp{AlCapNameSty}{\almac{AlCapNameFnt} name}\\
which gives ``\AlCapNameSty{\AlCapNameFnt name}''. By default \almac{AlCapNameSty} is \texttt{textnormal} which
means print in standard text.
\item[\Almacp{AlCapFnt}{$<$text$>$}] sets $<$text$>$ in font shape of caption title, that is the same used,
together with \almac{AlCapSty}, to print \texttt{Algorithm \#:}, more precisely it is printed as follow:\\
- \almacp{AlCapSty}{\almacp{AlCapFnt}{Algorithm \#:}}\\
+ \almacp{AlCapSty}{\almac{AlCapFnt} Algorithm \#:}\\
which gives actually ``\AlCapSty{\AlCapFnt Algorithm \#:}''. By default \almac{AlCapFnt} is \almac{relax} which
means keep text as it is.
\item[\Almacp{AlCapNameFnt}{$<$text$>$}] sets $<$text$>$ in caption name typography, that is the same used,
together with \almac{AlCapNameSty} to print the name of caption you set by calling \almacp{caption}{name}. More
precisely it is printed as follow:\\
- \almacp{AlCapNameSty}{\almacp{AlCapNameFnt}{name}}\\
+ \almacp{AlCapNameSty}{\almac{AlCapNameFnt} name}\\
which gives ``\AlCapNameSty{\AlCapNameFnt name}''. By default \almac{AlCapNameFnt} is \almac{relax} which means
keep text as it is.
\medskip
+\item[\Almacp{ProcSty}{$<$text$>$}] sets $<$text$>$ in procedure/function caption title typography, that is the
+ same used, together with \almac{ProcFnt}, to print \texttt{Procedure}, more precisely it is printed as follow:\\
+ \almacp{ProcSty}{\almac{ProcFnt} Procedure}\\
+ which gives actually ``\ProcSty{\ProcFnt Procedure}''. By default \almac{ProcSty} is \almac{AlCapSty}.
+\item[\Almacp{ProcNameSty}{$<$text$>$}] sets $<$text$>$ in procedure name typography, that is the same used,
+ together with \almac{ProcNameFnt} to print the name of caption you set by calling \almacp{caption}{Proc(int
+ i)}. More precisely it is printed as follow:\\
+ \almacp{ProcNameSty}{\almac{ProcNameFnt} Proc(}\\
+ which gives ``\ProcNameSty{\ProcNameFnt Proc(}''. By default \almac{ProcNameSty} is \almac{AlCapNameSty} which
+ means print in standard text.
+\item[\Almacp{ProcArgSty}{$<$text$>$}] sets $<$text$>$ in argument of procedure/function typography, that is the
+ same used, together with \almac{ProcArgFnt}, to print \texttt{int i} if \almacp{caption}{Proc(int i)} was
+ called. More precisely it is printed as follow:\\
+ \almacp{ProcArgSty}{\almac{ProcArgFnt} int i}\\
+ which gives actually ``\ProcArgSty{\ProcArgFnt int i}''. By default \almac{ProcArgSty} is \almac{AlCapNameSty};
+\item[\Almacp{ProcFnt}{$<$text$>$}] sets $<$text$>$ in font shape of caption title, that is the same used,
+ together with \almac{ProcSty}, to print \texttt{Procedure}, more precisely it is printed as follow:\\
+ \almacp{ProcSty}{\almac{ProcFnt} Procedure}\\
+ which gives actually ``\ProcSty{\ProcFnt Procedure}''. By default \almac{ProcFnt} is \almac{relax} which
+ means keep text as it is.
+\item[\Almacp{ProcNameFnt}{$<$text$>$}] sets $<$text$>$ in procedure/function name typography, that is the same
+ used, together with \almac{ProcNameSty} to print the name of caption you set by calling \almacp{caption}{Proc(int
+ i)}. More precisely it is printed as follow:\\
+ \almacp{ProcNameSty}{\almac{ProcNameFnt} Proc(}\\
+ which gives ``\ProcNameSty{\ProcNameFnt Proc(}''. By default \almac{ProcNameFnt} is \almac{relax} which means
+ keep text as it is.
+\item[\Almacp{ProcArgFnt}{$<$text$>$}] sets $<$text$>$ in font shape of argument of procedure/environment caption,
+ that is the same used, together with \almac{ProcArgSty}, to print \texttt{int i} if \almacp{caption}{int i} was
+ called. More precisely it is printed as follow:\\
+ \almacp{ProcArgSty}{\almac{ProcFnt} int i}\\
+ which gives actually ``\ProcArgSty{\ProcArgFnt int i}''. By default \almac{ProcArgFnt} do nothing.
+
+\medskip
\item[\Almacp{AlTitleSty}{$<$text$>$}] is used to typeset ``\texttt{Algorithm \#:}'' in title, together with
\almac{AlTitleFnt}. You can use it to have text as your titles. Precisely, titles are typeset as follow:\\
\almacp{AlTitleSty}{\almacp{AlTitleFnt}{Algorithm \#:}}.
@@ -835,6 +1153,8 @@ Here is the complete list of these macros:
default the same as \almacp{AlCapSty}).
\item[\Almacp{SetProcArgSty}{$<$font$>$}] sets argument typography of procedure and function environment (by
default the same as \almacp{AlCapNameSty}).
+\item[\Almacp{SetBlockMarkersSty}{$<$font$>$}] sets block markers typography (by default
+ the same as \almacp{KwSty}).
\end{description}
\subsubsection{setting caption and title font style}
@@ -855,10 +1175,15 @@ caption printed in large red font.
The next commands allow to redefine \texttt{Sty} macros for caption or title. As ``\texttt{$\backslash$Set}
commands'' of basic font style (see \autoref{sec:setfntsty}), they require a name of a command in argument,
-this command have to take one argument, the text to be typeset. Examples of use:
+this command have to take one argument, the text to be typeset. They should be combined
+with previous commands to redefine display of caption or title. Examples of use:
\begin{itemize}
-\item $\backslash$\texttt{newcommand\{}$\backslash$\texttt{mycapfn\}[1]\{}$\backslash$\texttt{tiny \#1\}}\almacp{SetAlCapNameFnt}{mycapfnt}
-\item $\backslash$\texttt{newcommand\{}$\backslash$\texttt{mycapfn\}[1]\{}$\backslash$\texttt{textsl\{}$\backslash$\texttt{small \#1\}\}}\almacp{SetAlCapNameFnt}{mycapfnt}
+\item
+ $\backslash$\texttt{newcommand\{}$\backslash$\texttt{mycapsty\}[1]\{}$\backslash$\texttt{textbf\{}$\backslash$\texttt{emph\{\#1\}\}\}}\almacp{SetAlCapNameSty}{mycapsty}\\
+ caption will be print emphased and in bold face.
+\item \almacp{SetAlCapNameFnt}{$\backslash$tiny} set font to tiny size.
+\item if you combine $\backslash$SetAlCapNameSty\{mycapsty\} and
+ $\backslash$SetAlCapNameFnt\{$\backslash$tiny\} will give tiny bold empased caption.
\end{itemize}
Now the commands:
@@ -950,7 +1275,15 @@ the last example above can be define in a simplier way that previously presented
\item[\almacp{SetAlgoNlRelativeSize}{number}] sets the relative size of line number (see
\autoref{sec:linenumbering}) for more details on this command.
\item[\almacp{SetAlgoCaptionLayout}{style}] sets the global style of caption (see \autoref{sec:titlemacros} for
- more details).
+ more details).
+\item[\Almac{DisplayBlockMarkers}] acts like \optblockmarkers option: each block will be
+ started by a \emph{begin} keyword and be ended by an \emph{end} keywords. This is tricky
+ to use but allows to customize syntax to match almost every language (see
+ \autoref{code:exgeneric} for examples showing how to use
+ it). \Almacpp{SetAlgoBlockMarkers}{begin keyword}{end keyword} defines \emph{begin} and
+ \emph{end} keywords that will be used by \verb+\DisplayBlockMarkers+. Default keywords
+ are \textbf{begin} and \textbf{end}. but for example you can set
+ \verb+\DisplayBlockMarkers{\{}{\}}+ to match c-style syntax.
\end{description}
Some length are used to set the layout of ruled, algoruled and boxruled algorithms caption. These length have no
@@ -958,7 +1291,7 @@ particular macro to set them but can be changed by classical \almac{setlength} c
\begin{description}
\item[interspacetitleruled] (2pt by defaut) which controls the vertical space between rules and title in ruled and
algoruled algorithms.
-\item[interspaceboxruled] (2\almac{lineskip} by default) which controls the vertical space between rules and title in
+\item[interspacetitleboxruled] (2\almac{lineskip} by default) which controls the vertical space between rules and title in
boxruled algorithms.
\end{description}
@@ -1005,6 +1338,7 @@ are defined using macros provided by the package and described in
\autoref{sec_deflanguage}.
%\subsection{english keywords}
+\RestyleAlgo{boxed}
%----------
\subsection{Input, output macros...}\label{sec:inputmacros}
@@ -1060,7 +1394,7 @@ are defined using macros provided by the package and described in
example\}\macind{tcp*[f]}: comment ``à la'' C++
\end{itemize}
-You can see some examples of this macros with \texttt{if then else} at the end of \autoref{sec:ifthenelsemacros}.
+You can see some examples of this macros with \texttt{if then else} at the end of \autoref{sec:defifthenelsemacros}
%----------
\subsection{if-then-else macros}
@@ -1089,6 +1423,8 @@ You can see some examples of this macros with \texttt{if then else} at the end o
\item $\backslash$eIf(\textit{then comment})\{condition\}\{then block\}(\textit{else comment})\{else block\}\macind{eIf}
\item $\backslash$eIf(\textit{then comment})\{condition\}\{then block\}\{else block\}\macind{eIf}
\item $\backslash$eIf\{condition\}\{then block\}(\textit{else comment})\{else block\}\macind{eIf}
+\item $\backslash$leIf\{condition\}\{then block\}\{else block\}\macind{eIf}
+\item $\backslash$leIf(\textit{comment})\{condition\}\{then block\}\{else block\}\macind{eIf}
\end{itemize}
%----------
@@ -1167,7 +1503,7 @@ You can see some examples of this macros with \texttt{if then else} at the end o
\item \almacppp{SetKwComment}{tcc}{/*}{*/}\par
\almacppp{SetKwComment}{tcp}{//}{}
\item \almacphuit{SetKwIF}{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}
-\item {\small \almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endsw}}
+\item {\small\almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endcase}\texttt{endsw}}
\item \almacpppp{SetKwFor}{For}{for}{do}{endfor}\par
\almacpppp{SetKwFor}{While}{while}{do}{endw}\par
\almacpppp{SetKwFor}{ForEach}{foreach}{do}{endfch}\par
@@ -1204,33 +1540,27 @@ package with your own.
%----------
\subsection{to define basic keywords or blocks}\label{sec:defbasickeywords}
-\begin{description}
+\begin{description}\RestyleAlgo{plain}
\item[\Almacpp{SetKw}{Kw}{thetext}] defines the macro \almac{Kw} which
defines a keyword \emph{thetext} and prints it in keyword
- typography. It can take one argument: $backslash$Kw\{arg\}. If so,
- \emph{arg} is printed in argument typography.
+ typography. It can take one argument: $\backslash$Kw\{arg\}. If so,
+ \emph{arg} is printed in argument typography. For example \verb+\Kw{thetext}+
+ could give: \KwSty{Kw} \ArgSty{thetext}
+\item[\Almacpp{SetKwHangingKw}{Kw}{thetext}] defines a hanging keyword that should act
+ like a combination of \almac{SetKwInput} and \almac{SetKw}. In comparison with
+ $\backslash$SetKwInput, it doesn't print ':' at end of keyword and line is numbering if
+ \optlinesnumbered is set.\\
+ For example \verb+\SetKwHangingKw{HData}{Data$\rightarrow$}+ could gives:\par\vspace{-.5ex}
+ \begin{algorithm}[H]
+ \KwHData{a list of data and a long description of this data to be sure that text requires several lines to be printed}
+ \end{algorithm}\vspace{-1ex}
\item[\Almacpp{SetKwData}{Kw}{thetext}] defines the macro \almacp{Kw}
which defines a data text. Prints \emph{thetext} in data typography.
Note that this macros can takes one argument as function macros.
-\item[\Almacpp{SetKwHangingKw}{name}{text}] (hanging indent with keyword): This creates a hanging indent much like
- \Almac{SetKwInput}, except that it removes the trailing `:' and does not reset numbering. It can be used for
- example to create \textbf{let} declarations.
-\begin{verbatim}
- text -------------- <= [text] is placed at left
- -------------- <= hanging determined by [text]
-\end{verbatim}
-% \item[\Almacppp{SetKwInParam}{Kw}{text1}{text2}] defines the macro
-% \almacpp{Kw}{name}{arg} which prints \emph{name} followed by
-% \emph{text1} in key word typography, behind the argument \emph{arg},
-% followed by \emph{text2} in key word typography. Typically used when
-% the algorithm described a function in order to define a macro which
-% allows to give the name of the function and to show its arguments.
-% Note that \emph{arg} will be shifted so that all the text is
-% vertically aligned and to the right of
-% \emph{text1}.\\
-% Example $\backslash$SetKwInParam\{Func\}\{(\}\{)\} defines macro
-% $\backslash$Func and $\backslash$Func\{function\}\{arg1, arg2, arg3\}
-% gives \KwSty{function(}arg1, arg2, arg3\KwSty{)}.
+\item[\Almacpp{SetKwArray}{Kw}{array}] which defines an array keywords \texttt{Kw} called \emph{array} and printed
+ in DataSty style when call with $\backslash$\texttt{Kw}. It can be used with one argument which denotes the
+ element index: $\backslash$\texttt{Kw}\{n\} prints \DataSty{array[}\ArgSty{n}\DataSty{]} with \emph{array} in
+ \Almac{DataSty} and \emph{n} in \Almac{ArgSty}.
\item[\Almacppp{SetKwBlock}{Begin}{begin}{end}] defines a macro
\almacp{Begin}{txt} which denotes a block. The text is surrounded by
the words \emph{begin} and \emph{end} in keyword typography and
@@ -1238,7 +1568,17 @@ package with your own.
\almac{Line}\emph{ mode} a straight vertical line is added.\\
\verb+\Begin(side text){text}+ gives also text in a block surrounded by \emph{begin} and
\emph{end}, but \emph{side text} if put after the \emph{begin} keyword. Combined with
- \Almac{tcc*[f]} macro, it allows you to put comments on the same line as \emph{begin}.
+ \Almac{tcc*[f]} macro, it allows you to put comments on the same line as
+ \emph{begin}.\par
+ You can also use alternativ \almacp{uBegin}{txt} which acts as \almacp{Begin}{txt} but
+ without \emph{end}. Useful for example as a part separator that doesn't necessary need
+ an \emph{end} keyword.
+\item[\Almacpppp{SetKwProg}{Prog}{Title}{is}{end}] Env is a block with 'Title' (in
+ \texttt{CapSty} style) at the beginning followed by args followed by '\texttt{is}' then
+ '\texttt{text}' inside a block ended by '\texttt{end}'. If no '\texttt{end}' is
+ specified, nothing is written (no blank line is inserted). Useful to typeset function or
+ prog. For example:\par
+ \noindent\ExampleOfAlgo{algorithm2e_exProg.tex}\par
\end{description}
\subsection{to define keywords as function}
@@ -1275,7 +1615,7 @@ If you want describe the function by an algorithm, use instead \emph{function} o
\label{sec:defcommentsmacros}
\begin{description}
-\item[\Almacppp{SetKwComment}{Comment}{start}{end}] defines a macr
+\item[\Almacppp{SetKwComment}{Comment}{start}{end}] defines a macro
\almacp{Comment}{text comment} which writes \emph{text comment} between
\emph{start} and \emph{end}. Note that \emph{start} or \emph{end} can be
empty.\\
@@ -1295,26 +1635,39 @@ If you want describe the function by an algorithm, use instead \emph{function} o
\label{sec:defifthenelsemacros}
\begin{description}
-\item[\almacphuit{SetKwIF}{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}]
+\item[\Almacphuit{SetKwIF}{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}]
defines several macros to give the opportunity to write all
if-then-else-elseif-endif possibilities:
\begin{itemize}
\item \almacpp{If}{cond}{Then's text}\\
Then's text is writen in a block (below \texttt{then} and on several lines)
and terminating by the \texttt{endif} given in the last argument.
+ \item \almacpp{If(comment)}{cond}{Then's text}\\
+ as previous but put \emph{comment} after \texttt{then} keyword. Usually use with
+ comment macro like \almac{tcc}*[f]\{comment\} or \almac{tcp}*[f]\{comment\}
\item \almacp{ElseIf}{ElseIf's text}\\
ElseIf's text is writen in a block and terminating by the \texttt{endif}.
+ \item \almacp{ElseIf(comment)}{ElseIf's text}\\
+ the same with comment.
\item \almacp{Else}{Else's text}\\
Else's text is writen in a block and terminating by the \texttt{endif}.
+ \item \almacp{Else}{Else's text}\\
+ the same with comment.
\item \almacpp{lIf}{cond}{Then's text}\\
Then's text is written on the same line as \texttt{then}. No \texttt{endif}
- is printed.
+ is printed. Do not put $\backslash$; after \emph{Then's text} neither after \almac{lIf}.
+ \item \almacpp{lIf(comment)}{cond}{Then's text}\\
+ the same with comment.
\item \almacp{lElseIf}{ElseIf's text}\\
ElseIf's text is written on the same line as \texttt{else if}. No \texttt{endif}
is printed.
+ \item \almacp{lElseIf(comment)}{ElseIf's text}\\
+ the same with comment.
\item \almacp{lElse}{Else's text}\\
Else's text is written on the same line as \texttt{else}. No \texttt{endif}
is printed.
+ \item \almacp{lElse(comment)}{Else's text}\\
+ the same with comment.
\item \almacpp{uIf}{cond}{Then's text} (for uncomplete if)\\
defines a If block unterminated like in a \almac{eIf} block,
i.e. don't print the \texttt{endif} or don't put the little
@@ -1335,10 +1688,16 @@ If you want describe the function by an algorithm, use instead \emph{function} o
% \lElse{else in one line}\;
% \end{algorithm}
% \end{minipage}
+ \item \almacpp{uIf(comment)}{cond}{Then's text}\\
+ the same with comment.
\item \almacp{uElseIf}{ElseIf's text} (for uncomplete elseif)\\
Same explanation as for \almac{uIf} but with \texttt{else if}.
+ \item \almacp{uElseIf(comment)}{ElseIf's text}\\
+ the same with comment.
\item \almacp{uElse}{Else's text} (for uncomplete else)\\
Same explanation as for \almac{uElseIf} but with \texttt{else}.
+ \item \almacp{uElse}{Else's text}\\
+ the same with comment.
\item \almacppp{eIf}{cond}{Then's text}{Else's text}\\
equivalent to the use of \almac{uIf} followed by \almac{Else}.
\end{itemize}
@@ -1373,16 +1732,22 @@ in the package:\par\smallskip \ExampleOfAlgo{algorithm2e_ex01.tex}\par---\par
\label{sec:defswitchmacros}
\begin{description}
-\item[\Almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endsw}]
+\item[\Almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endcase}\texttt{endsw}]
defines several macros to give a complete Switch-do-case-otherwise
environment:
\begin{itemize}
\item \almacpp{Switch}{iden}{switch's block}
- \item \almacpp{Case}{cond}{Case's text}
- \item \almacpp{uCase}{cond}{Case's text}
+ \item \almacpp{Switch(comment)}{iden}{switch's block}
+ \item \almacpp{Case}{cond}{Case's block}
+ \item \almacpp{Case(comment)}{cond}{Case's block}
+ \item \almacpp{uCase}{cond}{Case's block}
+ \item \almacpp{uCase(comment)}{cond}{Case's block}
\item \almacpp{lCase}{cond}{Case's text}
- \item \almacp{Other}{Otherwise's text}
+ \item \almacpp{lCase(comment)}{cond}{Case's text}
+ \item \almacp{Other}{Otherwise's block}
+ \item \almacp{Other(comment)}{Otherwise's block}
\item \almacp{lOther}{Otherwise's text}
+ \item \almacp{lOther(comment)}{Otherwise's text}
\end{itemize}
\end{description}
@@ -1402,7 +1767,9 @@ As for If-then-elseif-else-endif macro, you can use () to put comments after mai
the loop.
\begin{itemize}
\item \almacpp{For}{loop's condition}{For's text}
+ \item \almacpp{For(comment)}{loop's condition}{For's text}
\item \almacpp{lFor}{loop's condition}{For's text}
+ \item \almacpp{lFor(comment)}{loop's condition}{For's text}
\end{itemize}
\end{description}
@@ -1420,7 +1787,11 @@ As for If-then-elseif-else-endif macro, you can use () to put comments after mai
of the loop):
\begin{itemize}
\item \almacpp{Repeat}{end loop condition}{the loop}
+ \item \almacpp{Repeat(comment after repeat)}{end loop condition}{the loop}
+ \item \almacpp{Repeat}{end loop condition}{the loop}(comment after until)
+ \item \almacpp{Repeat(comment after repeat)}{end loop condition}{the loop}(comment after until)
\item \almacpp{lRepeat}{end loop condition}{only one line}
+ \item \almacpp{lRepeat(comment)}{end loop condition}{only one line}
\end{itemize}
\end{description}
@@ -1484,7 +1855,7 @@ Here we describe how they are obtained:
\almacpp{SetKw}{Retour}{retourner}
\item \almacppp{SetKwBlock}{Deb}{d\'ebut}{fin}
\item \almacphuit{SetKwIF}{Si}{SinonSi}{Sinon}{si}{alors}{sinon si}{alors}{finsi}
-\item {\footnotesize\almacphuit{SetKwSwitch}{Suivant}{Cas}{Autre}{suivant}{faire}{cas o\`u}{autres cas}{fin d'alternative}}
+\item {\footnotesize\almacphuit{SetKwSwitch}{Suivant}{Cas}{Autre}{suivant}{faire}{cas o\`u}{autres cas}{fin cas}\texttt{fin d'alternative}}
\item \almacpppp{SetKwFor}{Pour}{pour}{faire}{finpour}\par
\item \almacpppp{SetKwFor}{Tq}{tant que}{faire}{fintq}\par
\item \almacpppp{SetKwFor}{PourCh}{pour chaque}{faire}{finprch}
@@ -1546,7 +1917,8 @@ Here we describe how they are obtained:
\item \almacppp{SetKwBlock}{Beginn}{Beginn}{Ende}%Begin
\item \almacppp{SetKwRepeat}{Wiederh}{wiederhole}{bis}%Repeat
\item \almacphuit{SetKwIF}{Wenn}{SonstWenn}{Sonst}{wenn}{dann}{sonst wenn}{sonst}{Ende}%IF
-\item \almacphuit{SetKwSwitch}{Unterscheide}{Fall}{Anderes}{unterscheide}{tue}{Fall}{sonst}{Ende.}%Switch
+\item
+ \almacphuit{SetKwSwitch}{Unterscheide}{Fall}{Anderes}{unterscheide}{tue}{Fall}{sonst}{Ende Fall}\texttt{Ende.}%Switch
\item \almacpppp{SetKwFor}{Fuer}{f\"ur}{tue}{Ende}%For
\item \almacpppp{SetKwFor}{FuerPar}{f\"ur}{tue gleichzeitig}{Ende}%ForPar
\item \almacpppp{SetKwFor}{FuerJedes}{f\"ur jedes}{tue}{Ende}%ForEach
@@ -1607,7 +1979,7 @@ Here we describe how they are obtained:
\almacpp{SetKw}{Retorna}{retorna}\par
\item \almacppp{SetKwBlock}{Inicio}{in\'{i}cio}{fim}%
\item \almacphuit{SetKwIF}{Se}{SenaoSe}{Senao}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}%
-\item \almacphuit{SetKwSwitch}{Selec}{Caso}{Outro}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim selec}%
+\item \almacphuit{SetKwSwitch}{Selec}{Caso}{Outro}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim caso}\texttt{fim selec}%
\item \almacpppp{SetKwFor}{Para}{para}{fa\c{c}a}{fim para}%
\item \almacpppp{SetKwFor}{ParaPar}{para}{fa\c{c}a em paralelo}{fim para}
\item \almacpppp{SetKwFor}{ParaCada}{para cada}{fa\c{c}a}{fim para cada}%
@@ -1670,7 +2042,7 @@ Here we describe how they are obtained:
\item \almacppp{SetKwBlock}{Inizio}{inizio}{fine}
\item \almacppp{SetKwRepeat}{Ripeti}{ripeti}{finché}
\item \almacphuit{SetKwIF}{Sea}{AltSe}{Altrimenti}{se}{allora}{altrimenti se}{allora}{fine se}
-\item \almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endsw}
+\item \almacphuit{SetKwSwitch}{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endcase}\texttt{endsw}
\item \almacpppp{SetKwFor}{Per}{per}{fai}{fine per}
\item \almacpppp{SetKwFor}{PerPar}{per}{fai in parallelo}{fine per}
\item \almacpppp{SetKwFor}{PerCiascun}{per ciascun}{fai}{fine per ciascun}
@@ -1704,7 +2076,7 @@ How they are obtained:
\section{Known bugs}\label{sec_bugs}
\begin{itemize}
-\item no more known bugs actually; if you find one, please sent it to me.
+\item no more known bugs actually; if you find one, please send it to me.
\end{itemize}
\clearpage
@@ -1712,193 +2084,93 @@ How they are obtained:
\section*{Release notes}\label{sec:relnotes}
\begin{verbatim}
-% - december 14 2009 - revision 4.01
-% * ADD : new command \SetKwHangingKw{Name}{text} (hanging indent with keyword): This creates a
-% hanging indent much like \texttt{SetKwInput}, except that it removes the trailing `:'
-% and does not reset numbering.
-% - november 17 2009 - revision 4.00 -
-% * CHANGE : IMPORTANT : some commands have been renamed to have consistent naming (CamlCase
-% syntax) and old commands are no more available. If you doesn't want to change
-% your mind or use old latex files, you can use oldcommands option to enable old
-% commands back.
-% text. Here are these commands:
-% - \SetNoLine becomes \SetAlgoNoLine
-% - \SetVline becomes \SetAlgoVlined
-% - \Setvlineskip becomes \SetVlineSkip
-% - \SetLine becomes \SetAlgoLined
-% - \dontprintsemicolon becomes \DontPrintSemicolon
-% - \printsemicolon becomes \PrintSemicolon
-% - \incmargin becomes \IncMargin
-% - \decmargin becomes \DecMargin
-% - \setnlskip becomes \SetNlSkip
-% - \Setnlskip becomes \SetNlSkip
-% - \setalcapskip becomes \SetAlCapSkip
-% - \setalcaphskip becomes \SetAlCapHSkip
-% - \nlSty becomes \NlSty
-% - \Setnlsty becomes \SetNlSty
-% - \linesnumbered becomes \LinesNumbered
-% - \linesnotnumbered becomes \LinesNotNumbered
-% - \linesnumberedhidden becomes \LinesNumberedHidden
-% - \showln becomes \ShowLn
-% - \showlnlabel becomes \ShowLnLabel
-% - \nocaptionofalgo becomes \NoCaptionOfAlgo
-% - \restorecaptionofalgo becomes \RestoreCaptionOfAlgo
-% - \restylealgo becomes \RestyleAlgo
-% - gIf macros and so on do no more exist
-% * NEW: - Compatibily with other packages improven by changing name of internal
-% macros. Algorithm2e can now be used with arabtex for example, if this last is
-% loaded after algorithm2e package.
-% * ADD: - OPTION endfloat: endfloat packages doesn't allow float environment inside other
-% environment. So using it with figure option of algorithm2e makes error. This
-% option enables a new environment algoendfloat to be used instead of algorithm
-% environment that put algorithm at the end. algoendfloat environment make
-% algorithm acting as endfloat figures. This option requires endfloat packages.
-% * ADD: - OPTION norelsize: starting from this release (v4.00), algorithm2e package uses
-% relsize package in order to get relative size for lines numbers; but it seems
-% that some rare classes (such as inform1.cls) are not compatible with relsize; to
-% have algorithm2e working, this option makes algorithm2e not to load relsize
-% package and go back to previous definition by using \scriptsize font for lines
-% numbers.
-% * ADD: - OPTION onelanguage: allow, if using standard keywords listed below, to switch
-% from one language to another without changing keywords by using appropriate
-% language option :
-% . KwIn, KwOut, KwData, KwResult
-% . KwTo KwFrom
-% . KwRet, Return
-% . Begin
-% . Repeat
-% . If, ElseIf, Else
-% . Switch, Case, Other
-% . For, ForPar, ForEach, ForAll, While
-% .
-% * ADD: - OPTION rightnl: put lines numbers to the right of the algorithm instead of left.
-% * ADD: new commands \setRightLinesNumbers and \setLeftLinesNumbers which sets the lines
-% numbers to the right or to the left of the algorithm.
-% * ADD/FIX: rules of ruled, algoruled, tworuled styles used rules of different sizes! This
-% is now fixed. Moreover size of the rules is now controlled by a length and so
-% can be customized by the user.
-% \algoheightrule is the height of the rules and can be changed via \setlength
-% \algoheightruledefault is the default height of he rules (0.8pt)
-% \algotitleheightrule is the height of the rule that comes just after the
-% caption in ruled and algoruled style; it can be changed via \setlength
-% \algotitleheightruledefault is the default height of this rules (0.8pt)
-% Thanks to Philippe Dumas who reports the bug and make the suggestion.
-% * ADD: - \SetAlgoCaptionSeparator which sets the separator between Algorithm 1 and the
-% title. By default it's ':' and caption looks like "Algorithm 2: title" but now
-% you can change it by using for example \SetAlgoCaptionSeparator{.} which will
-% give "Algorithm 3. title"
-% * ADD: - \SetAlgoLongEnd and \SetAlgoShortEnd and \SetAlgoNoEnd commands which act as
-% corresponding package options
-% * ADD: - OPTIONS italiano and slovak as new language (thanks to Roberto Posenato and
-% Miroslav Binas)
-% * ADD: - \AlCapSty, \AlCapNameSty, \AlCapFnt, \AlCapNameFnt and corresponding "set macro"
-% \SetAlCapSty, \SetAlCapNameSty, \SetAlCapFnt, \SetAlCapNameFnt which control the
-% way caption is printed. Sty macro use command taking one parameter as argument,
-% Fnt macros use directly command. In Fact caption is printed as follow :
-% \AlCapSty{\AlCapFnt Algorithm 1:}\AlCapNameSty{\AlCapNameFnt my algorithm}
-% By default, \AlCapSty is textbf and \AlCapFnt is nothing. \AlCapNameSty keep text
-% as it is, and \AlCapNameFnt do nothing also.
-% You can redefine \AlCapFnt and \AlCapNameFnt by giving macro to \Set commands. For
-% example, you can do \SetAlCapFnt{\large} to see Algorithm printed in \large font.
-% You can redefine \AlCapSty, \AlCapFnt, \AlCapNameSty and \AlCapNameFnt with the
-% corresponding \Set command. For the Sty commands, you have to give in parameter
-% name of a macro (whithout \) which takes one argument. For example,
-% \SetAlCapFnt{textbf} defines the default behaviour. If you want to do more
-% complicated thing, you should define your own macro and give it to \SetAlCapFnt or
-% \SetAlCapNameFnt. Here are two examples:
-% - \newcommand{\mycapsty}[1]{\tiny #1}\SetAlCapNameSty{mycapsty}
-% - \newcommand{\mycapsty}[1]{\textsl{\small #1}}\SetAlCapNameSty{mycapsty}
-% Or you can combine the two, for the last example you can also do:
-% \SetAlCapNameSty{textsl}\SetAlCapNameFnt{\small}
-% Thanks to Jan Stilhammer who gives me the idea of \AlCapNameFnt.
-% * CHANGE \AlTitleFnt to match definition of all other Fnt macros and add a \AlTitleSty
-% macro (see below) . Now you set \AlTitleFnt by calling \SetAlTitleFnt with
-% directly a macro without parameter in argument:
-% Example: \SetAlTitleFnt{\small} to set title in small font.
-% * ADD: - \AlTitleSty and \SetAlTitleSty commands to set a style for title. These commands
-% are defined from a macro taking the text in argument, as \textbf for example.
-% To set the TitleSty you have to give name of the macro (without the '\')
-% to \SetAlTitleSty. For example \SetAlTitleSty{textbf} to set \textbf style.
-% * ADD: - new command \SetAlgorithmName{algorithmname}{list of algorithms name} which
-% redefines name of the algorithms and the sentence list of algorithms. Second
-% argument is the name that \autoref, from hyperref package, will use. Example:
-% \SetAlgorithmName{Protocol}{List of protocols} if you prefer protocol than
-% algorithm.
-% * ADD: - new \SetAlgoRefName{QXY} which change the default ref (number of the algorithm) by
-% the name given in parameter (QXY in the example).
-% * ADD: - new command \SetAlgoRefRelativeSize{-2} which sets the output size of refs, defined
-% by \SetAlgoRefName, used in list of algorithms.
-% * ADD: - two dimensions to control the layout of caption in ruled, algoruled and boxruled
-% algorithms:
-% - interspacetitleruled (2pt by defaut) which controls the vertical space between
-% rules and title in ruled and algoruled algorithms.
-% - interspaceboxruled (2\lineskip by default) which controls the vertical space
-% between rules and title in boxruled algorithms.
-% These two dimensions can be changed by using \setlength command.
-% * ADD: - With the fix (see below) of procedure and function environments, a new feature has
-% been added: the name of the procedure or function set in caption is automatically
-% defined as a KwFunction and so can be used as a macro. For example, if inside a
-% procedure environment you set \caption{myproc()}, you can use \myproc macro in you
-% main text. Beware that the macro is only defined after the \caption!
-% * ADD: - OPTION nokwfunc to unable the new feature described above in function and
-% procedure environment. Useful if you use name of procedure or function that cannot
-% be a command name as a math display for example.
-% * ADD: - \SetAlgoNlRelativeSize{number} command which sets the relative size of line
-% numbers. By default, line numbers are two size smaller than algorithm text. Use
-% this macro to change this behavior. For example, \SetAlgoNlRelativeSize{0} sets it
-% to the same size, \SetAlgoNlRelativeSize{-1} to one size smaller and
-% \SetAlgoNlRelativeSize{1} to one size bigger
-% * ADD: - \SetAlgoProcName{aname} command which sets the name of Procedure printed by
-% procedure environment (the environment prints Procedure by default). Second
-% argument is the name that \autoref, from hyperref package, will use.
-% * ADD: - \SetAlgoFuncName{aname} command which sets the name of Function printed by
-% procedure environment (the environment prints Function by default). Second
-% argument is the name that \autoref, from hyperref package, will use.
-% * ADD: - \SetAlgoCaptionLayout{style} command which sets style of the caption; style must
-% be the name of a macro taking one argument (the text of the caption). Examples
-% below show how to use it:
-% . \SetAlgoCaptionLayout{centerline} to have centered caption
-% . \SetAlgoCaptionLayout{textbf} to have bold caption
-% If you want to apply two styles in the same time, such as centered bold, you have
-% to define you own macro and then use \SetAlgoCaptionLayout with its name.
-% * ADD: - OPTION procnumbered: which makes the procedure and function to be numbered as
-% algorithm
-% * ADD: - OPTIONS tworuled and boxruled
-% these are two new layouts: tworuled acts like ruled but doesn't put a line after
-% caption ; boxruled surround algorithm by a box, puts caption above and add a line
-% after caption.
-% * REMOVE: - SetKwInParam has been deleted since not useful itself because of different
-% macros which can do the same in a better and a more consistent way as
-% SetKwFunction or SetKw.
-% * FIX: - line number is now correctly vertically aligned with math display.
-% * FIX: - references with hyperref. No more same identifier or missing name error. BUT now
-% you must NOT use naturalnames option of hyperref packages if you do PdfLaTeX
-% * FIX: - autoref with hyperref package (thanks to Jörg Sommer who notices the problem).
-% * FIX: - titlenumbered was not working! fixed.
-% * FIX: - Else(){} acted like uElse. Corrected.
-% * FIX: - noend management: when a block was inside another and end of block was following
-% each other, a blank line was added: it's now corrected.
-% * FIX: - Function and Procedure environment was no more working as defined originally: the
-% label was no more name of the procedure, it acts always as if procumbered option
-% has been used.
-% * FIX: - line numbers had a fixed size which can be bigger than algorithm text accordingly
-% to \AlFnt set (see also new command \SetAlgoNlRelativeSize above)
-% * FIX: - semicolon in comments when dontprintsemicolon is used.
-% * FIX: - listofalgorithms adds a vertical space before first algo of a chapter as for
-% listoffigures or listoftables
-% * FIX: - listofalgorithms with twocolumns mode and some classes which don't allow onecolumn
-% and so don't define \if@restonecol as prescribed in LaTeX (sig-alternate for
-% example)
-% * FIX: - algorithm2e now works with elsart cls and some more classes.
-% * FIX: - blocks defined by SetKwBlock act now as other blocks (if for instance) and don't
-% write end in vlined mode, instead they print a small horizontal line as required
-% by the option.
-% * FIX: - underfull hbox warning at each end of algorithm environment removed.
-%
-% * INTERNAL CHANGE: - short end keyword are deduce from long end keyword by keeping the
-% first one. Allows to avoid double definition.
-% * INTERNAL CHANGE: - procedure, function and algorithm are now resolved by the same
-% environment to avoid code duplication.
+% - January 6 2013 - revision 5.0
+% * CHANGE: SetKwSwith takes now 9 args: 9th arg is the same as
+% previous 8th arg ('end of switch' keyword). New 8th arg is
+% 'end of case' keyword. This is due to change of release
+% 3.2 which introduce end after case block... as I never
+% test with longend option, I never see that the 'end
+% switch' used for case was not good.
+% * CHANGE: when no end keyword is defined in a block macro, then
+% algorithm2e does no more try to print it. So even with lined or noline
+% option, no empty line is printed (before: a blank end was
+% printed, so a blank line appeared)
+% * Internal Change: add some internal function to improve readibility
+% (thanks to Philip K. F. H\ölzenspies)
+% * ADD: Block markers.
+% You can now ask package to put begin and end keywords automatically at begin
+% and end of blocks, it means each group of commands shifted and enclosed in
+% braces.
+% This is tricky to use but, combined with \SetStartEndCondition and
+% redefinition of keywords, you should be abble to simulate any syntax. See
+% examples in documentation where a generic example is derived in pseudo-code,
+% python and C by keeping code and changing only style using block markers
+% macros, \SetStartEndCondition and some redefinition of keywords.
+% These new block markers macros are:
+% - \AlgoDisplayBlockMarkers and \AlgoDontDisplayBlockMarkers
+% - \SetAlgoBlockMarkers{begin marker}{end marker}
+% - \BlockMarkersSty{text} and \SetBlockMarkersSty
+% Note that a new option has also been added: displayblockmarkers
+% * ADD: \leIf macro automatically defined by \SetKw: allow to define
+% an if-then-else on a single line.
+% * ADD: new macro \SetStartEndCondition{typo1}{typo2}{typo3} which
+% sets typo around condition in For, If, Switch, Case and
+% Repeat macros. First two are used around For, If, Swith
+% conditions, First and third are used for Case and Repeat
+% condition. Default definition is \SetStartEndCondition{ }{ }{}.
+% A common alternative is \SetStartEndCondition{ (}{) }{)}
+% Can also be used to remove space around condition, for
+% example if you want python style commands:
+% \SetStartEndCondition{ }{}{} and \SetKwFor{For}{for}{:}{}
+% * ADD: new environment algomathdisplay which allow display math (like inside \[ \] or $$ $$)
+% handling end line and line number
+% * ADD: new command \SetKwProg{Env}{Title}{is}{end} which defines a macro
+% \Env{args}{text}. Env is a block with 'Title' (in \CapSty) at the beginning
+% followed by args followed by 'is' then 'text' is put below inside a block ended
+% by 'end'. If no 'end' is specified, nothing is written (no
+% blank line is inserted). Useful to typeset function or prog for example:
+% \SetKwProg{Fn}{Function}{is}{end} makes \Fn{afunc(i: int) : int}{return 0\;}
+% writes:
+% Function afunc(i: int) : int is
+% | return 0;
+% end
+% or \SetKwProg{Def}{def}{:}{} makes \Def{afunc(i: int)}{return 0\;} writes:
+% def afunc(i: int):
+% | return 0
+% Tip: combine it with \SetKwFunction to write recursive function algorithm. With
+% example above, you could define \SetKwFunction{\Afunc}{afunc} and then write:
+% Def{\Afunc{i:int}{\eIf{i>0}{\KwRet \Afunc{i-1}}{\KwRet 0\;}} that writes:
+% def afunc(i: int):
+% | if(i>0):
+% | return afunc(i-1)
+% | else:
+% | return 0
+% with appropriate typo.
+% * ADD: option croatian: croation keywords (thanks to Ivan Gavran)
+% * ADD: option ngerman: same as german option but so can be used with global option ngerman
+% of babel
+% * ADD: option spanish: Spanish support (thanks to Mario Abarca)
+% * ADD: unterminated block: useful to add part separator that doesn't necessary need an end
+% keyword.
+% Designed on the pattern of unterminated if (see \uIf macro) allowing to
+% add a block that is not terminated by a keyword. Such block are defined in the same
+% time as a block is defined by adding a macro beginning with u. So, for example,
+% predefined \SetKwBlock{Begin}{begin}{end} defines now two commands:
+% - \Begin{} as previously which print a begin - end block
+% - \uBegin{} that defines a begin only block
+% * FIX: dotocloa option which was broken
+% * FIX: uIf and uCase didn't have same behavior when used with
+% noline, vlined or lined option. This is fixed. Side effect: no empty
+% line after an uIf or uCase when used with options lined or vlined
+% * FIX: a bug with Repeat Until command when use with side comment on Until
+% * FIX: a bug with side text -- text put into () -- of command macro (SetKwIf and so on)
+% which was always setting a ';' even after a \DontPrintSemicolon
+% * FIX: a bug with hyperref and chapter definition (thanks to Hubert Meier)
+% * FIX: bugs with l macro and side comment
+% * FIX: revision number
+% * FIX: fix non ascii character (utf8 not yet recognized by all latex engine)
+% * FIX: fnum@algocf had an useless parameter which sometimes broke expansion and output an error
+% * FIX: works now with multicol package
\end{verbatim}
\clearpage
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex04.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex04.tex
index 0e0b00fbcaf..2d586a01c9d 100644
--- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex04.tex
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex04.tex
@@ -1 +1,2 @@
-\lIf{cond4}{ok} \lElse{wrong}\; \ No newline at end of file
+\lIf{cond4}{ok} \lElse{wrong}
+\leIf{cond4}{ok}{wrong}
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex05.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex05.tex
index 6ee3f6f29ad..7db5f9d2492 100644
--- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex05.tex
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_ex05.tex
@@ -1,5 +1,5 @@
\SetAlgoVlined
-\lIf{cond5}{cond5 true}\;
+\lIf{cond5}{cond5 true}
\uElseIf{cond51}{
cond 5 false\;
but cond51 true\;
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exProg.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exProg.tex
new file mode 100644
index 00000000000..10428c08629
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exProg.tex
@@ -0,0 +1,6 @@
+\SetAlgoLined
+\SetKwProg{Fn}{Function}{ is}{end}
+\Fn{afunc(i: int) : int}{return 0\;}
+
+\SetKwProg{Def}{def}{:}{}
+\Def{afunc(i: int)}{return 0\;} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric.tex
new file mode 100644
index 00000000000..dc8c53d49bc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric.tex
@@ -0,0 +1,36 @@
+\Fn(\tcc*[h]{algorithm as a recursive function}){\FRecurs{some args}}{
+ \KwData{Some input data\\these inputs can be displayed on several lines and one
+ input can be wider than line's width.}
+ \KwResult{Same for output data}
+ \tcc{this is a comment to tell you that we will now really start code}
+ \If(\tcc*[h]{a simple if but with a comment on the same line}){this is true}{
+ we do that, else nothing\;
+ \tcc{we will include other if so you can see this is possible}
+ \eIf{we agree that}{
+ we do that\;
+ }{
+ else we will do a more complicated if using else if\;
+ \uIf{this first condition is true}{
+ we do that\;
+ }
+ \uElseIf{this other condition is true}{
+ this is done\tcc*[r]{else if}
+ }
+ \Else{
+ in other case, we do this\tcc*[r]{else}
+ }
+ }
+ }
+ \tcc{now loops}
+ \For{\forcond}{
+ a for loop\;
+ }
+ \While{$i<n$}{
+ a while loop including a repeat--until loop\;
+ \Repeat{this end condition}{
+ do this things\;
+ }
+ }
+ They are many other possibilities and customization possible that you have to
+ discover by reading the documentation.
+}
diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exswitch.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exswitch.tex
index c40b26c46fa..bce9a19ab4e 100644
--- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exswitch.tex
+++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exswitch.tex
@@ -3,7 +3,7 @@
do this\;
do that\;
}
- \lCase{another value}{one line}\;
+ \lCase{another value}{one line}
\Case{last value}{
do this\;
break\;