Math & Sciencenumbering issues of using algorithms package

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
liangjian
Posts: 1
Joined: Tue Jul 27, 2010 1:31 am

numbering issues of using algorithms package

Post by liangjian »

I am using algorithms package to writing my thesis, and having a question on numbering issue.

The thesis is composed several chapters, and each chapter may include a set of algorithms, procedures and heuristics, and each of which is presented using algorithms package. After using \floatname to customize the captions, I now have
Algorithm 1.1, Algorithm 1.2, Procedure 1.3 Procedure 1.4, Algorithm 2.1, Algorithm 2.2, Procedure 2.3 Procedure 2.4

This is not the numbering scheme what I want, which should look like

Algorithm 1.1, Algorithm 1.2, Procedure 1.1 Procedure 1.2, Algorithm 2.1, Algorithm 2.2, Procedure 2.1 Procedure 2.2

Can you let me know any hint for doing this? Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

numbering issues of using algorithms package

Post by Juanjo »

It seems that you need two kinds of floats, algorithms and procedures, with independent numbering. The first ones are already provided by the algorithm package. Use the float package to get the second ones. So, add this to the preamble:

Code: Select all

\usepackage{float}
\newfloat{procedure}{tbp}{lop}[chapter]
\floatname{procedure}{Procedure}
Read the manual of float for details on syntax. Add this line where you want the list of procedures:

Code: Select all

\listof{procedure}{List of procedures}

Write procedures inside of a procedure environment instead of an algorithm environment. That's all.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Post Reply