LaTeX pseudocode tricks

Using the “algorithm” package, add the following LaTeX code anywhere in your document before your algorithms:

  • Add for each
    \newcommand{\FOREACH}[1]{\FOR{\textbf{each} #1}}
  • Get rid of then and do
    \renewcommand{\algorithmicthen}{\textbf{}}
    \renewcommand{\algorithmicdo}{\textbf{}}