Document ClassesAppendix error when algorithm2e is used

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
lukee
Posts: 3
Joined: Sun Jan 02, 2011 4:26 am

Appendix error when algorithm2e is used

Post by lukee »

Hello all,

I have problem to put appendix into my document.

This is the shortest code to reproduce error:

Code: Select all

\documentclass{article}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage[toc,page]{appendix}

\begin{document}

\begin{appendices}
\section{First Appendix}
\end{appendices}

\end{document}
And error is:

Code: Select all

! Missing number, treated as zero.
<to be read again> 
                   \c@chapter 
l.7 \begin{appendices}
When I remove algorithm2e, everything works. What I'm doing wrong?

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Appendix error when algorithm2e is used

Post by Stefan Kottwitz »

Hi lukee,

welcome to the board!

Your example works for me, without any error. I used algorithm2e.sty 2005/10/04 v3.9. Which version do you use? You could see it in the .log file if you add the command \listfiles to your preamble.
Perhaps update your version of algorithm2e if it's older.

Stefan
LaTeX.org admin
lukee
Posts: 3
Joined: Sun Jan 02, 2011 4:26 am

Re: Appendix error when algorithm2e is used

Post by lukee »

Hello Stefan,

Thanks for the answer. There is my file list:

*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
algorithm2e.sty 2008/00/00 v3.10 algorithms environments
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
xspace.sty 2006/05/08 v1.12 Space after command names (DPC,MH)
relsize.sty 2003/07/04 ver 3.1
appendix.sty 2009/09/02 v1.2b extra appendix facilities
***********

Why my algorithm2e is newer, but have lower build number? :O

MiKTeX is saying that there's no any package updates.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Appendix error when algorithm2e is used

Post by sommerfee »

lukee wrote:There is my file list:
Same here, and same error. But I can make the error go away by changing the order of package loading, i.e. this one compiles fine here:

Code: Select all

\listfiles
\documentclass{article}
\usepackage[toc,page]{appendix}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}

\begin{document}

\begin{appendices}
\section{First Appendix}
\end{appendices}

\end{document}
Why my algorithm2e is newer, but have lower build number? :O
10 is higher than 9 so why do you think the build number is lower?
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Appendix error when algorithm2e is used

Post by frabjous »

I can see why he's confused about the output of \listfiles.

It inserts this earlier into the .log:

Code: Select all

********************************************************
Package `algorithm2e' Release 4.01 -- december 14 2009 --
- algorithm2e-announce@lirmm.fr mailing list for announcement about releases
- algorithm2e-discussion@lirmm.fr mailing list for discussion about package
subscribe by emailing sympa@lirmm.fr with 'subscribe <list> <firstname name>'
- Author: Christophe Fiorio (fiorio@lirmm.fr)
********************************************************
But it still puts this for the output of \listfiles (notice the nonsense date of 2008/00/00!):

Code: Select all

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
algorithm2e.sty    2008/00/00 v3.10 algorithms environments
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
  xspace.sty    2006/05/08 v1.12 Space after command names (DPC,MH)
 relsize.sty    2003/07/04 ver 3.1
appendix.sty    2009/09/02 v1.2b extra appendix facilities
 ***********
However, FWIW, the problems look like they have more to do with issues with the appendix package; in any case, that's when they are triggered.

But I can confirm that for me, the problem seemed to disappear when I loaded things in the reverse order:

Code: Select all

\listfiles
\documentclass{article}
\usepackage[toc,page]{appendix}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}

\begin{document}
\begin{appendices}
\section{First Appendix}
\end{appendices}

\end{document}
Hopefully that won't cause other issues.
lukee
Posts: 3
Joined: Sun Jan 02, 2011 4:26 am

Re: Appendix error when algorithm2e is used

Post by lukee »

Hi,


Thanks for the solution. Reverse order works :)
I've never thought that this kind of change could help.
Post Reply