Document Classescaption errors

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
tbrauch
Posts: 2
Joined: Tue Jun 16, 2009 12:37 am

caption errors

Post by tbrauch »

I have a class file that is giving me problems. It was given to me by someone else.

The problem seems to be with the lines:

Code: Select all

\long\def\@caption#1[#2]#3{\par
  \addcontentsline{\csname ext@#1\endcsname}{#1}{%
    \protect\numberline{{\csname#1name\endcsname}\space
      \csname the#1\endcsname.}{\ignorespaces #2}}%
  \begingroup
  \@parboxrestore
  \normalsize
  \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup
}
When this is in the file I get a warning:
Package caption warning: \caption will not be redefined since it's already redefined by a document class or package which is unknown to the caption package.
The packages I'm using are:

Code: Select all

\RequirePackage{amssymb, amsthm, amsmath, latexsym}
\RequirePackage{graphicx, float, subfig}
\RequirePackage{makeidx, fancyhdr, multicol, algorithmic}
\RequirePackage[chapter,plain]{algorithm}
\RequirePackage[usenames]{color}
If I comment out those lines, it works without errors, except my List of Figures is in the wrong format. I need my List of Figures/Tables/Algorithms to appear as

Figure 1.1 A Figure!.......... 9
Figure 1.2 Another Figure!.... 10

etc.

Commenting out those lines and I get

1.1 A Figure!.......... 9
1.2 Another Figure!.... 10

I tried using the tocloft package, but that messes up the headings on my List of Figures page and doesn't do anything to the List of Algorithms page.

I'm really not sure what's going on in the class file. Any help?

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

sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption errors

Post by sommerfee »

Try loading the subfig package with option "caption=false", e.g.

Code: Select all

\usepackage[caption=false]{subfig}
or when appearing in a class or package file

Code: Select all

\RequirePackage[caption=false]{subfig}
(See subfig doc. for details)
HTH,
Axel
tbrauch
Posts: 2
Joined: Tue Jun 16, 2009 12:37 am

Re: caption errors

Post by tbrauch »

That sort of helped. I actually don't use the subfig package, so I removed that part.

The main problem is that for my dissertation if we have more than 4 algorithms, we have to include a list of algorithms in the appropriate format. Namely,

Algorithm 1.1: An algorithm......... 9
Algorithm 1.2: Another algorithm.... 9

etc.

The code I quoted first works to create the necessary formatting for my list of figures and list of tables, but it doesn't seem to be working for my list of algorithms. The person I got the file from didn't have more than 4 algorithms so he never had to deal with that.

I suppose I will need to use the tocloft package and fix my headings as well as use it to generate a list of algorithms in the appropriate format unless someone else has a quick suggestion.
Post Reply