You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation.tex
+245Lines changed: 245 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -359,4 +359,249 @@ \subsubsection*{Example}
359
359
\end{algorithmic}
360
360
\end{minipage}
361
361
362
+
363
+
\section{Package Options}
364
+
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:
\algpx@startIndent% \EndIf ends another indent. Start fake one here to handle that.
384
+
}
385
+
\makeatother
386
+
\If{$x > 0$}
387
+
\State$x \gets x - 1$
388
+
\EndIf
389
+
\end{algorithmic}
390
+
\end{minipage}
391
+
\hfill
392
+
\begin{minipage}[t]{0.45\textwidth}
393
+
\verb|noEnd=true|:
394
+
\begin{algorithmic}
395
+
\If{$x > 0$}
396
+
\State$x \gets x - 1$
397
+
\EndIf
398
+
\end{algorithmic}
399
+
\end{minipage}
400
+
401
+
402
+
\subsection{indLines}
403
+
\begin{description}
404
+
\item[possible values:] \verb|true|, \verb|false|
405
+
\item[default:] \verb|true|
406
+
\end{description}
407
+
If \verb|true|, indent guide lines are drawn.
408
+
409
+
\subsubsection*{Example}
410
+
\begin{minipage}[t]{0.45\textwidth}
411
+
\verb|indLines=false|:
412
+
\begin{algorithmic}
413
+
\makeatletter
414
+
\setbool{algpx@indLines}{false}%
415
+
\makeatother
416
+
\If{$x > 0$}
417
+
\State$x \gets x - 1$
418
+
\EndIf
419
+
\end{algorithmic}
420
+
\end{minipage}
421
+
\hfill
422
+
\begin{minipage}[t]{0.45\textwidth}
423
+
\verb|indLines=true|:
424
+
\begin{algorithmic}
425
+
\If{$x > 0$}
426
+
\State$x \gets x - 1$
427
+
\EndIf
428
+
\end{algorithmic}
429
+
\end{minipage}
430
+
431
+
432
+
\subsection{spaceRequire}
433
+
\begin{description}
434
+
\item[possible values:] \verb|true|, \verb|false|
435
+
\item[default:] \verb|true|
436
+
\end{description}
437
+
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.
438
+
439
+
\subsubsection*{Example}
440
+
\begin{minipage}[t]{0.45\textwidth}
441
+
\verb|spaceRequire=false|:
442
+
\begin{algorithmic}
443
+
\makeatletter
444
+
\setbool{algpx@spaceRequire}{false}%
445
+
\makeatother
446
+
\Require$x \in\{0,1\}$
447
+
\State\Return$x$
448
+
\Require$x \in\{1,2\}$
449
+
\State\Return$x-1$
450
+
\end{algorithmic}
451
+
\end{minipage}
452
+
\hfill
453
+
\begin{minipage}[t]{0.45\textwidth}
454
+
\verb|spaceRequire=true|:
455
+
\begin{algorithmic}
456
+
\Require$x \in\{0,1\}$
457
+
\State\Return$x$
458
+
\Require$x \in\{1,2\}$
459
+
\State\Return$x-1$
460
+
\end{algorithmic}
461
+
\end{minipage}
462
+
463
+
464
+
\subsection{italicComments}
465
+
\begin{description}
466
+
\item[possible values:] \verb|true|, \verb|false|
467
+
\item[default:] \verb|true|
468
+
\end{description}
469
+
If \verb|true|, all comments are typeset in italic font. If \verb|false|, comments are typeset in roman font.
470
+
471
+
\subsubsection*{Example}
472
+
\begin{minipage}[t]{0.45\textwidth}
473
+
\verb|italicComments=false|:
474
+
\begin{algorithmic}
475
+
\makeatletter
476
+
\setbool{algpx@italicComments}{false}%
477
+
\makeatother
478
+
\LComment{Long comment.}
479
+
\State$x \gets0$\Comment{Short comment.}
480
+
\end{algorithmic}
481
+
\end{minipage}
482
+
\hfill
483
+
\begin{minipage}[t]{0.45\textwidth}
484
+
\verb|italicComments=true|:
485
+
\begin{algorithmic}
486
+
\LComment{Long comment.}
487
+
\State$x \gets0$\Comment{Short comment.}
488
+
\end{algorithmic}
489
+
\end{minipage}
490
+
491
+
492
+
\subsection{rightComments}
493
+
\begin{description}
494
+
\item[possible values:] \verb|true|, \verb|false|
495
+
\item[default:] \verb|true|
496
+
\end{description}
497
+
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.
498
+
499
+
Does not affect long comments typeset with \verb|\LComment|.
500
+
501
+
\subsubsection*{Example}
502
+
\begin{minipage}[t]{0.45\textwidth}
503
+
\verb|rightComments=false|:
504
+
\begin{algorithmic}
505
+
\makeatletter
506
+
\setbool{algpx@rightComments}{false}%
507
+
\makeatother
508
+
\LComment{No effect on long comments.}
509
+
\State$x \gets0$\Comment{Short comment.}
510
+
\State$x \gets x^2$\Comment{Does not fit on the current line and is thus not justified.}
511
+
\end{algorithmic}
512
+
\end{minipage}
513
+
\hfill
514
+
\begin{minipage}[t]{0.45\textwidth}
515
+
\verb|rightComments=true|:
516
+
\begin{algorithmic}
517
+
\LComment{No effect on long comments.}
518
+
\State$x \gets0$\Comment{Short comment.}
519
+
\State$x \gets x^2$\Comment{Does not fit on the current line and is thus not justified.}
520
+
\end{algorithmic}
521
+
\end{minipage}
522
+
523
+
524
+
\subsection{commentColor}
525
+
\begin{description}
526
+
\item[possible values:] Any color that can be used in \verb|\textcolor|.
527
+
\item[default:] \verb|gray|
528
+
\end{description}
529
+
Defines the color in which comments are typeset.
530
+
531
+
\subsubsection*{Example}
532
+
\begin{minipage}[t]{0.45\textwidth}
533
+
\verb|commentColor=black|:
534
+
\begin{algorithmic}
535
+
\makeatletter
536
+
\renewcommand{\algpx@commentColor}{black}%
537
+
\makeatother
538
+
\LComment{Long comment.}
539
+
\State$x \gets0$\Comment{Short comment.}
540
+
\end{algorithmic}
541
+
\end{minipage}
542
+
\hfill
543
+
\begin{minipage}[t]{0.45\textwidth}
544
+
\verb|commentColor=blue|:
545
+
\begin{algorithmic}
546
+
\makeatletter
547
+
\renewcommand{\algpx@commentColor}{blue}%
548
+
\makeatother
549
+
\LComment{Long comment.}
550
+
\State$x \gets0$\Comment{Short comment.}
551
+
\end{algorithmic}
552
+
\end{minipage}
553
+
554
+
555
+
\subsection{beginComment and endComment}
556
+
\begin{description}
557
+
\item[possible values:] Any string that can be typeset in text mode.
558
+
\item[default:] \verb|$\triangleright$~| and (empty)
559
+
\end{description}
560
+
Used to indicate the beginning and end of comments typeset with \verb|\Comment|, respectively.
561
+
562
+
\subsubsection*{Example}
563
+
\begin{minipage}[t]{0.45\textwidth}
564
+
\verb|beginComment=//~|:
565
+
\begin{algorithmic}
566
+
\makeatletter
567
+
\renewcommand{\algpx@beginComment}{//~}%
568
+
\makeatother
569
+
\LComment{Long comment.}
570
+
\State$x \gets0$\Comment{Short comment.}
571
+
\end{algorithmic}
572
+
\end{minipage}
573
+
\hfill
574
+
\begin{minipage}[t]{0.45\textwidth}
575
+
\verb|beginComment=/*~|, \verb|endComment=~*/|:
576
+
\begin{algorithmic}
577
+
\makeatletter
578
+
\renewcommand{\algpx@beginComment}{/*~}%
579
+
\renewcommand{\algpx@endComment}{~*/}%
580
+
\makeatother
581
+
\LComment{Long comment.}
582
+
\State$x \gets0$\Comment{Short comment.}
583
+
\end{algorithmic}
584
+
\end{minipage}
585
+
586
+
\subsection{beginLComment and endLComment}
587
+
\begin{description}
588
+
\item[possible values:] Any string that can be typeset in text mode.
589
+
\item[default:] \verb|$\triangleright$~| and \verb|~$\triangleleft$|
590
+
\end{description}
591
+
Used to indicate the beginning and end of long comments typeset with \verb|\LComment|, respectively.
0 commit comments