TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an algorithm package that allows one to achieve the style of the algorithms in the book Combinatorial Optimization by Korte and Vygen? I am interested specifically in the numbering of the steps by encircled numbers.

share|improve this question
up vote 3 down vote accepted

This is view of the original algorithm:

Edmond's branching algorithm

Aside from duplicating the algorithm (with heading and content), since your were particularly interested in the numbering, the following does something similar using PGF/TikZ and algorithmicx. Moreover, I've used the following two answers to obtain the desired result:

% http://tex.stackexchange.com/questions/7032/good-way-to-make-textcircled-numbers/7045#7045
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}

% http://tex.stackexchange.com/questions/25019/how-to-place-a-program-and-a-text-side-by-side/25026#25026
\algrenewcommand{\alglinenumber}[1]{\scriptsize\circled{#1}}% circled line numbers
\begin{algorithmic}[1]% Taken from the algorithmicx package documentation
  \State $r\gets a\bmod b$
    \State $a\gets b$
    \State $b\gets r$
    \State $r\gets a\bmod b$
  \State \textbf{return} $b$


Euclid's algorithm

share|improve this answer
Thank you, that is what I was looking for. – hps Aug 7 '11 at 20:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.