Debian Codegraph @

texmf-dist/doc/latex/algpseudocodex/algpseudocodex.tex

raw
1 %% algpseudocodex.tex
2 %% Copyright 2020-2023, 2025 Christian Matt
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3c
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions of LaTeX
10 % version 2008-05-04 or later.
11 %
12 % This work has the LPPL maintenance status `maintained'.
13 %
14 % The Current Maintainer of this work is Christian Matt.
15 %
16 % This work consists of the files algpseudocodex.sty and algpseudocodex.tex.
17
18 \documentclass[11pt,a4paper,USenglish]{article}
19 \usepackage[T1]{fontenc}
20 \usepackage{babel}
21 \usepackage[utf8]{inputenc}
22 \usepackage[margin=1.0in]{geometry}
23 \usepackage{microtype}
24 \usepackage{xcolor}
25 \usepackage{algpseudocodex}
26
27 \usepackage[colorlinks,allcolors=blue!70!black]{hyperref}
28 \usepackage[capitalise,nameinlink,noabbrev,compress]{cleveref}
29
30 \title{\bf{Algpseudocodex Package Documentation}}
31 \author{Christian Matt \\ \url{https://github.com/chrmatt/algpseudocodex}}
32 \date{\today\\v1.2.0}
33
34 \begin{document}
35
36 \maketitle
37
38 \begin{abstract}
39 This package allows typesetting pseudocode in \LaTeX. It is based on \texttt{algpseudocode} from the \texttt{algorithmicx} package and uses the same syntax, but adds several new features and improvements. Notable features include customizable indent guide lines and the ability to draw boxes around parts of the code for highlighting differences. This package also has better support for long code lines spanning several lines and improved comments.
40 \end{abstract}
41
42 \newpage
43
44 \tableofcontents
45
46 \newpage
47
48 \section{Basic Usage}
49 To use the package, load it in your preamble:
50 \begin{verbatim}
51 \usepackage{algpseudocodex}
52 \end{verbatim}
53
54 Basic usage is identical to \texttt{algpseudocode} from the \texttt{algorithmicx} package. Pseudocode written for that package should also be compatible with \texttt{algpseudocodex}.
55
56 \subsection{Algorithmic Block}
57 Pseudocode can be typeset inside a algorithmic blocks:
58 \begin{verbatim}
59 \begin{algorithmic}[line numbering]
60 ...
61 \end{algorithmic}
62 \end{verbatim}
63 The optional argument specifies how lines are numbered. $0$ means no numbering, $n > 0$ means every $n$th line gets a number. The default is $0$, i.e., no line numbers will be typeset if no optional argument is provided.
64
65 \subsection{Simple Statements and Commands}
66 Statements start with \verb|\State|. The command \verb|\Statex| can be used to start a new line that does not get a new line number.
67
68 The commands \verb|\Return| and \verb|\Output| can be used for return values of functions and outputs. They do not start a new line on their own, so they need to be used together with \verb|\State|.
69
70 The \verb|\Call| command is used for procedure calls. It takes two arguments: The first one is the name of the procedure and the second one are the arguments.
71
72 \subsubsection*{Example}
73 \begin{minipage}[t]{0.45\textwidth}
74 \begin{verbatim}
75 \begin{algorithmic}[1]
76 \State first line
77 \Statex continuing first line
78 \State \Call{Proc}{a1, a2}
79 \State \Output Hello World!
80 \end{algorithmic}
81 \end{verbatim}
82 \end{minipage}
83 \hfill
84 \begin{minipage}[t]{0.45\textwidth}
85 \begin{algorithmic}[1]
86 \State first line
87 \Statex continuing first line
88 \State \Call{Proc}{a1, a2}
89 \State \Output Hello World!
90 \end{algorithmic}
91 \end{minipage}
92
93
94 \subsection{Blocks}
95 Blocks are used for loops, conditional statements, and functions. Blocks can also be nested within other blocks.
96
97 \subsubsection{While Loop}
98 \begin{minipage}[t]{0.45\textwidth}
99 \begin{verbatim}
100 \While{condition}
101 \State body
102 \EndWhile
103 \end{verbatim}
104 \end{minipage}
105 \hfill
106 \begin{minipage}[t]{0.45\textwidth}
107 \begin{algorithmic}
108 \While{condition}
109 \State body
110 \EndWhile
111 \end{algorithmic}
112 \end{minipage}
113
114
115 \subsubsection{For Loop}
116 \begin{minipage}[t]{0.45\textwidth}
117 \begin{verbatim}
118 \For{$n = 1, \dots, 10$}
119 \State body
120 \EndFor
121 \end{verbatim}
122 \end{minipage}
123 \hfill
124 \begin{minipage}[t]{0.45\textwidth}
125 \begin{algorithmic}
126 \For{$n = 1, \dots, 10$}
127 \State body
128 \EndFor
129 \end{algorithmic}
130 \end{minipage}
131
132 \subsubsection{For-All Loop}
133 \begin{minipage}[t]{0.45\textwidth}
134 \begin{verbatim}
135 \ForAll{$n \in \{1, \dots, 10\}$}
136 \State body
137 \EndFor
138 \end{verbatim}
139 \end{minipage}
140 \hfill
141 \begin{minipage}[t]{0.45\textwidth}
142 \begin{algorithmic}
143 \ForAll{$n \in \{1, \dots, 10\}$}
144 \State body
145 \EndFor
146 \end{algorithmic}
147 \end{minipage}
148
149 \subsubsection{Loop}
150 \begin{minipage}[t]{0.45\textwidth}
151 \begin{verbatim}
152 \Loop
153 \State body
154 \EndLoop
155 \end{verbatim}
156 \end{minipage}
157 \hfill
158 \begin{minipage}[t]{0.45\textwidth}
159 \begin{algorithmic}
160 \Loop
161 \State body
162 \EndLoop
163 \end{algorithmic}
164 \end{minipage}
165
166 \subsubsection{Repeat-Until Loop}
167 \begin{minipage}[t]{0.45\textwidth}
168 \begin{verbatim}
169 \Repeat
170 \State body
171 \Until{$n > 10$}
172 \end{verbatim}
173 \end{minipage}
174 \hfill
175 \begin{minipage}[t]{0.45\textwidth}
176 \begin{algorithmic}
177 \Repeat
178 \State body
179 \Until{$n > 10$}
180 \end{algorithmic}
181 \end{minipage}
182
183 \subsubsection{If Statement}
184 \begin{minipage}[t]{0.45\textwidth}
185 \begin{verbatim}
186 \If{condition}
187 \State body
188 \ElsIf{condition}
189 \State body
190 \Else
191 \State body
192 \EndIf
193 \end{verbatim}
194 \end{minipage}
195 \hfill
196 \begin{minipage}[t]{0.45\textwidth}
197 \begin{algorithmic}
198 \If{condition}
199 \State body
200 \ElsIf{condition}
201 \State body
202 \Else
203 \State body
204 \EndIf
205 \end{algorithmic}
206 \end{minipage}
207
208 \bigskip
209 The \verb|\ElsIf| and \verb|\Else| parts are optional.
210
211
212 \subsubsection{Procedure}
213 \begin{minipage}[t]{0.45\textwidth}
214 \begin{verbatim}
215 \Procedure{name}{parameters}
216 \State body
217 \EndProcedure
218 \end{verbatim}
219 \end{minipage}
220 \hfill
221 \begin{minipage}[t]{0.45\textwidth}
222 \begin{algorithmic}
223 \Procedure{name}{parameters}
224 \State body
225 \EndProcedure
226 \end{algorithmic}
227 \end{minipage}
228
229
230 \subsubsection{Function}
231 \begin{minipage}[t]{0.45\textwidth}
232 \begin{verbatim}
233 \Function{name}{parameters}
234 \State body
235 \EndFunction
236 \end{verbatim}
237 \end{minipage}
238 \hfill
239 \begin{minipage}[t]{0.45\textwidth}
240 \begin{algorithmic}
241 \Function{name}{parameters}
242 \State body
243 \EndFunction
244 \end{algorithmic}
245 \end{minipage}
246
247 \subsubsection{Structure}
248 \begin{minipage}[t]{0.45\textwidth}
249 \begin{verbatim}
250 \Structure{name}
251 \State body
252 \EndStructure
253 \end{verbatim}
254 \end{minipage}
255 \hfill
256 \begin{minipage}[t]{0.45\textwidth}
257 \begin{algorithmic}
258 \Structure{name}
259 \State body
260 \EndStructure
261 \end{algorithmic}
262 \end{minipage}
263
264 \subsubsection{Class}
265 \begin{minipage}[t]{0.45\textwidth}
266 \begin{verbatim}
267 \Class{name}
268 \State body
269 \EndClass
270 \end{verbatim}
271 \end{minipage}
272 \hfill
273 \begin{minipage}[t]{0.45\textwidth}
274 \begin{algorithmic}
275 \Class{name}
276 \State body
277 \EndClass
278 \end{algorithmic}
279 \end{minipage}
280
281 \subsubsection{Properties}
282 \begin{minipage}[t]{0.45\textwidth}
283 \begin{verbatim}
284 \Properties
285 \State body
286 \EndProperties
287 \end{verbatim}
288 \end{minipage}
289 \hfill
290 \begin{minipage}[t]{0.45\textwidth}
291 \begin{algorithmic}
292 \Properties
293 \State body
294 \EndProperties
295 \end{algorithmic}
296 \end{minipage}
297
298 \subsubsection{Methods}
299 \begin{minipage}[t]{0.45\textwidth}
300 \begin{verbatim}
301 \Methods
302 \State body
303 \EndMethods
304 \end{verbatim}
305 \end{minipage}
306 \hfill
307 \begin{minipage}[t]{0.45\textwidth}
308 \begin{algorithmic}
309 \Methods
310 \State body
311 \EndMethods
312 \end{algorithmic}
313 \end{minipage}
314
315 \subsection{Require and Ensure}
316 To specify conditions on the inputs and outputs of an algorithm, \verb|\Require| and \verb|\Ensure| can be used.
317
318 \subsubsection*{Example}
319 \begin{minipage}[t]{0.45\textwidth}
320 \begin{verbatim}
321 \begin{algorithmic}[1]
322 \Require $x \in \{0,1\}$
323 \Ensure $y \in \{1,2\}$
324 \State $y \gets x+1$
325 \State \Return $y$
326 \end{algorithmic}
327 \end{verbatim}
328 \end{minipage}
329 \hfill
330 \begin{minipage}[t]{0.45\textwidth}
331 \begin{algorithmic}[1]
332 \Require $x \in \{0,1\}$
333 \Ensure $y \in \{1,2\}$
334 \State $y \gets x+1$
335 \State \Return $y$
336 \end{algorithmic}
337 \end{minipage}
338
339
340 \subsection{Comments}
341 There are two ways to typeset code comments: The command \verb|\Comment| can be used to add shorts comments to the end of the current line. The command \verb|\LComment| can be used to typeset long comments that can span multiple lines. Comments with \verb|\LComment| start on a new line.
342
343 \subsubsection*{Example}
344 \begin{minipage}[t]{0.45\textwidth}
345 \begin{verbatim}
346 \begin{algorithmic}[1]
347 \State $x \gets y^2$
348 \LComment{The next two lines
349 increment both $x$ and $y$.}
350 \State $x \gets x + 1$
351 \Comment{Increment $x$.}
352 \State $y \gets y + 1$
353 \Comment{Increment $y$.}
354 \end{algorithmic}
355 \end{verbatim}
356 \end{minipage}
357 \hfill
358 \begin{minipage}[t]{0.45\textwidth}
359 \begin{algorithmic}[1]
360 \State $x \gets y^2$
361 \LComment{The next two lines
362 increment both $x$ and $y$.}
363 \State $x \gets x + 1$
364 \Comment{Increment $x$.}
365 \State $y \gets y + 1$
366 \Comment{Increment $y$.}
367 \end{algorithmic}
368 \end{minipage}
369
370
371 \section{Boxes}
372 A unique feature of the \texttt{algpseudocodex} package is the ability to draw boxes around pieces of code. There are two different methods to do so: One for drawing boxes around multiple lines of code, and another one for drawing a box around a string on a single line of code.
373
374 \subsection{Boxes Around Multiple Lines of Code}
375 The command \verb|\BeginBox[style]| is used to set the beginning of the box. The optional argument determines the style of the drawn box. The boxes are drawn using TikZ, so any TikZ style can be used. The default style can be changed as described in \cref{sec:defBoxStyle}.
376 The command \verb|\EndBox| is used to set the end of the last started box. Boxes can be nested arbitrarily, but every \verb|\BeginBox| needs a matching \verb|\EndBox|.
377
378 \subsubsection*{Example}
379 \begin{minipage}[t]{0.45\textwidth}
380 \begin{verbatim}
381 \begin{algorithmic}
382 \BeginBox
383 \State first line
384 \BeginBox[fill=yellow]
385 \State second line
386 \State another line
387 \EndBox
388 \EndBox
389 \BeginBox[draw=blue,dashed]
390 \State last line
391 \EndBox
392 \end{algorithmic}
393 \end{verbatim}
394 \end{minipage}
395 \hfill
396 \begin{minipage}[t]{0.45\textwidth}
397 \begin{algorithmic}
398 \BeginBox
399 \State first line
400 \BeginBox[fill=yellow]
401 \State second line
402 \State another line
403 \EndBox
404 \EndBox
405 \BeginBox[draw=blue,dashed]
406 \State last line
407 \EndBox
408 \end{algorithmic}
409 \end{minipage}
410
411
412 \subsection{Boxes Inside Single Line}
413 The command \verb|\BoxedString[style]{text}| is used to typeset text with a box around it. The optional argument determines the style of the box, as in \verb|\BeginBox|. The default style is the same as for \verb|\BeginBox|.
414
415 \subsubsection*{Example}
416 \begin{minipage}[t]{0.45\textwidth}
417 \begin{verbatim}
418 \begin{algorithmic}
419 \State first line
420 \State second line with
421 \BoxedString[fill=yellow]{box}
422 \State last line
423 \end{algorithmic}
424 \end{verbatim}
425 \end{minipage}
426 \hfill
427 \begin{minipage}[t]{0.45\textwidth}
428 \begin{algorithmic}
429 \State first line
430 \State second line with
431 \BoxedString[fill=yellow]{box}
432 \State last line
433 \end{algorithmic}
434 \end{minipage}
435
436
437 \section{Package Options}
438 When loading \texttt{algpseudocodex} the options describe in this section can be set. They syntax for setting \verb|option1| to \verb|value1| and \verb|option2| to \verb|value2| is:
439 \begin{verbatim}
440 \usepackage[option1=value1,option2=value2]{algpseudocodex}
441 \end{verbatim}
442
443 \subsection{noEnd}
444 \begin{description}
445 \item[possible values:] \verb|true|, \verb|false|
446 \item[default:] \verb|true|
447 \end{description}
448 If \verb|false|, the end of blocks are marked with the expression ``end'' followed by the name of the block.
449
450 \subsubsection*{Example}
451 \begin{minipage}[t]{0.45\textwidth}
452 \verb|noEnd=false|:
453 \begin{algorithmic}
454 % redefine if commands here to handle noEnd = false
455 \makeatletter
456 \setbool{algpx@noEnd}{false}%
457 \let\If\undefined%
458 \let\EndIf\undefined%
459 \algdef{SE}[IF]{If}{EndIf}[1]{%
460 \algpx@startCodeCommand\algpx@startIndent\algorithmicif\ #1\ \algorithmicthen%
461 }{%
462 \algpx@startEndBlockCommand\algpx@endIndent\algorithmicend\ \algorithmicif%
463 }
464 \pretocmd{\If}{\algpx@endCodeCommand}{}{}%
465 \pretocmd{\EndIf}{\algpx@endCodeCommand[0]}{}{}%
466 \makeatother
467 \If{$x > 0$}
468 \State $x \gets x - 1$
469 \EndIf
470 \end{algorithmic}
471 \end{minipage}
472 \hfill
473 \begin{minipage}[t]{0.45\textwidth}
474 \verb|noEnd=true|:
475 \begin{algorithmic}
476 \If{$x > 0$}
477 \State $x \gets x - 1$
478 \EndIf
479 \end{algorithmic}
480 \end{minipage}
481
482
483 \subsection{indLines}
484 \begin{description}
485 \item[possible values:] \verb|true|, \verb|false|
486 \item[default:] \verb|true|
487 \end{description}
488 If \verb|true|, indent guide lines are drawn. The style of the lines can be customized as described in \cref{sec:indStyle}.
489
490 \subsubsection*{Example}
491 \begin{minipage}[t]{0.45\textwidth}
492 \verb|indLines=false|:
493 \begin{algorithmic}
494 \makeatletter
495 \setbool{algpx@indLines}{false}%
496 \makeatother
497 \If{$x > 0$}
498 \State $x \gets x - 1$
499 \EndIf
500 \end{algorithmic}
501 \end{minipage}
502 \hfill
503 \begin{minipage}[t]{0.45\textwidth}
504 \verb|indLines=true|:
505 \begin{algorithmic}
506 \If{$x > 0$}
507 \State $x \gets x - 1$
508 \EndIf
509 \end{algorithmic}
510 \end{minipage}
511
512
513 \subsection{spaceRequire}
514 \begin{description}
515 \item[possible values:] \verb|true|, \verb|false|
516 \item[default:] \verb|true|
517 \end{description}
518 If \verb|true|, vertical space is added before every \verb|\Require| except the one on the first line. This is useful for specifying different behaviors depending on the provided input.
519
520 \subsubsection*{Example}
521 \begin{minipage}[t]{0.45\textwidth}
522 \verb|spaceRequire=false|:
523 \begin{algorithmic}
524 \makeatletter
525 \setbool{algpx@spaceRequire}{false}%
526 \makeatother
527 \Require $x \in \{0,1\}$
528 \State \Return $x$
529 \Require $x \in \{1,2\}$
530 \State \Return $x-1$
531 \end{algorithmic}
532 \end{minipage}
533 \hfill
534 \begin{minipage}[t]{0.45\textwidth}
535 \verb|spaceRequire=true|:
536 \begin{algorithmic}
537 \Require $x \in \{0,1\}$
538 \State \Return $x$
539 \Require $x \in \{1,2\}$
540 \State \Return $x-1$
541 \end{algorithmic}
542 \end{minipage}
543
544
545 \subsection{italicComments}
546 \begin{description}
547 \item[possible values:] \verb|true|, \verb|false|
548 \item[default:] \verb|true|
549 \end{description}
550 If \verb|true|, all comments are typeset in italic font. If \verb|false|, comments are typeset in roman font.
551
552 \subsubsection*{Example}
553 \begin{minipage}[t]{0.45\textwidth}
554 \verb|italicComments=false|:
555 \begin{algorithmic}
556 \makeatletter
557 \setbool{algpx@italicComments}{false}%
558 \makeatother
559 \LComment{Long comment.}
560 \State $x \gets 0$ \Comment{Short comment.}
561 \end{algorithmic}
562 \end{minipage}
563 \hfill
564 \begin{minipage}[t]{0.45\textwidth}
565 \verb|italicComments=true|:
566 \begin{algorithmic}
567 \LComment{Long comment.}
568 \State $x \gets 0$ \Comment{Short comment.}
569 \end{algorithmic}
570 \end{minipage}
571
572
573 \subsection{rightComments}
574 \begin{description}
575 \item[possible values:] \verb|true|, \verb|false|
576 \item[default:] \verb|true|
577 \end{description}
578 If \verb|true|, comments typeset with \verb|\Comment| are right justified on the current line. If a comment does not fit on the current line, no justification is applied. If \verb|false|, all comments are typeset right after the end of the current line.
579
580 Does not affect long comments typeset with \verb|\LComment|.
581
582 \subsubsection*{Example}
583 \begin{minipage}[t]{0.45\textwidth}
584 \verb|rightComments=false|:
585 \begin{algorithmic}
586 \makeatletter
587 \setbool{algpx@rightComments}{false}%
588 \makeatother
589 \LComment{No effect on long comments.}
590 \State $x \gets 0$ \Comment{Short comment.}
591 \State $x \gets x^2$ \Comment{Does not fit on the current line and is thus not justified.}
592 \end{algorithmic}
593 \end{minipage}
594 \hfill
595 \begin{minipage}[t]{0.45\textwidth}
596 \verb|rightComments=true|:
597 \begin{algorithmic}
598 \LComment{No effect on long comments.}
599 \State $x \gets 0$ \Comment{Short comment.}
600 \State $x \gets x^2$ \Comment{Does not fit on the current line and is thus not justified.}
601 \end{algorithmic}
602 \end{minipage}
603
604
605 \subsection{commentColor}
606 \begin{description}
607 \item[possible values:] Any color that can be used in \verb|\textcolor|.
608 \item[default:] \verb|gray|
609 \end{description}
610 Defines the color in which comments are typeset.
611
612 \subsubsection*{Example}
613 \begin{minipage}[t]{0.45\textwidth}
614 \verb|commentColor=black|:
615 \begin{algorithmic}
616 \makeatletter
617 \renewcommand{\algpx@commentColor}{black}%
618 \makeatother
619 \LComment{Long comment.}
620 \State $x \gets 0$ \Comment{Short comment.}
621 \end{algorithmic}
622 \end{minipage}
623 \hfill
624 \begin{minipage}[t]{0.45\textwidth}
625 \verb|commentColor=blue|:
626 \begin{algorithmic}
627 \makeatletter
628 \renewcommand{\algpx@commentColor}{blue}%
629 \makeatother
630 \LComment{Long comment.}
631 \State $x \gets 0$ \Comment{Short comment.}
632 \end{algorithmic}
633 \end{minipage}
634
635
636 \subsection{beginComment and endComment}
637 \begin{description}
638 \item[possible values:] Any string that can be typeset in text mode.
639 \item[default:] \verb|$\triangleright$~| and (empty)
640 \end{description}
641 Used to indicate the beginning and end of comments typeset with \verb|\Comment|, respectively.
642
643 \subsubsection*{Example}
644 \begin{minipage}[t]{0.45\textwidth}
645 \verb|beginComment=//~|:
646 \begin{algorithmic}
647 \makeatletter
648 \renewcommand{\algpx@beginComment}{//~}%
649 \makeatother
650 \LComment{Long comment.}
651 \State $x \gets 0$ \Comment{Short comment.}
652 \end{algorithmic}
653 \end{minipage}
654 \hfill
655 \begin{minipage}[t]{0.45\textwidth}
656 \verb|beginComment=/*~|, \verb|endComment=~*/|:
657 \begin{algorithmic}
658 \makeatletter
659 \renewcommand{\algpx@beginComment}{/*~}%
660 \renewcommand{\algpx@endComment}{~*/}%
661 \makeatother
662 \LComment{Long comment.}
663 \State $x \gets 0$ \Comment{Short comment.}
664 \end{algorithmic}
665 \end{minipage}
666
667 \subsection{beginLComment and endLComment}
668 \begin{description}
669 \item[possible values:] Any string that can be typeset in text mode.
670 \item[default:] \verb|$\triangleright$~| and \verb|~$\triangleleft$|
671 \end{description}
672 Used to indicate the beginning and end of long comments typeset with \verb|\LComment|, respectively.
673 \subsubsection*{Example}
674 \begin{minipage}[t]{0.45\textwidth}
675 \verb|beginLComment=/*~|, \verb|endLComment=~*/|:
676 \begin{algorithmic}
677 \makeatletter
678 \renewcommand{\algpx@beginLComment}{/*~}%
679 \renewcommand{\algpx@endLComment}{~*/}%
680 \makeatother
681 \LComment{Long comment.}
682 \State $x \gets 0$ \Comment{Short comment.}
683 \end{algorithmic}
684 \end{minipage}
685
686
687 \section{Customization}
688 \subsection{Style of Indent Guide Lines}\label{sec:indStyle}
689 Indent guide lines are drawn using TikZ and consequently any TikZ style can be used. To set the style, use:
690 \begin{verbatim}
691 \tikzset{algpxIndentLine/.style={style}}
692 \end{verbatim}
693 The default style is \verb|draw=gray,very thin|.
694
695 \subsubsection*{Example}
696 \verb|algpxIndentLine/.style={draw=blue,dashed}|:
697 \begin{algorithmic}
698 \tikzset{algpxIndentLine/.style={draw=blue,dashed}}
699 \If{$x > 0$}
700 \State $x \gets x - 1$
701 \EndIf
702 \end{algorithmic}
703
704
705 \subsection{Default Style of Boxes}\label{sec:defBoxStyle}
706 Boxes are drawn using TikZ and consequently any TikZ style can be used. To set the default style, use:
707 \begin{verbatim}
708 \tikzset{algpxDefaultBox/.style={style}}
709 \end{verbatim}
710 The default style is \verb|draw|.
711
712
713 \subsection{Changing Keywords}
714 As in the \texttt{algorithmicx} package, keywords can be renamed using the syntax:
715 \begin{verbatim}
716 \algrenewcommand\keyword{new name}
717 \end{verbatim}
718 The following keywords can be customized:
719 \begin{itemize}
720 \item \verb|\algorithmicend|
721 \hfill Default: \verb|\textbf{end}|
722 \item \verb|\algorithmicdo|
723 \hfill Default: \verb|\textbf{do}|
724 \item \verb|\algorithmicwhile|
725 \hfill Default: \verb|\textbf{while}|
726 \item \verb|\algorithmicfor|
727 \hfill Default: \verb|\textbf{for}|
728 \item \verb|\algorithmicforall|
729 \hfill Default: \verb|\textbf{for all}|
730 \item \verb|\algorithmicloop|
731 \hfill Default: \verb|\textbf{loop}|
732 \item \verb|\algorithmicrepeat|
733 \hfill Default: \verb|\textbf{repeat}|
734 \item \verb|\algorithmicuntil|
735 \hfill Default: \verb|\textbf{until}|
736 \item \verb|\algorithmicprocedure|
737 \hfill Default: \verb|\textbf{procedure}|
738 \item \verb|\algorithmicfunction|
739 \hfill Default: \verb|\textbf{function}|
740 \item \verb|\algorithmicif|
741 \hfill Default: \verb|\textbf{if}|
742 \item \verb|\algorithmicthen|
743 \hfill Default: \verb|\textbf{then}|
744 \item \verb|\algorithmicelse|
745 \hfill Default: \verb|\textbf{else}|
746 \item \verb|\algorithmicrequire|
747 \hfill Default: \verb|\textbf{Require:}|
748 \item \verb|\algorithmicensure|
749 \hfill Default: \verb|\textbf{Ensure:}|
750 \item \verb|\algorithmicreturn|
751 \hfill Default: \verb|\textbf{return}|
752 \item \verb|\algorithmicoutput|
753 \hfill Default: \verb|\textbf{output}|
754 \item \verb|\algorithmicstructure|
755 \hfill Default: \verb|\textbf{structure}|
756 \item \verb|\algorithmicclass|
757 \hfill Default: \verb|\textbf{class}|
758 \item \verb|\algorithmicproperties|
759 \hfill Default: \verb|\textbf{properties}|
760 \item \verb|\algorithmicmethods|
761 \hfill Default: \verb|\textbf{methods}|
762 \end{itemize}
763
764 \section{Revision History}
765
766 \subsection*{v1.2.0 (2025-04-16)}
767 \begin{itemize}
768 \item Added support for classes, structures, properties, and methods.
769 \end{itemize}
770
771 \subsection*{v1.1.2 (2023-04-17)}
772 \begin{itemize}
773 \item Fixed issue with resetting value of lineskiplimit.
774 \end{itemize}
775
776 \subsection*{v1.1.1 (2023-04-16)}
777 \begin{itemize}
778 \item Fixed issue with resetting value of lineskip.
779 \end{itemize}
780
781 \subsection*{v1.1.0 (2023-02-17)}
782 \begin{itemize}
783 \item Added support for indent guide lines spanning multiple pages.
784 \end{itemize}
785
786 \subsection*{v1.0.2 (2022-10-07)}
787 \begin{itemize}
788 \item Fixed bug with incorrectly ended indent block for nested statements.
789 \end{itemize}
790
791 \subsection*{v1.0.1 (2021-12-05)}
792 \begin{itemize}
793 \item Fixed bug regarding alignment of comments after end if, end for etc.
794 \end{itemize}
795
796 \subsection*{v1.0 (2020-08-16)}
797 \begin{itemize}
798 \item Initial release.
799 \end{itemize}
800
801 \end{document}