Useful Latex Packages

Reading time ~1 minute

1. Algorithms Packet

1.1. clrscode3e Package

clrscode3e package was developed and maintained by Professor Thomas H. Cormen. As indicated by the name of the package, it was designed to duplicate the pseudocode displaying style in the textbook, Introduction of Algorithms (Third edition), by Cormen, Leiserson, Rivest, and Stein (CLRS 3/e). More details about the package, you can refer to its documentation.

1.1.1. Setup

STEP 1: download the clrscode3e package.

STEP 2: In the header part of your TEX file, please include the following sentence.

\usepackage{clrscode3e}

STEP 3: Use the syntax of this package to type your pseudocode.

1.1.2. An Example

The following gives an example of how pseudocode generated by clrscode3e package looks like.

The source code is as follows (do not forget to including clrscode3e package in the header).

\begin{codebox}
\Procname{$\proc{Insertion-Sort}(A)$}
\li \For $j \gets 2$ \To $\attrib{A}{length}$
\li \Do
$\id{key} \gets A[j]$
\li \Comment Insert $A[j]$ into the sorted sequence
$A[1 \twodots j-1]$.
\li $i \gets j-1$
\li \While $i > 0$ and $A[i] > \id{key}$
\li \Do
$A[i+1] \gets A[i]$
\li $i \gets i-1$
\End
\li $A[i+1] \gets \id{key}$
\End
\end{codebox}

The generated pseudocode looks like.

Useful Linux Software

Ubuntu Software Installation Continue reading

Useful user-defined LaTeX commands

Published on November 27, 2016