4

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.

1 Answer 1

5

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:

\documentclass{article}
\usepackage{algpseudocode}
\usepackage{tikz}
% https://tex.stackexchange.com/questions/7032/good-way-to-make-textcircled-numbers/7045#7045
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
\begin{document}

% https://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
  \Procedure{Euclid}{$a,b$}
  \State $r\gets a\bmod b$
  \While{$r\not=0$}
    \State $a\gets b$
    \State $b\gets r$
    \State $r\gets a\bmod b$
  \EndWhile\label{euclidendwhile}
  \State \textbf{return} $b$
  \EndProcedure
\end{algorithmic}

\end{document}

Euclid's algorithm

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.