From 1f81eb3f2ce28dfe62579f3755abf24c2bafc1d3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 9 Nov 2015 22:43:36 +0000 Subject: algorithm2e (9nov15) git-svn-id: svn://tug.org/texlive/trunk@38805 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/algorithm2e/algorithm2e.pdf | Bin 487487 -> 532799 bytes .../doc/latex/algorithm2e/algorithm2e.tex | 513 +++++++++++--- .../algorithm2e/algorithm2e_exAlgoDisjdecomp.tex | 8 +- .../latex/algorithm2e/algorithm2e_exgeneric2.tex | 20 + .../doc/latex/algorithm2e/algorithm2e_exnlsty.tex | 12 + .../tex/latex/algorithm2e/algorithm2e.sty | 775 ++++++++++++++++----- 6 files changed, 1058 insertions(+), 270 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric2.tex create mode 100644 Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exnlsty.tex (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf index 2b19fceb269..a078f59bda6 100644 Binary files a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf and b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.pdf differ diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e.tex index 496cc8f6e36..4d2fc6fe614 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-2013 Christophe Fiorio, Montpellier 2 University, France +% (c) 1998-2015 Christophe Fiorio, Montpellier University, France % % Report bugs and comments to: -% christophe.fiorio@univ-montp2.fr +% christophe.fiorio@umontpellier.fr % -% $Id: algorithm2e.tex,v 5.0 2013/01/06 14:44:54 cfiorio Exp $ +% $Id: algorithm2e.tex,v 5.1 2015/10/18 21:35:18 cfiorio Exp $ % \documentclass[a4paper]{article} @@ -59,15 +59,27 @@ \newcommand{\optslide}{\textsf{slide}\index{french@\textsf{slide}|textit}\xspace} \newcommand{\optalgoe}{\textsf{algo2e}\index{french@\textsf{algo2e}|textit}\xspace} \newcommand{\optenglish}{\textsf{english}\index{english@\textsf{english}|textit}\xspace} +\newcommand{\optenglishkw}{\textsf{englishkw}\index{englishkw@\textsf{englishkw}|textit}\xspace} \newcommand{\optfrench}{\textsf{french}\index{french@\textsf{french}|textit}\xspace} +\newcommand{\optfrenchkw}{\textsf{frenchkw}\index{frenchkw@\textsf{frenchkw}|textit}\xspace} \newcommand{\optgerman}{\textsf{german}\index{german@\textsf{german}|textit}\xspace} +\newcommand{\optgermankw}{\textsf{germankw}\index{germankw@\textsf{germankw}|textit}\xspace} \newcommand{\optngerman}{\textsf{ngerman}\index{ngerman@\textsf{ngerman}|textit}\xspace} +\newcommand{\optngermankw}{\textsf{ngermankw}\index{ngermankw@\textsf{ngermankw}|textit}\xspace} \newcommand{\optspanish}{\textsf{spanish}\index{spanish@\textsf{spanish}|textit}\xspace} +\newcommand{\optspanishkw}{\textsf{spanishkw}\index{spanishkw@\textsf{spanishkw}|textit}\xspace} +\newcommand{\optitaliano}{\textsf{italiano}\index{italiano@\textsf{italiano}|textit}\xspace} +\newcommand{\optitalianokw}{\textsf{italianokw}\index{italianokw@\textsf{italianokw}|textit}\xspace} \newcommand{\optcroatian}{\textsf{croatian}\index{croatian@\textsf{croatian}|textit}\xspace} +\newcommand{\optcroatiankw}{\textsf{croatiankw}\index{croatiankw@\textsf{croatiankw}|textit}\xspace} \newcommand{\optportuguese}{\textsf{portuguese}\index{portuguese@\textsf{portuguese}|textit}\xspace} +\newcommand{\optportuguesekw}{\textsf{portuguesekw}\index{portuguesekw@\textsf{portuguesekw}|textit}\xspace} \newcommand{\optczech}{\textsf{czech}\index{czech@\textsf{czech}|textit}\xspace} -\newcommand{\optitaliano}{\textsf{italiano}\index{italiano@\textsf{italiano}|textit}\xspace} +\newcommand{\optczechkw}{\textsf{czechkw}\index{czechkw@\textsf{czechkw}|textit}\xspace} \newcommand{\optslovak}{\textsf{slovak}\index{slovak@\textsf{slovak}|textit}\xspace} +\newcommand{\optslovakkw}{\textsf{slovakkw}\index{slovakkw@\textsf{slovakkw}|textit}\xspace} +\newcommand{\optturkish}{\textsf{turkish}\index{turkish@\textsf{turkish}|textit}\xspace} +\newcommand{\optturkishkw}{\textsf{turkishkw}\index{turkishkw@\textsf{turkishkw}|textit}\xspace} \newcommand{\optboxed}{\textsf{boxed}\index{boxed@\textsf{boxed}|textit}\xspace} \newcommand{\optboxruled}{\textsf{boxruled}\index{boxruled@\textsf{boxruled}|textit}\xspace} \newcommand{\optruled}{\textsf{ruled}\index{ruled@\textsf{ruled}|textit}\xspace} @@ -104,16 +116,33 @@ \newcommand{\optnokwfunc}{\textsf{nokwfunc}\index{nokwfunc@\textsf{nokwfunc}|textit}\xspace} \newcommand{\optblockmarkers}{\textsf{displayblockmarkers}\index{displayblockmarkers@\textsf{displayblockmarkers}|textit}\xspace} % +\newcommand{\optgroupmarkers}{\textsf{displaygroupmarkers}\index{displaygroupmarkers@\textsf{displaygroupmarkers}|textit}\xspace} +\newcommand{\optnoalgohanging}{\textsf{noalgohanging}\index{noalgohanging@\textsf{noalgohanging}|textit}\xspace} +\newcommand{\opthangingcomment}{\textsf{hangingcomment}\index{hangingcomment@\textsf{hangingcomment}|textit}\xspace} +\newcommand{\opthanginginout}{\textsf{opthanginginout}\index{opthanginginout@\textsf{opthanginginout}|textit}\xspace} +% \newcommand{\Optfrench}{\textsf{french}\index{french@\textsf{french}|textbf}\xspace} +\newcommand{\Optfrenchkw}{\textsf{frenchkw}\index{frenchkw@\textsf{frenchkw}|textbf}\xspace} \newcommand{\Optenglish}{\textsf{english}\index{english@\textsf{english}|textbf}\xspace} +\newcommand{\Optenglishkw}{\textsf{englishkw}\index{englishkw@\textsf{englishkw}|textbf}\xspace} \newcommand{\Optgerman}{\textsf{german}\index{german@\textsf{german}|textbf}\xspace} +\newcommand{\Optgermankw}{\textsf{germankw}\index{germankw@\textsf{germankw}|textbf}\xspace} \newcommand{\Optngerman}{\textsf{ngerman}\index{ngerman@\textsf{ngerman}|textbf}\xspace} +\newcommand{\Optngermankw}{\textsf{ngermankw}\index{ngermankw@\textsf{ngermankw}|textbf}\xspace} \newcommand{\Optspanish}{\textsf{spanish}\index{spanish@\textsf{spanish}|textbf}\xspace} +\newcommand{\Optspanishkw}{\textsf{spanishkw}\index{spanishkw@\textsf{spanishkw}|textbf}\xspace} \newcommand{\Optcroatian}{\textsf{croatian}\index{croatian@\textsf{croatian}|textbf}\xspace} -\newcommand{\Optportugues}{\textsf{portugues}\index{portugues@\textsf{portugues}|textbf}\xspace} +\newcommand{\Optcroatiankw}{\textsf{croatiankw}\index{croatiankw@\textsf{croatiankw}|textbf}\xspace} +\newcommand{\Optportugues}{\textsf{portuguese}\index{portuguese@\textsf{portuguese}|textbf}\xspace} +\newcommand{\Optportugueskw}{\textsf{portuguesekw}\index{portuguesekw@\textsf{portuguesekw}|textbf}\xspace} \newcommand{\Optczech}{\textsf{czech}\index{czech@\textsf{czech}|textbf}\xspace} +\newcommand{\Optczechkw}{\textsf{czechkw}\index{czechkw@\textsf{czechkw}|textbf}\xspace} \newcommand{\Optitaliano}{\textsf{italiano}\index{italiano@\textsf{italiano}|textbf}\xspace} +\newcommand{\Optitalianokw}{\textsf{italianokw}\index{italianokw@\textsf{italianokw}|textbf}\xspace} \newcommand{\Optslovak}{\textsf{slovak}\index{slovak@\textsf{slovak}|textbf}\xspace} +\newcommand{\Optslovakkw}{\textsf{slovakkw}\index{slovakkw@\textsf{slovakkw}|textbf}\xspace} +\newcommand{\Optturkish}{\textsf{turkish}\index{turkish@\textsf{turkish}|textbf}\xspace} +\newcommand{\Optturkishkw}{\textsf{turkishkw}\index{turkishkw@\textsf{turkishkw}|textbf}\xspace} \newcommand{\Optboxed}{\textsf{boxed}\index{boxed@\textsf{boxed}|textbf}\xspace} \newcommand{\Optboxruled}{\textsf{boxruled}\index{boxruled@\textsf{boxruled}|textbf}\xspace} \newcommand{\Optruled}{\textsf{ruled}\index{ruled@\textsf{ruled}|textbf}\xspace} @@ -149,6 +178,11 @@ \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{\Optgroupmarkers}{\textsf{displaygroupmarkers}\index{displaygroupmarkers@\textsf{displaygroupmarkers}|textbf}\xspace} +\newcommand{\Optnoalgohanging}{\textsf{noalgohanging}\index{noalgohanging@\textsf{noalgohanging}|textbf}\xspace} +\newcommand{\Opthangingcomment}{\textsf{hangingcomment}\index{hangingcomment@\textsf{hangingcomment}|textbf}\xspace} +\newcommand{\Opthanginginout}{\textsf{opthanginginout}\index{opthanginginout@\textsf{opthanginginout}|textbf}\xspace} +% %%% \newcommand{\ExampleOfAlgo}[1]{% \begin{minipage}{.4\textwidth}% @@ -161,11 +195,11 @@ \end{minipage}% } %%%%%%%%%%%%%%%%%%%%%% -\newcommand{\algocfversion}{release 5.0} +\newcommand{\algocfversion}{release 5.1} \title{algorithm2e.sty --- package for algorithms\\ {\large\algocfversion}} \author{(c) 1995-1997 Christophe Fiorio, Tu-Berlin, Germany\\ -(c) 1998-2013 Christophe Fiorio, LIRMM, Montpellier 2 University, France\\ - Report bugs and comments to cfiorio@um2.fr\\ +(c) 1998-2015 Christophe Fiorio, LIRMM, Montpellier University, France\\ + Report bugs and comments to christophe.fiorio@umontpellier.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 @@ -175,7 +209,7 @@ 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} + for their remarks} } \date{October 19 2015} \makeindex @@ -283,7 +317,7 @@ The \autoref{algo_disjdecomp} and \autoref{IR} are written with this package. Here we suppose that we have done: \begin{verbatim} -\usepackage[lined,boxed,commentsnumbered]{algorithm2e} +\usepackage[linesnumbered,lined,boxed,commentsnumbered]{algorithm2e} \end{verbatim}\index{lined|textit,algonl|textit,boxed|textit} \noindent The \autoref{algo_disjdecomp} was written in \LaTeX2e code as presented next page. You can label lines, @@ -362,8 +396,9 @@ command\footnote{Default behaviour uses \emph{short end} keywords, it means type \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 +The \autoref{algo:pseudocodeblock} shows how you can have each block tagged with begin-end +keywords. This is done by using automatic block +display (new feature since release 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}% @@ -375,7 +410,21 @@ 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 +\end{algorithm} + +Not that since release 5.1, you can also have block tagged for one line display. The +\autoref{algo:pseudocodegroup} is based on \autoref{algo:pseudocodeblock} but uses ``l macros'' as e.g. \texttt{$\backslash$lIf} to display command on one line ; \texttt{$\backslash$AlgoDisplayGroupMarkers} is added to have also block tagged with markers defined by \texttt{$\backslash$SetAlgoBlockMarkers}. To achieve this display, we replace preamble of \autoref{algo:pseudocodeblock} by:\vspace{-1.5ex} +\begin{verbatim} + \AlgoDisplayBlockMarkers\AlgoDisplayGroupMarkers\SetAlgoBlockMarkers{ \{}{ \}\ }% + \SetAlgoNoEnd\SetAlgoNoLine +\end{verbatim} +\begin{algorithm} + \AlgoDisplayBlockMarkers\AlgoDisplayGroupMarkers\SetAlgoBlockMarkers{ \{}{ \}\ }% + \SetAlgoNoEnd\SetAlgoNoLine + \caption{\autoref{algo:pseudocodeblock} with \{\} block set even for one line command.}\label{algo:pseudocodegroup} + \input{algorithm2e_exgeneric2} +\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} @@ -588,15 +637,36 @@ keep its original name: %-------------------------------------------------------------------------- \subsection{language option} \label{sec:option:language} + +There are predefined keywords in different languages already defined (see +section~\ref{sec_lang} or in the .sty file) that you can activate by using appropriate option. You +can also activate these localized keywords by using same option followed by \emph{kw}. In +this case, you keep all localized keywords already defined and add the new ones. Note that +this option is not robust, and there are macros in differents language that are the +same. In this case, last defined is the one staying. But this allow you to have +predefined keywords in multiple languages. + \begin{description} -\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[\Optspanish:] to have for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip +\item[\Optfrench:] to have French keywords, for example \textsl{algorithme\ :} instead of \textsl{algorithm:}. +\item[\Optfrenchkw:] to add French keywords definition. +\item[\Optgerman:] to have German keywords, for example \textsl{Prozedur\ :} instead of \textsl{procedure:}. \medskip +\item[\Optgermankw:] to add German keywords definition. +\item[\Optngerman:] German option as babel +\item[\Optspanish:] to have Spanish keywords, for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip +\item[\Optspanishkw:] to add Spanish keywords definition. +\item[\Optitaliano:] to have Italian keywords, for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip +\item[\Optitalianokw:] to add Italian keywords definition. +\item[\Optportugues:] to have Portuguese keywords, for example \textsl{Algoritmo:} instead of \textsl{algorithm:}. \medskip +\item[\Optportugueskw:] to add Portuguese keywords definition. +\item[\Optcroatian:] to have Croatian keywords, for example \textsl{Algoritam:} instead of \textsl{algorithm:}. \medskip +\item[\Optcroatiankw:] to add Croatian keywords definition. +\item[\Optczech:] to have Czech keywords, for example \textsl{Algoritmus:} instead of \textsl{algorithm:}. +\item[\Optczechkw:] to add Czech keywords definition. +\item[\Optturkish:] to have Turkish keywords, for example \textsl{Algoritma:} instead of \textsl{algorithm:}. +\item[\Optturkishkw:] to add Turkish keywords definition. +\item[\Optczech:] to have for example \textsl{Algoritmus:} instead of \textsl{algorithm:}. +\item[\Optczechkw:] to add Czech keywords definition. \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} @@ -680,6 +750,24 @@ keep its original name: \subsection{code typesetting} \label{sec:option:algodisplay} +\subsubsection{indentation of long statements} +\label{sec:option:algohanging} + +\begin{description} +\item[\Optnoalgohanging] By default, long statement are indented on subsequent lines (see + to know how to control length of indentation); with this option you get old behavior and + lines are no more indented. +\item[\Opthangingcomment] Comment that are alone on a line (not side comment) are not + driven by algorithm hanging: subsequent lines of long comments are indented according to + width of start comment marker. With this option, comment are indented like normal + statement. +\item[\Opthanginginout] As for comment, by default, in/out keywords and input keywords + (defined by \texttt{$\backslash$SetKwInOut} or \texttt{$\backslash$SetKwInput}) are not + indented by algorithm hangindent. They are indented according to width of input + keyword. If you want that these keywords acts like other statements, use this option. +\end{description} + + %--------------------------------- \subsubsection{blocks display} \label{sec:option:algodisplay:blocks} @@ -705,6 +793,8 @@ keep its original name: \begin{description} \item[\Optblockmarkers] \almac{AlgoDisplayBlockMarkers} becomes the default, see \autoref{sec_styleoptions} for explanations about the \almac{AlgoDisplayBlockMarkers} macro. +\item[\Optgroupmarkers] \almac{AlgoDisplayGroupMarkers} becomes the default, see \autoref{sec_styleoptions} + for explanations about the \almac{AlgoDisplayGroupMarkers} macro. \end{description} %--------------------------------- @@ -802,9 +892,8 @@ There are eight text types in an algorithm environment: 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 Block markers : \textbf{BlockMarkersSty} is style of keywords that are print at begin + and end of block when \optblockmarkers and/or \optgroupmarkers option are set, or \almac{AlgoDisplayBlockMarkers} and/or \almac{AlgoDisplaygroupMarkers} macro are used. By default, \almac{BlockMarkersSty} is set to \almac{KwSty}. \item The text (the default): All the remaining text of the algorithm. \end{enumerate} @@ -834,8 +923,8 @@ beginning a block outside an algorithm environment. \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{ }{ }{}+.\\ + \texttt{Switch}, \texttt{Case} conditions, First and third are used for \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}{:}{}+ @@ -844,6 +933,7 @@ beginning a block outside an algorithm environment. \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. +\item[\Almac{AlgoDisplayGroupMarkers}] is related to \almac{AlgoDisplayBlockMarkers} and do the same but for command that are displayed on a single line. \end{description} %---------- @@ -882,7 +972,12 @@ The following commands help you to define the style and the layout of the captio \begin{description} \item[\almacp{SetAlgoCaptionSeparator}{sep}] which sets the separator between title of algorithms (\textbf{Algorithm 1}) and the name of the algorithm. By default it's ':' and caption looks like "\textbf{Algorithm 2: name}" but now you - can change it by using for example \SetAlgoCaptionSeparator{.} which will give "\textbf{Algorithm 3. name}". + can change it by using for example \SetAlgoCaptionSeparator{.} which will give + "\textbf{Algorithm 3. name}". +\item[\Almacp{SetCustomAlgoRuledWidth}{length}] set a custom ruled width of ruled and + algoruled options ; note that by the moment you use this macro, rules will have this + fixed length: this can cause strange behavior in multicolumn mode or other layout that + change the line width. \item[\Almac{AlCapSkip}] is the dimension of the distance between algorithm body and caption in \emph{plain} and \emph{boxed} mode. You can change by hands or by using \almacp{SetAlCapSkip}{0ex}. \item[\Almacp{SetAlCapSkip}{length}] sets the lenght of \almac{AlCapSkip}) dimension between @@ -997,6 +1092,8 @@ commands'' (see \autoref{sec:setfntsty}) \item[\Almacp{KwSty}{$<$text$>$}] sets $<$text$>$ in keyword type style. \item[\Almacp{FuncSty}{$<$text$>$}] sets $<$text$>$ in function type style. +\item[\Almacp{FuncArgSty}{$<$text$>$}] sets $<$text$>$ in function argument type style. +\item[\Almacp{ProgSty}{$<$text$>$}] sets $<$text$>$ in programm (KwProg) type style. \item[\Almacp{ArgSty}{$<$text$>$}] sets $<$text$>$ in argument type style. \item[\Almacp{DataSty}{$<$text$>$}] sets $<$text$>$ in data typography. @@ -1139,6 +1236,10 @@ Here is the complete list of these macros: default: \textbf{textbf}). \item[\Almacp{SetFuncSty}{$<$font$>$}] sets the function typography (by default: \textbf{texttt}). +\item[\Almacp{SetFuncArgSty}{$<$font$>$}] sets the typography of function argument +(by default: \textbf{emph}). +\item[\Almacp{SetProgSty}{$<$font$>$}] sets the KwProg typography to $<$font$>$ (by + default: \textbf{emph}). \item[\Almacp{SetArgSty}{$<$font$>$}] sets the argument typography (by default: \textbf{emph}). \item[\Almacp{SetDataSty}{$<$font$>$}] sets the data typography (by @@ -1246,6 +1347,8 @@ the last example above can be define in a simplier way that previously presented \item[\Almac{SetAlgoNoEnd}] acts like \optnoend option. \item[\Almacpp{SetInd}{before rule space}{after rule space}] sets the size of the space before the vertical rule and after. In \almac{NoLine} mode the indentation space is the sum of these two values, by default 0.5em and 1em +\item[\Almacp{SetAlgoHangIndent}{length}] sets the value of indent length used by + hangindent to indent subsequent lines after the first on a long statement. \item[\Almacp{Setvlineskip}{length}] sets the value of the vertical space after the little horizontal line which closes a block in \optvlined mode. \item[\Almacp{SetAlgoSkip}{skip command}] Algorithms puts extra vertical space @@ -1284,6 +1387,7 @@ the last example above can be define in a simplier way that previously presented \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. +\item[\Almac{DisplayGroupMarkers}] acts like \optgroupmarkers option: each block of single line command will be started by a \emph{begin} keyword and be ended by an \emph{end} keywords. \Almacpp{SetAlgoBlockMarkers}{begin keyword}{end keyword} defines \emph{begin} and \emph{end} keywords that will be used by \verb+\DisplayGroupMarkers+. Note that begin-end group markers are necessarly the same as \verb+\DisplayBlockMarkers+. \end{description} Some length are used to set the layout of ruled, algoruled and boxruled algorithms caption. These length have no @@ -1331,8 +1435,8 @@ The following macro control how comment are typeseted. \section{The predefined language keywords}\label{predefkeywords} -Here are the english keywords predefined in the package. There are other -language predefined macros provided, such as french keywords, see +Here are the English keywords predefined in the package. There are other +language predefined macros provided, such as French keywords, see \autoref{sec_lang} for a list of other language keywords. All these keywords are defined using macros provided by the package and described in \autoref{sec_deflanguage}. @@ -1573,11 +1677,11 @@ package with your own. 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 +\item[\Almacpppp{SetKwProg}{Prog}{Title}{ is}{end}] Env is a block with 'Title' (in + \texttt{CapSty} style) at the beginning followed by args in \texttt{ProgSty} 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} @@ -1588,8 +1692,8 @@ If you want describe the function by an algorithm, use instead \emph{function} o \begin{description} \item[\Almacpp{SetKwFunction}{KwFn}{Fn}] defines a macro - \almacp{KwFn}{arg} which prints \emph{Fn} in Function typography and - its argument \emph{arg} in argument typography, surrounded by a pair + \almacp{KwFn}{arg} which prints \emph{Fn} in \texttt{FuncSty} typography and + its argument \emph{arg} in \texttt{FuncArgSty} typography, surrounded by a pair of parentheses. \almacpp{SetKwFunction}{Dothat}{Do that} defines the macro @@ -1645,29 +1749,51 @@ If you want describe the function by an algorithm, use instead \emph{function} o \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 \almacpp{If}{cond}{Then's text(comment)}\\ + as previous but put \emph{comment} after \texttt{end} keyword. Usually use with + comment macro like \almac{tcc}*[f]\{comment\} or \almac{tcp}*[f]\{comment\} + \item \almacpp{If(comment1)}{cond}{Then's text(comment2)}\\ + as previous but put \emph{comment1} after \texttt{then} keyword and \emph{comment2} + after \texttt{end}. 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{ElseIf}{ElseIf's text(comment)}\\ + the same with comment. + \item \almacp{ElseIf(comment)}{ElseIf's text(comment)}\\ + 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}\\ + \item \almacp{Else(comment)}{Else's text}\\ + the same with comment. + \item \almacp{Else}(comment){Else's text(comment)}\\ 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. 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 \almacpp{lIf*}{cond}{Then's text}\\ + Then's text is written on the same line as \texttt{then}. No \texttt{endif} and no end + of line are printed. Do not put $\backslash$; after \emph{Then's text} neither after \almac{lIf}. \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{lElseIf*}{ElseIf's text}\\ + ElseIf's text is written on the same line as \texttt{else if}. No \texttt{endif} + and no end of line are printed. \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 \almacp{lElse*}{Else's text}\\ + Else's text is written on the same line as \texttt{else}. No \texttt{endif} + is printed and no end of line are printed. \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 @@ -1738,16 +1864,26 @@ in the package:\par\smallskip \ExampleOfAlgo{algorithm2e_ex01.tex}\par---\par \begin{itemize} \item \almacpp{Switch}{iden}{switch's block} \item \almacpp{Switch(comment)}{iden}{switch's block} + \item \almacpp{Switch}{iden}{switch's block(comment)} + \item \almacpp{Switch(comment)}{iden}{switch's block(comment)} \item \almacpp{Case}{cond}{Case's block} \item \almacpp{Case(comment)}{cond}{Case's block} + \item \almacpp{Case}{cond}{Case's block(comment)} + \item \almacpp{Case(comment)}{cond}{Case's block(comment)} \item \almacpp{uCase}{cond}{Case's block} \item \almacpp{uCase(comment)}{cond}{Case's block} \item \almacpp{lCase}{cond}{Case's text} + \item \almacpp{lCase*}{cond}{Case'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{Other}{Otherwise's block(comment)} + \item \almacp{Other(comment)}{Otherwise's block(comment)} \item \almacp{lOther}{Otherwise's text} + \item \almacp{lOther*}{Otherwise's text} \item \almacp{lOther(comment)}{Otherwise's text} + \item \almacp{uOther}{Otherwise's text} + \item \almacp{uOther}(comment){Otherwise's text} \end{itemize} \end{description} @@ -1768,8 +1904,11 @@ As for If-then-elseif-else-endif macro, you can use () to put comments after mai \begin{itemize} \item \almacpp{For}{loop's condition}{For's text} \item \almacpp{For(comment)}{loop's condition}{For's text} + \item \almacpp{For}{loop's condition}{For's text(comment)} + \item \almacpp{For(comment)}{loop's condition}{For's text(comment)} \item \almacpp{lFor}{loop's condition}{For's text} \item \almacpp{lFor(comment)}{loop's condition}{For's text} + \item \almacpp{lFor*}{loop's condition}{For's text} \end{itemize} \end{description} @@ -1788,9 +1927,10 @@ As for If-then-elseif-else-endif macro, you can use () to put comments after mai \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{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*}{end loop condition}{only one line} \item \almacpp{lRepeat(comment)}{end loop condition}{only one line} \end{itemize} \end{description} @@ -1803,7 +1943,7 @@ As for If-then-elseif-else-endif macro, you can use () to put comments after mai %\clearpage \section{Other language predefined keywords}\label{sec_lang} -\subsection{french keywords} +\subsection{French keywords} Hey, I am a frenchy , so I have defined the same as in \autoref{predefkeywords} but in french. @@ -1926,66 +2066,64 @@ Here we describe how they are obtained: \item \almacpppp{SetKwFor}{Solange}{solange}{tue}{Ende}%While \end{itemize} -\subsection{Portuguese keywords} +\subsection{Spanish keywords} -\begin{itemize} -\item $\backslash$Entrada\{Entrada\}\macind{KwEntrada}\par - $\backslash$Saida\{Sa\'{i}da\}\macind{KwSaida}\par - $\backslash$Dados\{Dados\}\macind{KwDados}\par - $\backslash$Resultado\{Resultado\}\macind{KwResultado} -\item $\backslash$Ate\macind{at\'{e}}\par - $\backslash$KwRetorna\{[val]\}\macind{KwRetorna}\par - $\backslash$Retorna\{[val]\}\macind{Retorna} -\item $\backslash$Iniciob\{inside block\}\macind{Iniciob} -\item $\backslash$eSe\{condition\}\{then block\}\{else block\}\macind{eSe}\par - $\backslash$Se\{condition\}\{then block\}\macind{Se}\par - $\backslash$uSe\{condition\}\{then block without end\}\macind{uSe}\par - $\backslash$lSe\{condition\}\{then's line text\}\macind{lSe}\par - $\backslash$Senao\{else block\}\macind{Senao}\par - $\backslash$uSenao\{else block without else\}\macind{uSenao}\par - $\backslash$lSenao\{else's line text\}\macind{lSenao}\par - $\backslash$SenaoSe\{condition\}\{elseif block\}\macind{uSenaoSe}\par - $\backslash$uSenaoSe\{condition\}\{elseif block without end\}\macind{uSenaoSe}\par - $\backslash$lSenaoSe\{condition\}\{elseif's line text\}\macind{lSenaoSe} -\item $\backslash$Selec\{condition\}\{Switch block\}\macind{Selec}\par - $\backslash$Caso\{a case\}\{case block\}\macind{Caso}\par - $\backslash$uCaso\{a case\}\{case block without end\}\macind{uCaso}\par - $\backslash$lCaso\{a case\}\{case's line\}\macind{lCaso}\par - $\backslash$Outro\{otherwise block\}\macind{Outro}\par - $\backslash$lOutro\{otherwise's line\}\macind{lOutro} -\item $\backslash$Para\{condition\}\{text loop\}\macind{Para}\par - $\backslash$lPara\{condition\}\{line text loop\}\macind{lPara} -\item $\backslash$ParaPar\{condition\}\{text loop\}\macind{ParaPar}\par - $\backslash$lParaPar\{condition\}\{line text loop\}\macind{lParaPar} -\item $\backslash$ParaCada\{condition\}\{text loop\}\macind{ParaCada}\par - $\backslash$lParaCada\{condition\}\{line text loop\}\macind{lParaCada} -\item $\backslash$ParaTodo\{condition\}\{text loop\}\macind{ParaTodo}\par - $\backslash$lParaTodo\{condition\}\{line text loop\}\macind{lParaTodo} -\item $\backslash$Enqto\{stop condition\}\{text loop\}\macind{Enqto}\par - $\backslash$lEnqto\{stop condition\}\{text loop\}\macind{lEnqto} -\item $\backslash$Repita\{stop condition\}\{text loop\}\macind{Repita}\par - $\backslash$lRepita\{stop condition\}\{line of the loop\}\macind{lRepita} -\end{itemize} +\begin{enumerate} +\item $\backslash$Datos\{Datos\}\macind{Datos}\par + $\backslash$Resultado\{Resultado\}\macind{Resultado}\par + $\backslash$Entrada\{Entrada\}\macind{Entrada}\par + $\backslash$Salida\{Salida\}\macind{Salida}\par +\item $\backslash$KwA\macind{KwA}\par + $\backslash$Devolver\{[value]\}\macind{Devolver} +\item $\backslash$Inicio\{inside block\}\macind{Inicio} +\item $\backslash$eSSi\{condition\}\{then block\}\{else block\}\macind{eSSi}\par + $\backslash$SSi\{condition\}\{then block\}\macind{SSi}\par + $\backslash$uSSi\{condition\}\{then block without end\}\macind{uSSi}\par + $\backslash$lSSi\{condition\}\{then line\}\macind{lSSi}\par + $\backslash$EnOtroCasoSi\{condition\}\{elseif block\}\macind{EnOtroCasoSi}\par + $\backslash$uEnOtroCasoSi\{condition\}\{elseif block\}\macind{uEnOtroCasoSi}\par + $\backslash$lEnOtroCasoSi\{condition\}\{elseif line without end\}\macind{lEnOtroCasoSi}\par + $\backslash$EnOtroCaso\{else block\}\macind{EnOtroCaso}\par + $\backslash$uEnOtroCaso\{else block without end\}\macind{uEnOtroCaso}\par + $\backslash$lEnOtroCaso\{else line\}\macind{lEnOtroCaso}\par +\item $\backslash$Seleccionar\{condition\}\{Seleccionar caso block\}\macind{Seleccionar} + $\backslash$uSeleccionar\{seleccionar\}\{caso block without end\}\macind{uSeleccionar}\par + $\backslash$Caso\{seleccionar\}\{caso block\}\macind{Caso}\par + $\backslash$lCaso\{seleccionar\}\{caso line\}\macind{lCaso}\par + $\backslash$Otro\{sin\'o block\}\macind{Otro}\par + $\backslash$lOtro\{sin\'o line\}\macind{lOtro}\par +\item $\backslash$Para\{condition\}\{loop block\}\macind{Para}\par + $\backslash$lPara\{condition\}\{loop line\}\macind{lPara} +\item $\backslash$ParaPara\{condition\}\{loop block\}\macind{ParaPara}\par + $\backslash$lParaPara\{condition\}\{loop line\}\macind{lParaPara} +\item $\backslash$Mientras\{condition\}\{loop block\}\macind{Mientras}\par + $\backslash$lMientras\{condition\}\{loop line\}\macind{lMientras} +\item $\backslash$ParaCada\{condition\}\{loop block\}\macind{ParaCada}\par + $\backslash$lParaCada\{condition\}\{loop line\}\macind{lPourCh} +\item $\backslash$ParaTodo\{condition\}\{loop block\}\macind{ParaTodo}\par + $\backslash$lParaTodo\{condition\}\{loop line\}\macind{lParaTodo} +\item $\backslash$Repetir\{stop condition\}\{loop block\}\macind{Repetir}\par + $\backslash$lRepetir\{stop condition\}\{line loop\}\macind{lRepetir} +\end{enumerate} Here we describe how they are obtained: \begin{enumerate} -\item \almacpp{SetKwInput}{Entrada}{Entrada}\par - \almacpp{SetKwInput}{Saida}{Sa\'{i}da}\par - \almacpp{SetKwInput}{Dados}{Dados}\par - \almacpp{SetKwInput}{Resultado}{Resultado}% -\item \almacpp{SetKw}{Ate}{at\'{e}} - \almacpp{SetKw}{KwRetorna}{retorna}\par - \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 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}% -\item \almacpppp{SetKwFor}{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}% -\item \almacpppp{SetKwFor}{Enqto}{enquanto}{fa\c{c}a}{fim enqto}% -\item \almacppp{SetKwRepeat}{Repita}{repita}{at\'{e}}% +\item \almacpp{SetKwInput}{Datos}{Datos}\par + \almacpp{SetKwInput}{Resultado}{Resultado}\par + \almacpp{SetKwInput}{Entrada}{Entrada}\par + \almacpp{SetKwInput}{Salida}{Salida}\par +\item \almacpp{SetKw}{KwA}{a}\par + \almacpp{SetKw}{Devolver}{devolver} +\item \almacppp{SetKwBlock}{Inicio}{inicio}{fin} +\item \almacphuit{SetKwIF}{SSi}{EnOtroCasoSi}{EnOtroCaso}{si}{entonces}{sin\'o, si}{sin\'o}{fin si} +\item {\footnotesize\almacphuit{SetKwSwitch}{Seleccionar}{Caso}{Otro}{seleccionar}{hacer}{caso}{sin\'o}{fin caso}\texttt{fin seleccionar}} +\item \almacpppp{SetKwFor}{Para}{para}{hacer}{fin para}\par +\item \almacpppp{SetKwFor}{ParaPara}{par}{hacer en paralelo}{fin para}\par +\item \almacpppp{SetKwFor}{Mientras}{mientras}{hacer}{fin mientras}\par +\item \almacpppp{SetKwFor}{ParaCada}{ParaCada}{hacer}{fin para cada} +\item \almacpppp{SetKwFor}{ParaTodo}{para todo}{hacer}{fin para todo} +\item \almacppp{SetKwRepeat}{Repetir}{repetir}{hasta que} \end{enumerate} \subsection{Italian keywords} @@ -2050,6 +2188,68 @@ Here we describe how they are obtained: \item \almacpppp{SetKwFor}{Finche}{finché}{fai}{fine finché} \end{enumerate} +\subsection{Portuguese keywords} + +\begin{itemize} +\item $\backslash$Entrada\{Entrada\}\macind{KwEntrada}\par + $\backslash$Saida\{Sa\'{i}da\}\macind{KwSaida}\par + $\backslash$Dados\{Dados\}\macind{KwDados}\par + $\backslash$Resultado\{Resultado\}\macind{KwResultado} +\item $\backslash$Ate\macind{at\'{e}}\par + $\backslash$KwRetorna\{[val]\}\macind{KwRetorna}\par + $\backslash$Retorna\{[val]\}\macind{Retorna} +\item $\backslash$Iniciob\{inside block\}\macind{Iniciob} +\item $\backslash$eSe\{condition\}\{then block\}\{else block\}\macind{eSe}\par + $\backslash$Se\{condition\}\{then block\}\macind{Se}\par + $\backslash$uSe\{condition\}\{then block without end\}\macind{uSe}\par + $\backslash$lSe\{condition\}\{then's line text\}\macind{lSe}\par + $\backslash$Senao\{else block\}\macind{Senao}\par + $\backslash$uSenao\{else block without else\}\macind{uSenao}\par + $\backslash$lSenao\{else's line text\}\macind{lSenao}\par + $\backslash$SenaoSe\{condition\}\{elseif block\}\macind{uSenaoSe}\par + $\backslash$uSenaoSe\{condition\}\{elseif block without end\}\macind{uSenaoSe}\par + $\backslash$lSenaoSe\{condition\}\{elseif's line text\}\macind{lSenaoSe} +\item $\backslash$Selec\{condition\}\{Switch block\}\macind{Selec}\par + $\backslash$Caso\{a case\}\{case block\}\macind{Caso}\par + $\backslash$uCaso\{a case\}\{case block without end\}\macind{uCaso}\par + $\backslash$lCaso\{a case\}\{case's line\}\macind{lCaso}\par + $\backslash$Outro\{otherwise block\}\macind{Outro}\par + $\backslash$lOutro\{otherwise's line\}\macind{lOutro} +\item $\backslash$Para\{condition\}\{text loop\}\macind{Para}\par + $\backslash$lPara\{condition\}\{line text loop\}\macind{lPara} +\item $\backslash$ParaPar\{condition\}\{text loop\}\macind{ParaPar}\par + $\backslash$lParaPar\{condition\}\{line text loop\}\macind{lParaPar} +\item $\backslash$ParaCada\{condition\}\{text loop\}\macind{ParaCada}\par + $\backslash$lParaCada\{condition\}\{line text loop\}\macind{lParaCada} +\item $\backslash$ParaTodo\{condition\}\{text loop\}\macind{ParaTodo}\par + $\backslash$lParaTodo\{condition\}\{line text loop\}\macind{lParaTodo} +\item $\backslash$Enqto\{stop condition\}\{text loop\}\macind{Enqto}\par + $\backslash$lEnqto\{stop condition\}\{text loop\}\macind{lEnqto} +\item $\backslash$Repita\{stop condition\}\{text loop\}\macind{Repita}\par + $\backslash$lRepita\{stop condition\}\{line of the loop\}\macind{lRepita} +\end{itemize} + +Here we describe how they are obtained: + +\begin{enumerate} +\item \almacpp{SetKwInput}{Entrada}{Entrada}\par + \almacpp{SetKwInput}{Saida}{Sa\'{i}da}\par + \almacpp{SetKwInput}{Dados}{Dados}\par + \almacpp{SetKwInput}{Resultado}{Resultado}% +\item \almacpp{SetKw}{Ate}{at\'{e}} + \almacpp{SetKw}{KwRetorna}{retorna}\par + \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 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}% +\item \almacpppp{SetKwFor}{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}% +\item \almacpppp{SetKwFor}{Enqto}{enquanto}{fa\c{c}a}{fim enqto}% +\item \almacppp{SetKwRepeat}{Repita}{repita}{at\'{e}}% +\end{enumerate} + \subsection{Some Czech keywords} Here are some czech keywords, please feel free to send me the others. @@ -2084,6 +2284,125 @@ How they are obtained: \section*{Release notes}\label{sec:relnotes} \begin{verbatim} +% - October 19 2015 - revision 5.1 +% * CHANGE/ADD: l commands (the ones as \lIf) can now be used with a +% star. If done, no end of line are done, so you can enclose +% l command into another one. For example, you can write: +% \lForEach{$i$}{\lIf*{foo}{bar}}. +% Note that when you use a star, side comments are not allowed. +% * CHANGE/ADD: Now you can have a side comment at end of macros which +% have a block. For example you can do : +% \Begin(\tcc*[h]{side comment for begin}{text}(\tcc*[h]{side comment after end}) +% Note: there are some side effects for some commands: +% \SetKwProg : macro defined thanks to \SetKwProg are allowed +% to have no end marker. In this case, +% beware to end side comment, this can +% do weird output (but no error) +% * CHANGE: \SetKwSwitch defines also an \uOther command which was not +% the case until this release. +% * CHANGE: \SetStartEndCondition{typo1}{typo2}{typo3} defined two end +% conditions (type2 and typo3) : typo3 is no more used for +% case condition as typo2 is used which is more consistent +% since there is a condition followed by a keyword as for +% if-then or other command that are defined using typo2. +% * CHANGE: keywords was not language dependant to allow to use multiple +% languages in the same document, but some keywords in +% different language were having the same keyword that lead +% last one declared to replace first one and so you could have some +% spanish keywords printed as you were in portuguese. So +% this behavior is changed from now: +% - localized keywords are defined if according language +% option is defined ; +% - if you want to keep old behaviour and use localized +% keywords without using language option (keep old +% behavior), you can use languagekw option +% (e.g. frenchkw, germankw, ...). Note that you can use +% multiple languagekw options at the same time, in +% contrary of language option. Note also that if you use +% multiple languagekw options, you can get back the same +% problem as previously when keywords was not language +% dependant. +% * ADD: new typo styles: +% - Arguments of functions have now their own style. By +% default, FuncArgSty is the same as ArgSty. +% - Name of KwProg have now their own sty (they used ArgSty +% previously). By default, ProgSty is still ArgSty. +% As usual, \SetFuncArgSty{}, FuncArgSty{} and +% \SetProgSty{}, ProgSty{} are macros to set and use these +% typo styles. +% * ADD: Options to manage algorithm hangindent +% Until this revision, long statement acts as classical text and +% continue on next line starting from the same point. This makes +% difficult to notice that the new lines of text is not a new +% statement. Now, hangindent is managed and when a long +% statement continue on next lines, lines, except the first, +% are indented. +% Option: noalgohanging +% By default, long statement are indented on subsequent +% lines; with this option you get old behavior and lines are +% no more indented +% Option: hangingcomment +% Comment that are alone on a line (not side comment) are +% not driven by algo hanging: subsequent lines of long +% comments are indented according to width of start comment +% marker. With this option, comment are indented like normal +% statement. +% Option: hanginginout +% As for comment, by default, in/out keywords and input +% keywords (defined by \SetKwInOut or \SetKwInput) are not +% indented by algorithm hangindent. They are indented +% according to width of input keyword. If you want that these +% keywords acts like normal statement, use this option. +% \SetAlgoHangIndent{length} +% This macro allows you to set your own indent length. By +% default, \SetAlgoHangIndent{0.5em} +% * ADD: Group markers. +% This option is related to block markers of release 5.0. Some +% have ask to put also block markers for single line +% command. This new feature has been implemented to do this. +% So, you can now ask package to put begin and end keywords +% automatically at start and end of single line command (see +% example in documentation). +% These new group markers macros are: +% - \AlgoDisplayGroupMarkers and \AlgoDontDisplayGroupMarkers +% Note that a new option has also been added: displaygroupmarkers +% * ADD: \SetCustomAlgoRuledWidth{length} +% set a custom ruled width of ruled and algoruled options ; +% note that by the moment you use this macro, rules will have +% this fixed length: this can cause strange behavior in +% multicolumn mode or other layout that change the line +% width. +% * ADD: turkish language option +% * FIX: a spurious whitespace which results in a spurious indent in the +% user's text right after the end of the algorithm environment +% was introduced in release 5.0. This is fixed now thanks to +% Alexander Malkis. +% * FIX: there was a problem with margins in caption when option figure +% was use with caption package. This is fixed. +% * FIX: when changing font size in caption with, interline skip stayed +% unchanged and so with a small font was to large. This is fixed. +% * FIX: in contrary of that is written in the documentation, ':' what +% not in KwSty typo for KwIn and KwOut command. This is fixed. +% * FIX: strange behaviour with label and lines numbered: @currentlabel +% was updated according to algo line number not in all +% situation. For e.g, with hyperref package, always updated ; +% with \nlset also updated, but with \nl or linesnumbered +% option, not updated. This "feature" causes different output +% with \label command according to options used which is not +% that one want. This is solved now, and @currentlabel is +% always updated so \label command works always is the same way. +% * FIX: some czech keywords +% * FIX: some spanish keywords +% * FIX: some croatian keywords +% * FIX: krantz class changes definition of chapter and get one more +% option that classical classes as book.cls or report.cls and +% broke fix for hyperref on chapter definition. This is now +% fixed and algorithm detects use of krantz class and use then +% a definition of chapter working with krantz class. +% * FIX: an issue with internal macro which causes ([Q]) use as argument +% of some environment to be misprinted (thanks to Martin Schröder). +% * FIX: mispelled name of hyperrefcounter inside internal macro. +% % - 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 @@ -2124,12 +2443,12 @@ How they are obtained: % \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 +% * 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\;} +% \SetKwProg{Fn}{Function}{ is}{end} makes \Fn{afunc(i: int) : int}{return 0\;} % writes: % Function afunc(i: int) : int is % | return 0; @@ -2146,7 +2465,7 @@ How they are obtained: % | else: % | return 0 % with appropriate typo. -% * ADD: option croatian: croation keywords (thanks to Ivan Gavran) +% * ADD: option croatian: croatian 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) diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exAlgoDisjdecomp.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exAlgoDisjdecomp.tex index abb2cc3c5e4..d62fbb685aa 100644 --- a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exAlgoDisjdecomp.tex +++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exAlgoDisjdecomp.tex @@ -15,13 +15,13 @@ \Up$\leftarrow$ \FindCompress{$Im[i-1,]$}\; \This$\leftarrow$ \FindCompress{$Im[i,j]$}\; \If(\tcp*[h]{O(\Left,\This)==1}){\Left compatible with \This}{\label{lt} - \lIf{\Left $<$ \This}{\Union{\Left,\This}}\; - \lElse{\Union{\This,\Left}\;} + \lIf{\Left $<$ \This}{\Union{\Left,\This}} + \lElse{\Union{\This,\Left}} } \If(\tcp*[f]{O(\Up,\This)==1}){\Up compatible with \This}{\label{ut} - \lIf{\Up $<$ \This}{\Union{\Up,\This}}\; + \lIf{\Up $<$ \This}{\Union{\Up,\This}} \tcp{\This is put under \Up to keep tree as flat as possible}\label{cmt} - \lElse{\Union{\This,\Up}}\tcp*[r]{\This linked to \Up}\label{lelse} + \lElse{\Union{\This,\Up}}\tcp*[h]{\This linked to \Up}\label{lelse} } } \lForEach{element $e$ of the line $i$}{\FindCompress{p}} diff --git a/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric2.tex b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric2.tex new file mode 100644 index 00000000000..4b44545b4c1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/algorithm2e/algorithm2e_exgeneric2.tex @@ -0,0 +1,20 @@ +\Fn(\tcc*[h]{algorithm as a recursive function}){\FRecurs{some args}}{ + \KwData{Some input data} + \KwResult{Same for output data} + \If(\tcc*[h]{a simple if but with a comment on the same line}){this is true}{ + we do that, else nothing\; + \lIf{we agree that}{we do that} + \Else{ + \lIf{this first condition is true}{we do that} + \lElseIf(\tcc*[h]{else if}){this other condition is true}{this is done} + \lElse(\tcc*[h]{else}){in other case, we do this} + } + } + \lFor{\forcond}{a for loop} + \While{$i '^^J% % -% $Id: algorithm2e.sty,v 5.0 2013/01/06 14:40:35 cfiorio Exp $ +% $Id: algorithm2e.sty,v 5.1 2015/10/18 21:37:30 cfiorio Exp $ % % PACKAGES REQUIRED: % @@ -26,7 +33,7 @@ % - xspace (in packages/tools) % - relsize (in contrib/misc/relsize.sty) % -%%%%%%%%%%%%%%% Release 5.0 +%%%%%%%%%%%%%%% Release 5.1 % % Package options: % --------------- @@ -149,8 +156,127 @@ % % History: % +% - October 19 2015 - revision 5.1 +% * CHANGE/ADD: l commands (the ones as \lIf) can now be used with a +% star. If done, no end of line are done, so you can enclose +% l command into another one. For example, you can write: +% \lForEach{$i$}{\lIf*{foo}{bar}}. +% Note that when you use a star, side comments are not allowed. +% * CHANGE/ADD: Now you can have a side comment at end of macros which +% have a block. For example you can do : +% \Begin(\tcc*[h]{side comment for begin}{text}(\tcc*[h]{side comment after end}) +% Note: there are some side effects for some commands: +% \SetKwProg : macro defined thanks to \SetKwProg are allowed +% to have no end marker. In this case, +% beware to end side comment, this can +% do weird output (but no error) +% * CHANGE: \SetKwSwitch defines also an \uOther command which was not +% the case until this release. +% * CHANGE: \SetStartEndCondition{typo1}{typo2}{typo3} defined two end +% conditions (type2 and typo3) : typo3 is no more used for +% case condition as typo2 is used which is more consistent +% since there is a condition followed by a keyword as for +% if-then or other command that are defined using typo2. +% * CHANGE: keywords was not language dependant to allow to use multiple +% languages in the same document, but some keywords in +% different language were having the same keyword that lead +% last one declared to replace first one and so you could have some +% spanish keywords printed as you were in portuguese. So +% this behavior is changed from now: +% - localized keywords are defined if according language +% option is defined ; +% - if you want to keep old behaviour and use localized +% keywords without using language option (keep old +% behavior), you can use languagekw option +% (e.g. frenchkw, germankw, ...). Note that you can use +% multiple languagekw options at the same time, in +% contrary of language option. Note also that if you use +% multiple languagekw options, you can get back the same +% problem as previously when keywords was not language +% dependant. +% * ADD: new typo styles: +% - Arguments of functions have now their own style. By +% default, FuncArgSty is the same as ArgSty. +% - Name of KwProg have now their own sty (they used ArgSty +% previously). By default, ProgSty is still ArgSty. +% As usual, \SetFuncArgSty{}, FuncArgSty{} and +% \SetProgSty{}, ProgSty{} are macros to set and use these +% typo styles. +% * ADD: Options to manage algorithm hangindent +% Until this revision, long statement acts as classical text and +% continue on next line starting from the same point. This makes +% difficult to notice that the new lines of text is not a new +% statement. Now, hangindent is managed and when a long +% statement continue on next lines, lines, except the first, +% are indented. +% Option: noalgohanging +% By default, long statement are indented on subsequent +% lines; with this option you get old behavior and lines are +% no more indented +% Option: hangingcomment +% Comment that are alone on a line (not side comment) are +% not driven by algo hanging: subsequent lines of long +% comments are indented according to width of start comment +% marker. With this option, comment are indented like normal +% statement. +% Option: hanginginout +% As for comment, by default, in/out keywords and input +% keywords (defined by \SetKwInOut or \SetKwInput) are not +% indented by algorithm hangindent. They are indented +% according to width of input keyword. If you want that these +% keywords acts like normal statement, use this option. +% \SetAlgoHangIndent{length} +% This macro allows you to set your own indent length. By +% default, \SetAlgoHangIndent{0.5em} +% * ADD: Group markers. +% This option is related to block markers of release 5.0. Some +% have ask to put also block markers for single line +% command. This new feature has been implemented to do this. +% So, you can now ask package to put begin and end keywords +% automatically at start and end of single line command (see +% example in documentation). +% These new group markers macros are: +% - \AlgoDisplayGroupMarkers and \AlgoDontDisplayGroupMarkers +% Note that a new option has also been added: displaygroupmarkers +% * ADD: \SetCustomAlgoRuledWidth{length} +% set a custom ruled width of ruled and algoruled options ; +% note that by the moment you use this macro, rules will have +% this fixed length: this can cause strange behavior in +% multicolumn mode or other layout that change the line +% width. +% * ADD: turkish language option +% * FIX: a spurious whitespace which results in a spurious indent in the +% user's text right after the end of the algorithm environment +% was introduced in release 5.0. This is fixed now thanks to +% Alexander Malkis. +% * FIX: there was a problem with margins in caption when option figure +% was use with caption package. This is fixed. +% * FIX: when changing font size in caption with, interline skip stayed +% unchanged and so with a small font was to large. This is fixed. +% * FIX: in contrary of that is written in the documentation, ':' what +% not in KwSty typo for KwIn and KwOut command. This is fixed. +% * FIX: strange behaviour with label and lines numbered: @currentlabel +% was updated according to algo line number not in all +% situation. For e.g, with hyperref package, always updated ; +% with \nlset also updated, but with \nl or linesnumbered +% option, not updated. This "feature" causes different output +% with \label command according to options used which is not +% that one want. This is solved now, and @currentlabel is +% always updated so \label command works always is the same way. +% * FIX: some czech keywords +% * FIX: some spanish keywords +% * FIX: some croatian keywords +% * FIX: krantz class changes definition of chapter and get one more +% option that classical classes as book.cls or report.cls and +% broke fix for hyperref on chapter definition. This is now +% fixed and algorithm detects use of krantz class and use then +% a definition of chapter working with krantz class. +% * FIX: an issue with internal macro which causes ([Q]) use as argument +% of some environment to be misprinted (thanks to Martin Schröder). +% * FIX: mispelled name of hyperrefcounter inside internal macro. +% % - January 06 2013 - revision 5.0 -% * CHANGE: SetKwSwith takes now 9 args: 9th arg is the same as +% * CHANGE: SetKwSwitch 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 @@ -195,7 +321,7 @@ % 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\;} +% \SetKwProg{Fn}{Function}{ is}{end} makes \Fn{afunc(i: int) : int}{return 0\;} % writes: % Function afunc(i: int) : int is % | return 0; @@ -212,7 +338,7 @@ % | else: % | return 0 % with appropriate typo. -% * ADD: option croatian: croation keywords (thanks to Ivan Gavran) +% * ADD: option croatian: croatian 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) @@ -587,7 +713,7 @@ % note: this is just documentation of a macro which was already in the package. % - December 14 2003 - revision 2.52 - % * output message shorter -% * french keyword macro \PourTous was missing for longend option, it has been added. +% * French keyword macro \PourTous was missing for longend option, it has been added. % * TitleofAlgo prints Function or Procedure in corresponding environments. % % - October 27 2003 - revision 2.51 - Revision submitted to CTAN archive @@ -619,7 +745,7 @@ % predefined keywords % % - December 23 2002 - revision 2.40 -% * add some french keyword missing +% * add some French keyword missing % * add function* and procedure* environment like algorithme* environment: print in one column % even if twocolumn option is specified for the document. % * add a new macro \SetKwComment to define macro which writes comments in the text. First @@ -754,12 +880,23 @@ %%%%%%% Utilities: % \ifArgumentEmpty ; if c is empty, i.e. {}, then t, else e. % Function used internally, but may as well expose it to the user; it's useful -\long\def\ifArgumentEmpty#1{\bgroup - \catcode`\Q=3 - \catcode`\T=3 - \long\def\@tempa##1##2Q##3##4##5T{##4}% - \xdef\@tempa{\@tempa#1QQ{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}T}% -\egroup\@tempa} +\begingroup +\catcode`\Q=3 +\catcode`\T=3 +\long\gdef\ALGOCF@argemptyaux#1#2Q#3#4#5T{#4} +\long\gdef\ifArgumentEmpty#1{% + \begingroup\long\edef\@tempa{\endgroup + \ALGOCF@argemptyaux#1QQ{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}T% + }\@tempa +} +\endgroup +% \long\def\ifArgumentEmpty#1{\bgroup +% \catcode`\Q=3 +% \catcode`\T=3 +% \long\def\@tempa##1##2Q##3##4##5T{##4}% +% \xdef\@tempa{\@tempa#1QQ{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}T}% +% \egroup\@tempa} +%%%%%%%%%%% % % \algocf@longdef -> shorthand to reduce % \expandafter\long\expandafter\def @@ -798,6 +935,47 @@ \algocf@newcommand{algocf@#1main}[#2]{#3}% } % +% a serie of newcmdside macro for block that allows a comment after the end +% \()...()% +% +% 1. kind of begin-end : for command with only one block as begin-end +\algocf@longdef\algocf@newcmdside@kobe#1#2{% + % command starts by checking for side comment at beginning + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + % next we strip comment and include it in cmd that get body and check last side comment + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1)##2{\csname algocf@#1checkcomfol\endcsname{##1}{##2}}% + % now check for last side comment; args are : , + \expandafter\algocf@longdef\csname algocf@#1checkcomfol\endcsname##1##2{\@ifnextchar({\csname algocf@#1withendcom\endcsname{##1}{##2}}{\csname algocf@#1noendcom\endcsname{##1}{##2}}}% call macro that manages end of command, with or without last side comment + % finally manage end of macro... with end side comment... + \expandafter\algocf@longdef\csname algocf@#1withendcom\endcsname##1##2(##3){% + \csname algocf@#1main\endcsname{##1}{##2}{##3}}% + % ... or without end side comment + \expandafter\algocf@longdef\csname algocf@#1noendcom\endcsname##1##2{% + \csname algocf@#1main\endcsname{##1}{##2}{}}% + \algocf@newcommand{algocf@#1main}[3]{#2}% +}% +% +% 2. kind of if-else : for command with two blocks as if-then-else +\algocf@longdef\algocf@newcmdside@koif#1#2{% + % command starts by checking for side comment at beginning + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + % next we strip comment and include it in cmd that get body and check last side comment + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1)##2##3{\csname algocf@#1checkcomfol\endcsname{##1}{##2}{##3}}% + % now check for last side comment; args are : <1st side com>, <1st body of cmd>, <2nd body of cmd> + \expandafter\algocf@longdef\csname algocf@#1checkcomfol\endcsname##1##2##3{\@ifnextchar({\csname algocf@#1withendcom\endcsname{##1}{##2}{##3}}{\csname algocf@#1noendcom\endcsname{##1}{##2}{##3}}}% call macro that manages end of command, with or without last side comment + % finally manage end of macro... with end side comment... + \expandafter\algocf@longdef\csname algocf@#1withendcom\endcsname##1##2##3(##4){% + \csname algocf@#1main\endcsname{##1}{##2}{##3}{##4}}% + % ... or without end side comment + \expandafter\algocf@longdef\csname algocf@#1noendcom\endcsname##1##2##3{% + \csname algocf@#1main\endcsname{##1}{##2}{##3}{}}% + \algocf@newcommand{algocf@#1main}[4]{#2}% +}% +% % \algocf@newcmdsides % Like the command above, but with an optional side text at the end % of the command as well, i.e.: @@ -860,8 +1038,12 @@ \expandafter\ifx\csname @chapter\endcsname\relax\else % \let\algocf@original@chapter=\chapter% % \def\chapter{\addtocontents{loa}{\protect\addvspace{10\p@}}\algocf@original@chapter}% -\let\algocf@original@chapter=\@chapter% +\let\algocf@original@chapter=\@chapter% +\@ifclassloaded{krantz}{% +\def\@chapter[#1][#2]#3{\algocf@original@chapter[#1][#2]{#3}\addtocontents{loa}{\protect\addvspace{10\p@}}}% +}{% \def\@chapter[#1]#2{\algocf@original@chapter[#1]{#2}\addtocontents{loa}{\protect\addvspace{10\p@}}}% +}% \fi % %% if@restonecol is defined in article and book but some other classes don't define it and we need it, so we do @@ -876,6 +1058,10 @@ \DeclareOption{displayblockmarkers}{% \setboolean{algocf@displayblockmarkers}{true}% } +\newboolean{algocf@displaygroupmarkers}{\setboolean{algocf@displaygroupmarkers}{false} +\DeclareOption{displaygroupmarkers}{% + \setboolean{algocf@displaygroupmarkers}{true}% +} % \newboolean{algocf@nokwfunc}\setboolean{algocf@nokwfunc}{false}% \DeclareOption{nokwfunc}{% @@ -915,15 +1101,21 @@ \setboolean{algocf@slide}{true}% }% % +\newboolean{algocf@figurecaption}\setboolean{algocf@figurecaption}{false}% \DeclareOption{figure}{% \renewcommand{\algocf@list}{lof}% \renewcommand{\algocf@float}{figure}% +\AtBeginDocument{\@ifpackageloaded{caption}{\setboolean{algocf@figurecaption}{true}}{}}% }% % \newboolean{algocf@optonelanguage}\setboolean{algocf@optonelanguage}{false}% \DeclareOption{onelanguage}{\setboolean{algocf@optonelanguage}{true}}% % \newcommand{\algocf@languagechoosen}{english}% +\newboolean{algocf@localkw@english}\setboolean{algocf@localkw@english}{true}% +\DeclareOption{englishkw}{% +\setboolean{algocf@localkw@english}{true}% +}% % \DeclareOption{english}{% \renewcommand{\listalgorithmcfname}{List of Algorithms}% @@ -938,6 +1130,12 @@ \renewcommand{\algocf@languagechoosen}{english}% }% % +%---- +\newboolean{algocf@localkw@french}\setboolean{algocf@localkw@french}{false}% +\DeclareOption{frenchkw}{% +\setboolean{algocf@localkw@french}{true}% +}% +% \DeclareOption{french}{% \renewcommand{\listalgorithmcfname}{Liste des Algorithmes}% \renewcommand{\algorithmcfname}{Algorithme}% @@ -951,8 +1149,14 @@ \renewcommand{\algocf@languagechoosen}{french}% }% % +%---- +\newboolean{algocf@localkw@czech}\setboolean{algocf@localkw@czech}{false}% +\DeclareOption{czechkw}{% +\setboolean{algocf@localkw@czech}{true}% +}% +% \DeclareOption{czech}{% -\renewcommand{\listalgorithmcfname}{Seznam algoritm\v{u}}% +\renewcommand{\listalgorithmcfname}{Seznam algoritm\r{u}}% \renewcommand{\algorithmcfname}{Algoritmus}% \renewcommand{\algorithmautorefname}{\algorithmcfname}% \renewcommand{\algorithmcflinename}{Radek}% @@ -964,6 +1168,12 @@ \renewcommand{\algocf@languagechoosen}{czech}% }% % +%---- +\newboolean{algocf@localkw@german}\setboolean{algocf@localkw@german}{false}% +\DeclareOption{germankw}{% +\setboolean{algocf@localkw@german}{true}% +}% +% \DeclareOption{german}{% \renewcommand{\listalgorithmcfname}{Liste der Algorithmen}% \renewcommand{\algorithmcfname}{Algorithmus}% @@ -977,6 +1187,11 @@ \renewcommand{\algocf@languagechoosen}{german}% }% % +%---- +\DeclareOption{ngermankw}{% +\setboolean{algocf@localkw@german}{true}% +}% +% \DeclareOption{ngerman}{% \renewcommand{\listalgorithmcfname}{Liste der Algorithmen}% \renewcommand{\algorithmcfname}{Algorithmus}% @@ -990,6 +1205,12 @@ \renewcommand{\algocf@languagechoosen}{german}% }% % +%---- +\newboolean{algocf@localkw@portuguese}\setboolean{algocf@localkw@portuguese}{false}% +\DeclareOption{portuguesekw}{% +\setboolean{algocf@localkw@portuguese}{true}% +}% +% \DeclareOption{portuguese}{% \renewcommand{\listalgorithmcfname}{Lista de Algoritmos}% \renewcommand{\algorithmcfname}{Algoritmo}% @@ -1003,6 +1224,12 @@ \renewcommand{\algocf@languagechoosen}{portuguese}% }% % +%---- +\newboolean{algocf@localkw@italiano}\setboolean{algocf@localkw@italiano}{false}% +\DeclareOption{italianokw}{% +\setboolean{algocf@localkw@italiano}{true}% +}% +% \DeclareOption{italiano}{% \renewcommand{\listalgorithmcfname}{Elenco degli algoritmi}% \renewcommand{\algorithmcfname}{Algoritmo}% @@ -1015,6 +1242,12 @@ \renewcommand{\functionautorefname}{funzione}% \renewcommand{\algocf@languagechoosen}{italiano}% }% +%---- +\newboolean{algocf@localkw@spanish}\setboolean{algocf@localkw@spanish}{false}% +\DeclareOption{spanishkw}{% +\setboolean{algocf@localkw@spanish}{true}% +}% +% \DeclareOption{spanish}{% \renewcommand{\listalgorithmcfname}{\'Indice de algoritmos}% \renewcommand{\algorithmcfname}{Algoritmo}% @@ -1027,6 +1260,12 @@ \renewcommand{\functionautorefname}{funci\'on}% \renewcommand{\algocf@languagechoosen}{spanish}% }% +%---- +\newboolean{algocf@localkw@slovak}\setboolean{algocf@localkw@slovak}{false}% +\DeclareOption{slovakkw}{% +\setboolean{algocf@localkw@slovak}{true}% +}% +% \DeclareOption{slovak}{% \renewcommand{\listalgorithmcfname}{Zoznam algoritmov}% \renewcommand{\algorithmcfname}{Algoritmus}% @@ -1040,11 +1279,17 @@ \renewcommand{\algocf@languagechoosen}{slovak}% }% % +%---- +\newboolean{algocf@localkw@croatian}\setboolean{algocf@localkw@croatian}{false}% +\DeclareOption{croatiankw}{% +\setboolean{algocf@localkw@croatian}{true}% +}% +% \DeclareOption{croatian}{% \renewcommand{\listalgorithmcfname}{Popis algoritama}% \renewcommand{\algorithmcfname}{Algoritam}% \renewcommand{\algorithmautorefname}{\algorithmcfname}% -\renewcommand{\algorithmcflinename}{linija}% +\renewcommand{\algorithmcflinename}{redak}% \renewcommand{\algocf@typo}{}% \renewcommand{\@algocf@procname}{Procedura}% \renewcommand{\@algocf@funcname}{Funkcija}% @@ -1052,6 +1297,25 @@ \renewcommand{\functionautorefname}{\@algocf@funcname}% \renewcommand{\algocf@languagechoosen}{croatian}% }% +%%% adding 'turkish' option customization +% +%---- +\newboolean{algocf@localkw@turkish}\setboolean{algocf@localkw@turkish}{false}% +\DeclareOption{turkishkw}{% +\setboolean{algocf@localkw@turkish}{true}% +}% +\DeclareOption{turkish}{% +\renewcommand{\listalgorithmcfname}{Algoritma Listesi}% +\renewcommand{\algorithmcfname}{Algoritma}% +\renewcommand{\algorithmautorefname}{algoritma}% +\renewcommand{\algorithmcflinename}{çizgi}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Prosedür}% +\renewcommand{\@algocf@funcname}{Fonksiyon}% +\renewcommand{\procedureautorefname}{prosedür}% +\renewcommand{\functionautorefname}{fonksiyon}% +\renewcommand{\algocf@languagechoosen}{turkish}% +}% % % OPTIONs plain, boxed, ruled, algoruled & boxruled % @@ -1082,20 +1346,54 @@ \DeclareOption{resetcount}{\renewcommand{\@ResetCounterIfNeeded}{\setcounter{AlgoLine}{0}}}% \DeclareOption{noresetcount}{\renewcommand{\@ResetCounterIfNeeded}{}}% % +% OPTIONs algorithm hanging for long lines +% +\newlength{\algocf@hangindent}\setlength{\algocf@hangindent}{.5em} +\newcommand{\SetAlgoHangIndent}[1]{\setlength{\algocf@hangindent}{#1}} +% +\newboolean{algocf@hanging}\setboolean{algocf@hanging}{true}% hanging is handle by default +\newboolean{algocf@hanginginout}\setboolean{algocf@hanginginout}{false}% inout are managed as previously: hanging set by inout keywords +\newboolean{algocf@hangingcomment}\setboolean{algocf@hangingcomment}{false}% comment that are not side comment are indented accordingly to comment mark, not as normal text +\newcommand{\algocf@everyparnl}{\relax}% +\newcommand{\algocf@everyparhanging}{\hangafter=1\hangindent=\algocf@hangindent\relax}% +\newcommand{\algocf@everypar}{\algocf@everyparnl\algocf@everyparhanging}% +\newcommand{\algocf@seteverypar}{% + \ifthenelse{\boolean{algocf@hanging}}{\everypar{\algocf@everypar}}{\relax}% +}% +% +\newcommand{\algocf@seteveryparnl}[1]{\renewcommand{\algocf@everyparnl}{#1}\everypar{\algocf@everypar}}% +\newcommand{\algocf@seteveryparhanging}[1]{% +\let\algocf@oldeveryparhanging=\algocf@everyparhanging% +\renewcommand{\algocf@everyparhanging}{#1}\everypar{\algocf@everypar}% +}% +\newcommand{\algocf@reseteveryparhanging}{% +\let\algocf@everyparhanging=\algocf@oldeveryparhanging% +\everypar{\algocf@everypar}% +}% +\DeclareOption{hanginginout}{\setboolean{algocf@hanginginout}{true}}% +\DeclareOption{hangingcomment}{\setboolean{algocf@hangingcomment}{true}}% +\DeclareOption{noalgohanging}{% + \setboolean{algocf@hanginginout}{false}% + \setboolean{algocf@hangingcomment}{false}% + \setboolean{algocf@hanging}{false}% +}% +%\newcommand{ +% +% % OPTION linesnumbered % \newboolean{algocf@linesnumbered}\setboolean{algocf@linesnumbered}{false}% \newcommand{\algocf@linesnumbered}{\relax}% \DeclareOption{linesnumbered}{% \setboolean{algocf@linesnumbered}{true}% - \renewcommand{\algocf@linesnumbered}{\everypar={\nl}}% + \renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\nl}}% }% % % OPTION linesnumberedhidden % \DeclareOption{linesnumberedhidden}{% \setboolean{algocf@linesnumbered}{true}% - \renewcommand{\algocf@linesnumbered}{\everypar{\stepcounter{AlgoLine}}}% + \renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\stepcounter{AlgoLine}}}% }% % % OPTION commentsnumbered inoutnumbered @@ -1125,9 +1423,9 @@ % % OPTIONs lined, vlined & noline % -\DeclareOption{lined}{\AtBeginDocument{\SetAlgoLined}}% \SetAlgoLined +\DeclareOption{lined}{\AtBeginDocument{\SetAlgoLined}}% \SetAlgoLined (default) \DeclareOption{vlined}{\AtBeginDocument{\SetAlgoVlined}}% \SetAlgoVlined -\DeclareOption{noline}{\AtBeginDocument{\SetAlgoNoLine}}%\SetAlgoNoLine (default) +\DeclareOption{noline}{\AtBeginDocument{\SetAlgoNoLine}}%\SetAlgoNoLine % % OPTIONs longend, shotend & noend % @@ -1214,14 +1512,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Main Part %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \newcommand{\algocf@name}{algorithm2e}% -\newcommand{\algocf@date}{january 06 2013}% -\newcommand{\algocf@version}{Release 5.0}% +\newcommand{\algocf@date}{october 19 2015}% +\newcommand{\algocf@version}{Release 5.1}% \newcommand{\algocf@id}{\algocf@version\space -- \algocf@date\space --}% \typeout{********************************************************^^JPackage `\algocf@name'\space\algocf@id^^J% - algorithm2e-announce@lirmm.fr mailing list for announcement about releases^^J% - algorithm2e-discussion@lirmm.fr mailing list for discussion about package^^J% subscribe by emailing sympa@lirmm.fr with 'subscribe '^^J% - - Author: Christophe Fiorio (cfiorio@um2.fr)^^J********************************************************}% + - Author: Christophe Fiorio (christophe.fiorio@umontpellier.fr)^^J********************************************************}% %% %% %% @@ -1270,6 +1568,15 @@ \newcommand{\@algoinsideskip}{\relax}% \newcommand{\SetAlgoInsideSkip}[1]{\renewcommand{\@algoinsideskip}{\csname#1\endcsname}}% % +% ruledwidth +% +\newlength{\algocf@ruledwidth}\setlength{\algocf@ruledwidth}{\linewidth}% +\newboolean{algocf@customruledwidth}\setboolean{algocf@customruledwidth}{false}% +\newcommand{\SetCustomAlgoRuledWidth}[1]{% + \setboolean{algocf@customruledwidth}{true}% + \ifthenelse{\boolean{algocf@customruledwidth}}{\setlength{\algocf@ruledwidth}{#1}}{\relax}% +}% +% \newsavebox{\algocf@inoutbox}% \newsavebox{\algocf@inputbox}% %% @@ -1309,6 +1616,7 @@ \newcommand{\Indpp}{\advance\leftskip by 0.5em}% \newcommand{\Indm}{\algocf@adjustskipindent\advance\leftskip by -\algoskipindent} \newcommand{\Indmm}{\advance\leftskip by -0.5em}% +% %% %% %% Line Numbering @@ -1341,7 +1649,7 @@ }% \newcommand{\nl}{% \@ifundefined{hyper@refstepcounter}{% if not hyperref then do a simple refstepcounter - \refstepcounter{AlgoLine}% + \refstepcounter{AlgoLine}\gdef\@currentlabel{\theAlgoLine}% }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}% }% now we can do the line numbering @@ -1351,8 +1659,8 @@ \newcommand{\nllabel}[1]{\label{#1}}% % \newcommand{\enl}{% - \@ifundefined{hyper@refstepcounte}{% if not hyperref then do a simple refstepcounter - \refstepcounter{AlgoLine}% + \@ifundefined{hyper@refstepcounter}{% if not hyperref then do a simple refstepcounter + \refstepcounter{AlgoLine}\gdef\@currentlabel{\theAlgoLine}% }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}% }% now we can do the line numbering @@ -1384,14 +1692,14 @@ % % line numbering % -\newcommand{\LinesNumbered}{\setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\everypar={\nl}}}% +\newcommand{\LinesNumbered}{\setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\nl}}}% \newcommand{\LinesNotNumbered}{% \setboolean{algocf@linesnumbered}{false}% \renewcommand{\algocf@linesnumbered}{\relax}% }% % \newcommand{\LinesNumberedHidden}{% - \setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\everypar{\stepcounter{AlgoLine}}}}% + \setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\stepcounter{AlgoLine}}}}% \newcommand{\ShowLn}{\nlset{\theAlgoLine}\ignorespaces}% display the line number on this line (without labelling) \newcommand{\ShowLnLabel}[1]{\lnlset{#1}{\theAlgoLine}\ignorespaces}% display the line number and label this line % @@ -1437,8 +1745,12 @@ \newcommand{\SetKwSty}[1]{\renewcommand{\KwSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% \newcommand{\ArgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetArgSty{emph} \newcommand{\SetArgSty}[1]{\renewcommand{\ArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\FuncArgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetFuncArgSty{emph} +\newcommand{\SetFuncArgSty}[1]{\renewcommand{\FuncArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% \newcommand{\FuncSty}[1]{\textnormal{\texttt{#1}}\unskip}%\SetFuncSty{texttt} \newcommand{\SetFuncSty}[1]{\renewcommand{\FuncSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\ProgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetProgSty{emphg} +\newcommand{\SetProgSty}[1]{\renewcommand{\ArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% \newcommand{\DataSty}[1]{\textnormal{\textsf{#1}}\unskip}%%\SetDataSty{textsf} \newcommand{\SetDataSty}[1]{\renewcommand{\DataSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% \newcommand{\CommentSty}[1]{\textnormal{\texttt{#1}}\unskip}%%\SetDataSty{texttt} @@ -1469,12 +1781,20 @@ \newcommand{\algocf@eblock}{\BlockMarkersSty{end}}% \newcommand{\AlgoDisplayBlockMarkers}{\setboolean{algocf@displayblockmarkers}{true}}% \newcommand{\AlgoDontDisplayBlockMarkers}{\setboolean{algocf@displayblockmarkers}{false}}% +\newcommand{\AlgoDisplayGroupMarkers}{\setboolean{algocf@displaygroupmarkers}{true}}% +\newcommand{\AlgoDontDisplayGroupMarkers}{\setboolean{algocf@displaygroupmarkers}{false}}% \newcommand{\algocf@bblockcode}{% \ifthenelse{\boolean{algocf@displayblockmarkers}}{\algocf@bblock\par}{\relax}% }% \newcommand{\algocf@eblockcode}{% \ifthenelse{\boolean{algocf@displayblockmarkers}}{\algocf@eblock\par}{\relax}% }% +\newcommand{\algocf@bgroupcode}{% + \ifthenelse{\boolean{algocf@displaygroupmarkers}}{\algocf@bblock}{\relax}% +}% +\newcommand{\algocf@egroupcode}{% + \ifthenelse{\boolean{algocf@displaygroupmarkers}}{\algocf@eblock}{\relax}% +}% \newcommand{\SetAlgoBlockMarkers}[2]{% \ifArgumentEmpty{#1}{% \renewcommand{\algocf@bblock}{\relax}% @@ -1529,14 +1849,16 @@ %% default=NoLine % \newcommand{\algocf@group}[1]{\algocf@Noline{#1}}% group: set of instruction depending from another (ex: then part of the If) -\newcommand{\algocf@@@block}[2]{#1\ifArgumentEmpty{#2}{\relax}{\KwSty{\@algocf@endoption{#2}}\strut\par}}% block: group with a end keyword. -\newcommand{\algocf@@block}[2]{\algocf@@@block{#1}{#2}}% block: group with a end keyword. -\newcommand{\algocf@block}[2]{\algocf@@block{#1}{#2}}% command that will be used and redefined accordingly to noend option +\newcommand{\algocf@@@eblock}[2]{#1\ifArgumentEmpty{#2}{\relax}{\KwSty{\@algocf@endoption{#2}}\strut\par}}% block: group with a end keyword. +\newcommand{\algocf@@@block}[3]{#1\ifArgumentEmpty{#2}{\ifArgumentEmpty{#3}{\relax}{ #3\relax}}{\KwSty{\@algocf@endoption{#2}}\ifArgumentEmpty{#3}{\relax}{ #3}\strut\par}}% block: group with a end keyword. +\newcommand{\algocf@@block}[3]{\algocf@@@block{#1}{#2}{#3}}% block: group with a end keyword. +\newcommand{\algocf@block}[3]{\algocf@@block{#1}{#2}{#3}}% command that will be used and redefined accordingly to noend option +%\newcommand{\algocf@nblock}[3]{\algocf@@block{#1}{#2}{#3}}% command that will be used and redefined accordingly to noend option \newcommand{\algocf@setBlock}{% \ifthenelse{\boolean{algocf@optnoend}}{% if no end option - \renewcommand{\algocf@block}[2]{\algocf@group{##1}}% block will be a group + \renewcommand{\algocf@block}[3]{\algocf@group{##1}}% block will be a group }{% else - \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}% block stays a block + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% block stays a block }% }% % @@ -1595,27 +1917,29 @@ % \newcommand{\algocf@newinout}{\par\parindent=\inoutindent}% to put right indentation after a \\ in the KwInOut \newcommand{\SetKwInOut}[2]{% - \sbox\algocf@inoutbox{\KwSty{#2}\algocf@typo:}% + \sbox\algocf@inoutbox{\KwSty{#2\algocf@typo:}}% \expandafter\ifx\csname InOutSizeDefined\endcsname\relax% if first time used \newcommand\InOutSizeDefined{}\setlength{\inoutsize}{\wd\algocf@inoutbox}% - \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% + \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% \else% else keep the larger dimension \ifdim\wd\algocf@inoutbox>\inoutsize% \setlength{\inoutsize}{\wd\algocf@inoutbox}% - \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% + \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% \fi% \fi% the dimension of the box is now defined. \algocf@newcommand{#1}[1]{% - \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\everypar={\relax}}% + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% % {\let\\\algocf@newinout\hangindent=\wd\algocf@inoutbox\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~##1\par}% - {\let\\\algocf@newinout\hangindent=\inoutindent\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~##1\par}% + {\let\\\algocf@newinout\hangindent=\inoutindent\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~##1\par}% \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@reseteveryparhanging}% }}% % %% allow to ajust the skip size of InOut %% \newcommand{\ResetInOut}[1]{% - \sbox\algocf@inoutbox{\hbox{\KwSty{#1}\algocf@typo:\ }}% + \sbox\algocf@inoutbox{\hbox{\KwSty{#1\algocf@typo:}\ }}% \setlength{\inoutsize}{\wd\algocf@inoutbox}% }% % @@ -1626,10 +1950,12 @@ \newcommand{\algocf@newinput}{\par\parindent=\wd\algocf@inputbox}% to put right indentation after a \\ in the KwInput \newcommand{\SetKwInput}[2]{% \algocf@newcommand{#1}[1]{% - \sbox\algocf@inputbox{\hbox{\KwSty{#2}\algocf@typo: }}% - \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\everypar={\relax}}% + \sbox\algocf@inputbox{\hbox{\KwSty{#2\algocf@typo:} }}% + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% {\let\\\algocf@newinput\hangindent=\wd\algocf@inputbox\hangafter=1\unhbox\algocf@inputbox##1\par}% \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@reseteveryparhanging}% }}% \newcommand{\SetKwData}[2]{% \algocf@newcommand{@#1}[1]{\DataSty{#2(}\ArgSty{##1}\DataSty{)}}% @@ -1699,48 +2025,52 @@ \newcommand{\SetKwComment}[3]{% \algocf@newcommand{#1}{\@ifstar{\csname algocf@#1@star\endcsname}{\csname algocf@#1\endcsname}}% \algocf@newcommand{algocf@#1}[1]{% - \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% - \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\everypar={\relax}}% - {\renewcommand{\algocf@endmarkcomment}{#3}% - \let\\\algocf@endstartcomment% - \algocf@startcomment\CommentSty{% - \strut\ignorespaces##1\strut\algocf@fillcomment#3}\par}% - \algocf@linesnumbered% reset the numbering of the lines - }% + \ifthenelse{\boolean{algocf@hangingcomment}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% + \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% + {\renewcommand{\algocf@endmarkcomment}{#3}% + \let\\\algocf@endstartcomment% + \algocf@startcomment\CommentSty{% + \strut\ignorespaces##1\strut\algocf@fillcomment#3}\par}% + \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hangingcomment}}{\relax}{\algocf@reseteveryparhanging}% + }% %%% side comment definitions \algocf@newcommand{algocf@#1@star}[2][]{% - \ifArgumentEmpty{##1}\relax{% TODO: Is this even necessary, with all those \ifx's? - \ifthenelse{\boolean{algocf@scleft}}{\setboolean{algocf@sidecomment}{true}}{\setboolean{algocf@sidecomment}{false}}% - \ifx##1h\setboolean{algocf@altsidecomment}{true}\SetSideCommentLeft\fi% - \ifx##1f\setboolean{algocf@altsidecomment}{true}\SetSideCommentRight\fi% - \ifx##1l\setboolean{algocf@altsidecomment}{false}\SetSideCommentLeft\fi% - \ifx##1r\setboolean{algocf@altsidecomment}{false}\SetSideCommentRight\fi% - }% - \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% - \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\everypar={\relax}}% - {% - \renewcommand{\algocf@endmarkcomment}{#3}% - \let\\\algocf@endstartsidecomment% - % here is the comment - \ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\@endalgocfline\ }% - \algocf@scrfill\algocf@startsidecomment\CommentSty{% - \strut\ignorespaces##2\strut\algocf@sclfill#3}\algocf@scpar% - }% - \algocf@linesnumbered% reset the numbering of the lines - \ifArgumentEmpty{##1}\relax{% - \ifthenelse{\boolean{algocf@sidecomment}}{\setboolean{algocf@scleft}{true}}{\setboolean{algocf@scleft}{false}}% - \setboolean{algocf@altsidecomment}{false}% - }% + \ifArgumentEmpty{##1}\relax{% TODO: Is this even necessary, with all those \ifx's? + \ifthenelse{\boolean{algocf@scleft}}{\setboolean{algocf@sidecomment}{true}}{\setboolean{algocf@sidecomment}{false}}% + \ifx##1h\setboolean{algocf@altsidecomment}{true}\SetSideCommentLeft\fi% + \ifx##1f\setboolean{algocf@altsidecomment}{true}\SetSideCommentRight\fi% + \ifx##1l\setboolean{algocf@altsidecomment}{false}\SetSideCommentLeft\fi% + \ifx##1r\setboolean{algocf@altsidecomment}{false}\SetSideCommentRight\fi% + }% + \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% + \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% + {% + \renewcommand{\algocf@endmarkcomment}{#3}% + \let\\\algocf@endstartsidecomment% + % here is the comment + \ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\@endalgocfline\ }% + \algocf@scrfill\algocf@startsidecomment\CommentSty{% + \strut\ignorespaces##2\strut\algocf@sclfill#3}\algocf@scpar% + }% + \algocf@linesnumbered% reset the numbering of the lines + \ifArgumentEmpty{##1}\relax{% + \ifthenelse{\boolean{algocf@sidecomment}}{\setboolean{algocf@scleft}{true}}{\setboolean{algocf@scleft}{false}}% + \setboolean{algocf@altsidecomment}{false}% + }% }% -}% + }% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % KwProg % -\newcommand{\SetKwProg}[4]{% - \algocf@newcmdside{#1} 3{\KwSty{#2}\ifArgumentEmpty{#2}\relax{\ }\ArgSty{##2}\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}}% - \algocf@newcmdside{l#1}3{\KwSty{#2} \ArgSty{##2}\KwSty{#3} ##3\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par}% +\newcommand{\SetKwProg}[4]{%\SetKwProg{Env}{Title}{is}{end} + \algocf@newcmdside@koif{#1}{\KwSty{#2}\ifArgumentEmpty{#2}\relax{\ }\ProgSty{##2}\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}{##4}}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2} \ProgSty{##2}\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode\@endalgocfline\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2} \ProgSty{##2}\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode}% }% % % @@ -1760,7 +2090,7 @@ % \newcommand{\SetKwFunction}[2]{% %%% use of gdef since newcommand doesn't manage to define the macro when SetKwFunction is used in \algocf@caption@proc - \expandafter\gdef\csname @#1\endcsname##1{\FuncSty{#2(}\ArgSty{##1}\FuncSty{)}}% + \expandafter\gdef\csname @#1\endcsname##1{\FuncSty{#2(}\FuncArgSty{##1}\FuncSty{)}}% \expandafter\gdef\csname#1\endcsname{% \@ifnextchar\bgroup{\csname @#1\endcsname}{\FuncSty{#2}\xspace}}% }% @@ -1782,34 +2112,44 @@ % KwBlock % \newcommand{\SetKwBlock}[3]{% - \algocf@newcmdside{#1}{2} - {\KwSty{#2}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#3}\par} + \algocf@newcmdside@kobe{#1}% + {\KwSty{#2}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#3}{##3}\par}% }% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % condition typo % -\newcommand{\algocf@scond}{ } -\newcommand{\algocf@econd}{ } +\newcommand{\algocf@scond}{\ } +\newcommand{\algocf@econd}{\ } \newcommand{\algocf@ucond}{} \newcommand{\SetStartEndCondition}[3]{% - \renewcommand{\algocf@scond}{#1}\renewcommand{\algocf@econd}{#2}\renewcommand{\algocf@ucond}{#3}} + \renewcommand{\algocf@scond}{#1}\renewcommand{\algocf@econd}{#2}\renewcommand{\algocf@ucond}{#3}}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % For Switch % \newcommand{\SetKwSwitch}[9]{% #1=\Switch #2=\Case #3=\Other #4=switch #5=do #6=case #7=otherwise #8=endcase #9=endsw - \algocf@newcmdside{#1}{3} - {\KwSty{#4}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#9}} +% \algocf@newcmdside{#1}{3}% + \algocf@newcmdside@koif{#1}% + {\KwSty{#4}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#9} {##4\relax}}% %%%% Case - \algocf@newcmdside{#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@ucond\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#8}}% - \algocf@newcmdside{u#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@ucond\ifArgumentEmpty{##1}\relax{ ##1}\algocf@group{##3}}% - \algocf@newcmdside{l#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@ucond\ ##3\@endalgocfline\ifArgumentEmpty{##1}\relax{ ##1}\strut\par}% + \algocf@newcmdside@koif{#2}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#8}{##4\relax}}% + %uCase + \algocf@newcmdside{u#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@group{##3}}% + %lcase + \algocf@newcommand{l#2}{\@ifstar{\csname algocf@l#2star\endcsname}{\csname algocf@l#2\endcsname}}% + \algocf@newcmdside{algocf@l#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\ \relax{ ##1}\strut\par}% + \algocf@newcmdside{algocf@l#2star}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\algocf@bgroupcode\ ##3\algocf@egroupcode}% %%%% Other - \algocf@newcmdside{#3}{2}{\KwSty{#7}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#8}}% - \algocf@newcmdside{l#3}{2}{\KwSty{#7}\ ##2\@endalgocfline\ifArgumentEmpty{##1}\relax{ ##1}\strut\par}% + \algocf@newcmdside@kobe{#3}{\KwSty{#7} \KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#8}{##3\relax}}% + %lOther + \algocf@newcommand{l#3}{\@ifstar{\csname algocf@l#3star\endcsname}{\csname algocf@l#3\endcsname}}% + \algocf@newcmdside{algocf@l#3}{2}{\KwSty{#7} \KwSty{#5}\algocf@bgroupcode\ ##2\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#3star}{2}{\KwSty{#7} \KwSty{#5}\algocf@bgroupcode\ ##2\algocf@egroupcode}% + %uOther + \algocf@newcmdside{u#3}{3}{\KwSty{#7} \KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@group{##2}}% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -1819,33 +2159,43 @@ % % common text \algocf@newcommand{#1@ifthen}[1]{\KwSty{#4}\algocf@scond\ArgSty{##1}\algocf@econd\KwSty{#5}}% - \algocf@newcommand{#1@endif} [1]{\algocf@block{##1}{#8}}% + \algocf@newcommand{#1@endif} [2]{\algocf@block{##1}{#8}{##2}}% \algocf@newcommand{#1@noend} [1]{\algocf@group{##1}}% \algocf@newcommand{#1@else} [1]{\algocf@group{##1}\KwSty{#7}}% \algocf@newcommand{#2@elseif}[1]{\KwSty{#6}\algocf@scond\ArgSty{##1}\algocf@econd\KwSty{#5}}% \algocf@newcommand{#3@else} {\KwSty{#7}}% %%%% If then { } endif - \algocf@newcmdside{#1}3{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}}% + \algocf@newcmdside@koif{#1}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}{##4\relax}}% %%%% If then {} else {} endif % first command to handle optional side comment of else (so just after first braces) - \algocf@newcmdside{algocf@e#1thenelse}2{\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##2}} + \algocf@newcmdside@kobe{algocf@e#1thenelse}{\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##2}{##3}}% % the definition of if-then-else command using command above - \algocf@newcmdside{e#1}3{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@else\endcsname{##3}\csname algocf@e#1thenelse\endcsname}% + \algocf@newcmdside{e#1}{3}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@else\endcsname{##3}\csname algocf@e#1thenelse\endcsname}% %%% leif - \algocf@newcmdside{le#1}4{\csname #1@ifthen\endcsname{##2} ##3 \csname #3@else\endcsname\ ##4\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par} + \algocf@newcommand{le#1}{\@ifstar{\csname algocf@le#1star\endcsname}{\csname algocf@le#1\endcsname}}% + \algocf@newcmdside{algocf@le#1}{4}{\csname #1@ifthen\endcsname{##2} \algocf@bgroupcode##3 \csname #3@else\endcsname\ ##4\@endalgocfline\ \algocf@egroupcode\ifArgumentEmpty{##1}\relax{##1}\strut\par}% + \algocf@newcmdside{algocf@le#1star}{4}{\csname #1@ifthen\endcsname{##2} \algocf@bgroupcode##3 \csname #3@else\endcsname\ ##4\algocf@egroupcode}% %%%% If then - \algocf@newcmdside{l#1}3{\csname #1@ifthen\endcsname{##2} ##3\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par}% - \algocf@newcmdside{u#1}3{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@noend\endcsname{##3}}% + % \algocf@newcmdside{l#1}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ + % ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ ##3\algocf@egroupcode}% + \algocf@newcmdside{u#1}{3}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@noend\endcsname{##3}}% %%%% ElseIf {} endif - \algocf@newcmdside{#2} 3{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}}% + \algocf@newcmdside@koif{#2}{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}{##4\relax}}% %%%% ElseIf - \algocf@newcmdside{l#2}3{\csname #2@elseif\endcsname{##2} ##3\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par}% - \algocf@newcmdside{u#2}3{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@noend\endcsname{##3}}% + \algocf@newcommand{l#2}{\@ifstar{\csname algocf@l#2star\endcsname}{\csname algocf@l#2\endcsname}}% + \algocf@newcmdside{algocf@l#2}{3}{\csname #2@elseif\endcsname{##2}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#2star}{3}{\csname #2@elseif\endcsname{##2}\algocf@bgroupcode\ ##3\algocf@egroupcode}% + \algocf@newcmdside{u#2}{3}{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{##1}\csname #1@noend\endcsname{##3}}% %%%% Else {} endif - \algocf@newcmdside{#3} 2{\csname #3@else\endcsname\ifArgumentEmpty{##1}\relax\ ##1\csname #1@endif\endcsname{##2}}% + \algocf@newcmdside@kobe{#3}{\csname #3@else\endcsname\ifArgumentEmpty{##1}\relax\ ##1\csname #1@endif\endcsname{##2}{##3\relax}}% %%%% Else - \algocf@newcmdside{l#3}2{\csname #3@else\endcsname\ ##2\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par}% - \algocf@newcmdside{u#3}2{\csname #3@else\endcsname \ifArgumentEmpty{##1}\relax{\ ##1\relax}\csname #1@noend\endcsname{##2}}% + \algocf@newcommand{l#3}{\@ifstar{\csname algocf@l#3star\endcsname}{\csname algocf@l#3\endcsname}}% + \algocf@newcmdside{algocf@l#3}{2}{\csname #3@else\endcsname\algocf@bgroupcode\ ##2\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#3star}{2}{\csname #3@else\endcsname\algocf@bgroupcode\ ##2\algocf@egroupcode}% + \algocf@newcmdside{u#3}{2}{\csname #3@else\endcsname\ifArgumentEmpty{##1}\relax\ {##1\relax}\csname #1@noend\endcsname{##2}}% }% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1853,8 +2203,10 @@ % For macros % \newcommand{\SetKwFor}[4]{% - \algocf@newcmdside{#1} 3{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}}% - \algocf@newcmdside{l#1}3{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3} ##3\@endalgocfline\ifArgumentEmpty{##1}\relax{##1}\strut\par}% + \algocf@newcmdside@koif{#1}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}{##4\relax}}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode}% }% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1869,13 +2221,15 @@ \sbox\algocf@untilbox{\KwSty{#3}\algocf@scond}\algocf@skipuntil=\wd\algocf@untilbox% \KwSty{#2}\ifArgumentEmpty{##1}\relax{##1}\algocf@group{##3}% \KwSty{#3}\algocf@scond% until keyword and start condition typo - \advance\skiptotal by\algocf@skipuntil% + %\advance\skiptotal by\algocf@skipuntil% \ArgSty{##2}% - \advance\skiptotal by-\algocf@skipuntil% + %\advance\skiptotal by-\algocf@skipuntil% \algocf@ucond% \algocf@skipuntil=0pt% reset counter }{\@endalgocfline}{\strut\par}% - \algocf@newcmdside{l#1}3{\KwSty{#2} ##3 \KwSty{#3}\algocf@scond\ArgSty{##2}\algocf@ucond\@endalgocfline\ifArgumentEmpty{##1}\relax{ ##1}\strut\par}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2}\algocf@bgroupcode\ ##3\algocf@egroupcode\ \KwSty{#3}\algocf@scond\ArgSty{##2}\algocf@ucond\@endalgocfline\ifArgumentEmpty{##1}\relax{ ##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2}\algocf@bgroupcode\ ##3\algocf@egroupcode\ \KwSty{#3}\algocf@scond\ArgSty{##2}\algocf@ucond}% }% % % @@ -1899,7 +2253,7 @@ \newcommand{\SetAlgoCaptionSeparator}[1]{\renewcommand{\algocf@capseparator}{#1}}% \newcommand{\algocf@captiontext}[2]{% \algocf@captionlayout{\AlCapSty{\AlCapFnt #1\algocf@typo\algocf@capseparator}\nobreakspace% - \AlCapNameSty{\AlCapNameFnt{}#2}}}% text of caption + \AlCapNameSty{\AlCapNameFnt{}#2\endgraf}}}% text of caption % %%%%% default caption of algorithm: used if no specific style caption is defined \newcommand{\algocf@makecaption}[2]{% @@ -1940,7 +2294,8 @@ \newcommand{\algocf@caption@plain}{\vskip\AlCapSkip\box\algocf@capbox}% \newcommand{\algocf@caption@plainruled}{\algocf@caption@plain}% \newcommand{\algocf@caption@boxed}{\vskip\AlCapSkip\box\algocf@capbox}% -\newcommand{\algocf@caption@ruled}{\box\algocf@capbox\kern\interspacetitleruled\hrule height\algotitleheightrule depth0pt\kern\interspacealgoruled}% +\newcommand{\algocf@caption@ruled}{\box\algocf@capbox\kern\interspacetitleruled\hrule + width\algocf@ruledwidth height\algotitleheightrule depth0pt\kern\interspacealgoruled}% \newcommand{\algocf@caption@tworuled}{\box\algocf@capbox\hrule height0pt depth0pt\kern\interspacealgoruled}% \newcommand{\algocf@caption@algoruled}{\algocf@caption@ruled}% \newcommand{\algocf@caption@boxruled}{% @@ -2018,7 +2373,7 @@ \ifthenelse{\boolean{algocf@func}}{\def\@proc@func{algocffunc}}{\def\@proc@func{algocfproc}}% \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else... \ifthenelse{\boolean{algocf@procnumbered}}{% - \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%if procnumbered, take \thealgocf as ref + \expandafter\def\csname theH\@proc@func\endcsname{\thealgocf}%if procnumbered, take \thealgocf as ref }{% \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%else take procedure or function name }% @@ -2139,8 +2494,8 @@ \def\@algocf@pre@ruled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}% \def\@algocf@post@ruled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}% \def\@algocf@capt@ruled{top}% -\def\@algocf@pre@algoruled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}% -\def\@algocf@post@algoruled{\kern\interspacealgoruled\hrule height\algoheightrule \relax}% +\def\@algocf@pre@algoruled{\hrule width\algocf@ruledwidth height\algoheightrule depth0pt\kern\interspacetitleruled}% +\def\@algocf@post@algoruled{\kern\interspacealgoruled\hrule width\algocf@ruledwidth height\algoheightrule \relax}% \def\@algocf@capt@algoruled{top}% \def\@algocf@pre@tworuled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}% \def\@algocf@post@tworuled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}% @@ -2154,7 +2509,7 @@ % \newcommand{\noalgocaption}{\def\@algocf@capt@ruled{none}} % -%% before algocf or figure environment +%% before algocf environment (not figure environment) \newcommand{\@algocf@init@caption}{% \ifthenelse{\boolean{algocf@procenvironment}}{% if we are inside a procedure/function environment \@algocf@proctitleofalgo% set Titleofalgo to Procedure: or Function: @@ -2173,9 +2528,9 @@ \stepcounter{algocfproc}%to have a different counter for each environment and being abble to make the difference %between href of algoline in different algorithms. \ifthenelse{\boolean{algocf@optnoend}}{% - \renewcommand{\algocf@block}[2]{\algocf@group{##1}}% + \renewcommand{\algocf@block}[3]{\algocf@group{##1}}% }{% - \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}% + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% }% }% %% after the end of algocf or figure environment @@ -2186,7 +2541,7 @@ \newcommand{\@algocf@term}{% \setboolean{algocf@algoH}{false}% no H by default \ifthenelse{\boolean{algocf@optnoend}}{% - \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}% + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% }{% \renewcommand{\algocf@block}[2]{\algocf@group{##1}}% }% @@ -2277,24 +2632,42 @@ %%% real algorithm environment which manages H and * option % \let\algocf@originalfloatboxreset=\@floatboxreset% % \let\@floatboxreset=\@algofloatboxreset% -\newenvironment{algocf@algorithm}[1][htbp]{ +\newenvironment{algocf@algorithm}[1][htbp]{% + \ifthenelse{\equal{\algocf@float}{figure}}{% + \ifthenelse{\boolean{algocf@figurecaption}}{\captionsetup{margin={-\algomargin,\algomargin}}}{}% + }{}% \@algocf@init% \ifthenelse{\equal{\algocf@float}{figure}}{% if option figure set \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option \begin{figure*}[#1]% call figure* + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% }{% else algorithm environment with figure option \begin{figure}[#1]% call figure + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% }% }{% else normal algorithm environment \@algocf@init@caption% \ifthenelse{\equal{#1}{H}}{% if [H] algorithm \if@twocolumn\@latex@error{[H] in two columns mode is not allowed for algorithms}\fi% TODO: SCREAM if H in two colums! \setboolean{algocf@algoH}{true}\begin{algocf@Here}% call corresponding environment + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% }{% else floating algorithm environment \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* \begin{algocf*}[#1]% call algocf* + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% }{% else algorithm environment \begin{algocf}[#1]% call algcf + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% }% }% }% fin test option figure ou pas @@ -2305,18 +2678,23 @@ \@algocf@finish% \ifthenelse{\equal{\algocf@float}{figure}}{% \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option + \let\everypar=\algocf@oldeverypar% \end{figure*}% call figure* }{% else algorithm environment with figure option + \let\everypar=\algocf@oldeverypar% \end{figure}% call figure }% }{% \@algocf@term@caption% \ifthenelse{\boolean{algocf@algoH}}{% if [H] algorithm - \end{algocf@Here}\par% call corresponding environment + \let\everypar=\algocf@oldeverypar% + \end{algocf@Here}\par% call corresponding environment }{% else floating algorithm environment \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* + \let\everypar=\algocf@oldeverypar% \end{algocf*}% call algocf* }{% else algorithm environment + \let\everypar=\algocf@oldeverypar% \end{algocf}% call algocf }% }% @@ -2493,8 +2871,30 @@ %\newcommand{\algocf@defaults@common}{ % % -% french keywords +% english keywords (default) % +\SetKwHangingKw{KwHData}{Data$\rightarrow$} +\SetKwInput{KwIn}{Input}% +\SetKwInput{KwOut}{Output}% +\SetKwInput{KwData}{Data}% +\SetKwInput{KwResult}{Result}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% +% +% French keywords +% +\ifthenelse{\boolean{algocf@localkw@french}\OR\equal{\algocf@languagechoosen}{french}}{% %\SetKwInOut{AlgDonnees}{Donn\'ees}\SetKwInOut{AlgRes}{R\'esultat} \SetKwHangingKw{HDonnees}{Donnees$\rightarrow$} \SetKwInput{Donnees}{Donn\'ees}% @@ -2513,30 +2913,11 @@ \SetKwFor{PourCh}{pour chaque}{faire}{fin pour chaque}% \SetKwFor{PourTous}{pour tous les}{faire}{fin pour tous}% \SetKwFor{Tq}{tant que}{faire}{fin tq}% -% -% english keywords -% -\SetKwHangingKw{KwHData}{Data$\rightarrow$} -\SetKwInput{KwIn}{Input}% -\SetKwInput{KwOut}{Output}% -\SetKwInput{KwData}{Data}% -\SetKwInput{KwResult}{Result}% -\SetKw{KwTo}{to} -\SetKw{KwRet}{return}% -\SetKw{Return}{return}% -\SetKwBlock{Begin}{begin}{end}% -\SetKwRepeat{Repeat}{repeat}{until}% -% -\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% -\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}% -\SetKwFor{For}{for}{do}{end for}% -\SetKwFor{ForPar}{for}{do in parallel}{end forpar} -\SetKwFor{ForEach}{foreach}{do}{end foreach}% -\SetKwFor{ForAll}{forall the}{do}{end forall}% -\SetKwFor{While}{while}{do}{end while}% +}{}% % % --- German keywords % +\ifthenelse{\boolean{algocf@localkw@german}\OR\equal{\algocf@languagechoosen}{german}}{% \SetKwInput{Ein}{Eingabe}%KwIn \SetKwInput{Aus}{Ausgabe}%KwOut \SetKwInput{Daten}{Daten}%KwData @@ -2554,15 +2935,19 @@ \SetKwFor{FuerJedes}{f\"ur jedes}{tue}{Ende f\"ur}%ForEach \SetKwFor{FuerAlle}{f\"ur alle}{tue}{Ende f\"ur}%ForAll \SetKwFor{Solange}{solange}{tue}{Ende solange}%While +}{}% % % --- Czech keywords % +\ifthenelse{\boolean{algocf@localkw@czech}\OR\equal{\algocf@languagechoosen}{czech}}{% \SetKwInput{Vst}{Vstup}% \SetKwInput{Vyst}{V\'{y}stup}% \SetKwInput{Vysl}{V\'{y}sledek}% +}{}% % % --- Portuguese keywords % +\ifthenelse{\boolean{algocf@localkw@portuguese}\OR\equal{\algocf@languagechoosen}{portuguese}}{% \SetKwInput{Entrada}{Entrada}% \SetKwInput{Saida}{Sa\'{i}da}% \SetKwInput{Dados}{Dados}% @@ -2580,9 +2965,11 @@ \SetKwFor{ParaCada}{para cada}{fa\c{c}a}{fim para cada}% \SetKwFor{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}% \SetKwFor{Enqto}{enquanto}{fa\c{c}a}{fim enqto}% +}{}% % % --- Italian keywords % +\ifthenelse{\boolean{algocf@localkw@italiano}\OR\equal{\algocf@languagechoosen}{italiano}}{% \SetKwInput{KwIng}{Ingresso}% \SetKwInput{KwUsc}{Uscita}% \SetKwInput{KwDati}{Dati}% @@ -2600,9 +2987,11 @@ \SetKwFor{PerCiascun}{per ciascun}{fai}{fine per ciascun}% \SetKwFor{PerTutti}{per tutti i}{fai}{fine per tutti}% \SetKwFor{Finche}{finch\'e}{fai}{fine finch\'e}% +}{}% % % --- Spanish keywords % +\ifthenelse{\boolean{algocf@localkw@spanish}\OR\equal{\algocf@languagechoosen}{spanish}}{% \SetKwInput{Datos}{Datos} \SetKwInput{Resultado}{Resultado} \SetKwInput{Entrada}{Entrada} @@ -2620,9 +3009,11 @@ \SetKwFor{ParaCada}{para cada}{hacer}{fin para cada} \SetKwFor{ParaTodo}{para todo}{hacer}{fin para todo} \SetKwRepeat{Repetir}{repetir}{hasta que} +}{}% % % Croatian keywords % +\ifthenelse{\boolean{algocf@localkw@croatian}\OR\equal{\algocf@languagechoosen}{croatian}}{% \SetKwInput{KwUlaz}{Ulaz}%KwIn \SetKwInput{KwIzlaz}{Izlaz}%KwOut \SetKwInput{KwPodaci}{Podaci}%KwData @@ -2633,15 +3024,39 @@ \SetKwBlock{Pocetak}{po\v{c}etak}{kraj}%Begin \SetKwRepeat{Ponavljaj}{ponavljaj}{dok ne bude}%Repeat % -\SetKwIF{Ako}{InaceAko}{Inace}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj}%gIf -\SetKwSwitch{Granaj}{Slucaj}{Inace}{granaj}{\v{c}ini}{slu\v{c}aj}{ina\v{c}e}{kraj}{kraj}%Switch -\SetKwFor{Za}{za}{\v{c}ini}{kraj}%For -\SetKwFor{ZaPar}{za}{izvr\v{s}avaj paralelno}{kraj}%ForPar -\SetKwFor{ZaSvaki}{za svaki}{\v{c}ini}{kraj}%mForEach -\SetKwFor{ZaSvaku}{za svaku}{\v{c}ini}{kraj}%fForEach -\SetKwFor{ZaSvako}{za svako}{\v{c}ini}{kraj}%nForEach -\SetKwFor{ZaSve}{za sve}{\v{c}ini}{kraj}%ForAll -\SetKwFor{Dok}{dok}{\v{c}ini}{kraj}%While +\SetKwIF{Ako}{InaceAko}{Inace}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj ako}%gIf +\SetKwSwitch{Granaj}{Slucaj}{OstaliSlucajevi}{granaj}{\v{c}ini}{slu\v{c}aj}{ostali slu\v{c}ajevi}{kraj slu\v{c}aj}{kraj granaj}%Switch +\SetKwFor{Za}{za}{\v{c}ini}{kraj za}%For +\SetKwFor{ZaPar}{za}{\v{c}ini paralelno}{kraj za paralelno}%ForPar +\SetKwFor{ZaSvaki}{za svaki}{\v{c}ini}{kraj za svaki}%mForEach +\SetKwFor{ZaSvaku}{za svaku}{\v{c}ini}{kraj za svaku}%fForEach +\SetKwFor{ZaSvako}{za svako}{\v{c}ini}{kraj za svako}%nForEach +\SetKwFor{ZaSve}{za sve}{\v{c}ini}{kraj za sve}%ForAll +\SetKwFor{Dok}{dok}{\v{c}ini}{kraj dok}%While +}{}% + +% +% --- Turkish keywords +% +\ifthenelse{\boolean{algocf@localkw@turkish}\OR\equal{\algocf@languagechoosen}{turkish}}{% +\SetKwInput{KwIn}{Girdi}% +\SetKwInput{KwOut}{\c{C}{\i}kt{\i}}% +\SetKwInput{KwData}{Veri}% +\SetKwInput{KwResult}{Sonu\c{c}}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% % +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% +}{}% % % --- End %} @@ -2666,7 +3081,7 @@ \SetKwFor{For}{pour}{faire}{fin pour}% \SetKwFor{ForPar}{pour}{faire en parall\`ele}{fin pour}% \SetKwFor{ForEach}{pour chaque}{faire}{fin pour chaque}% -\SetKwFor{ForAll}{pour tous les}{faire}{fin pour tous}% +\SetKwFor{ForAll}{pour tous}{faire}{fin pour tous}% \SetKwFor{While}{tant que}{faire}{fin tq}% }{}% \ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{german}}{% @@ -2737,10 +3152,10 @@ \SetKwBlock{Begin}{inicio}{fin}% \SetKwRepeat{Repeat}{repetir}{hasta que}% % -\SetKwIF{If}{ElseIf}{Else}{si}{entonces}{sin\'o, si}{en otro caso}{fin si} -\SetKwSwitch{Switch}{Case}{Other}{seleccionar}{hacer}{caso}{sin\'o}{fin caso}{fin seleccionar} -\SetKwFor{For}{per}{fai}{fine per}% -\SetKwFor{ForPar}{par}{hacer in paralelo}{fin para}% +\SetKwIF{If}{ElseIf}{Else}{si}{entonces}{si no, si}{en otro caso}{fin si} +\SetKwSwitch{Switch}{Case}{Other}{seleccionar}{hacer}{caso}{si no}{fin caso}{fin seleccionar} +\SetKwFor{For}{para}{hacer}{fin para}% +\SetKwFor{ForPar}{para}{hacer in paralelo}{fin para}% \SetKwFor{ForEach}{para cada}{hacer}{fin para cada} \SetKwFor{ForAll}{para todo}{hacer}{fin para todo} \SetKwFor{While}{mientras}{hacer}{fin mientras} @@ -2757,15 +3172,37 @@ \SetKwBlock{Begin}{po\v{c}etak}{kraj}%Begin \SetKwRepeat{Repeat}{ponavljaj}{dok ne bude}%Repeat % -\SetKwIF{If}{ElseIf}{Else}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj}%gIf -\SetKwSwitch{Switch}{Case}{Other}{granaj}{\v{c}ini}{slu\v{c}aj}{ina\v{c}e}{kraj}{kraj}%Switch -\SetKwFor{For}{za}{\v{c}ini}{kraj}%For -\SetKwFor{ForPar}{za}{izvr\v{s}avaj paralelno}{kraj}%ForPar -\SetKwFor{ForEach}{za svaki}{\v{c}ini}{kraj}%ForEach -\SetKwFor{ForAll}{za sve}{\v{c}ini}{kraj}%ForAll -\SetKwFor{While}{dok}{\v{c}ini}{kraj}%While +\SetKwIF{If}{ElseIf}{Else}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj ako}%gIf +\SetKwSwitch{Switch}{Case}{Other}{granaj}{\v{c}ini}{slu\v{c}aj}{ostali slu\v{c}ajevi}{kraj slu\v{c}aj}{kraj granaj}%Switch +\SetKwFor{For}{za}{\v{c}ini}{kraj za}%For +\SetKwFor{ForPar}{za}{\v{c}ini paralelno}{kraj za paralelno}%ForPar +\SetKwFor{ForEach}{za svaki}{\v{c}ini}{kraj za svaki}%ForEach +\SetKwFor{ForAll}{za sve}{\v{c}ini}{kraj za sve}%ForAll +\SetKwFor{While}{dok}{\v{c}ini}{kraj dok}%While +}{}% +% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{turkish}}{% +% +\SetKwInput{KwIn}{Girdi}% +\SetKwInput{KwOut}{\c{C}{\i}kt{\i}}% +\SetKwInput{KwData}{Veri}% +\SetKwInput{KwResult}{Sonu\c{c}}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% }{}% % +% %%%% old commands compatibility % \ifthenelse{\boolean{algocf@oldcommands}}{% -- cgit v1.2.3