Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

subfig package

1,277 views
Skip to first unread message

HondaCB750K

unread,
Apr 27, 2006, 11:36:45 PM4/27/06
to
I wanted to use the subfig package but when I I put
\usepackage{subfig} in my preamble, it gives me this error:


! LaTeX Error: Command \captionfont already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.25 \newcommand*\captionfont{\captionsize}

?
?

I wanted to use the continuedfloat command to span a figure with
subfigures in 2 pages and I found this package can do it

I am really struggling with this and have no clue. Is it because subfig
is not installed? Can someone instruct me how to install? I downloaded
the folder subfig but dont know how to install it. I am using texshop
on mac os X tiger.

Thanks

Alpesh

pluton

unread,
Apr 28, 2006, 12:58:32 AM4/28/06
to
what about \usepackage{subfigure} ?

Pluton

HondaCB750K

unread,
Apr 28, 2006, 1:46:52 AM4/28/06
to
I am already using the subfigure package. I think subfig is a more
advanced package (by the same author, Steven Cochran) which also allows
to use subfloat etc for figures spanning over more than one page. Do
you know if I can do this by subfigure also?

Ulrike Fischer

unread,
Apr 28, 2006, 4:24:48 AM4/28/06
to
"HondaCB750K" <alpes...@gmail.com> schrieb:

> I wanted to use the subfig package but when I I put
> \usepackage{subfig} in my preamble, it gives me this error:
>
>
> ! LaTeX Error: Command \captionfont already defined.
> Or name \end... illegal, see p.192 of the manual.
>

> l.25 \newcommand*\captionfont{\captionsize}

> I am really struggling with this and have no clue. Is it because subfig
> is not installed?

No, if a package is not installed you get a message like

! LaTeX Error: File `trala.sty' not found.

Your error message says, that \captionfont is already defined. That
means that there is a name clash with another package. Make a complete
minimal example to identify this package. Post this example, then
someone can tell you what to do.


--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.

Axel Sommerfeldt

unread,
Apr 28, 2006, 6:06:06 AM4/28/06
to
"HondaCB750K" <alpes...@gmail.com> wrote:

> I wanted to use the subfig package but when I I put
> \usepackage{subfig} in my preamble, it gives me this error:
>
>
> ! LaTeX Error: Command \captionfont already defined.
> Or name \end... illegal, see p.192 of the manual.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.25 \newcommand*\captionfont{\captionsize}

What document class are you using? What versions of the subfig and the
caption package are you using?

(Please put a \listfiles command at the beginning of your LaTeX document
and tell us the output of it.)

Axel

Axel Sommerfeldt

unread,
Apr 28, 2006, 6:13:58 AM4/28/06
to
I just did a litte investigation...

> "HondaCB750K" <alpes...@gmail.com> wrote:
>> l.25 \newcommand*\captionfont{\captionsize}

The only package I know which has this code line is the caption2 package
v2.0(BETA), so the problem is obvious:

Please do not mix old and new caption+subfigure stuff. That means:

EITHER use caption2, subfigure and the captcont package

OR use caption (v3.0) and the subfig package

Please note that the actual subfig package needs version 3.0f (or newer) of
the caption package. (See subfig documentation for details.) So if you want
to use the subfig package, you need to update your caption package to a
more recent version.

HTH,
Axel

Brent Lievers

unread,
Apr 28, 2006, 9:55:47 AM4/28/06
to

Do you mean you are using subfigure.sty AND subfig.sty? Does the error
disappear if you comment out the older (ie. subfigure) package?

Brent

HondaCB750K

unread,
Apr 28, 2006, 3:36:04 PM4/28/06
to
Thanks everyone, but because of my ignorance, I am just getting more
confused. I am attaching my preamble at the end of this message, and
again I get th error when I put \include{subfig}

I have already done most of the dissertation using the subfigure
package, and if I use subfig and caption (v3) package, will I have to
make changes in all the subfigure codes?? I would not like to do that.

Also how do I know what versions of packages I am using. I tried
putting \listfiles in the beginnign of the preamble and typset it
(without puttign \include{subfig} and it just gave me the document
(pdf) like it normally gives

Thanks again everyone.

alpesh
Heres my preamble:

%ROOT FILE

\documentclass[chap]{thesis} % use draft in[ ] for fast compiling

% Use the first command below if you want captions over 1 line
indented. A side
% effect of this is to remove the use of bold for captions. To restore
bold,
% also include the second line below.

\newcommand\dec[1]{\ensuremath {{<}#1{>}}}

\usepackage{subfigure}
\usepackage{subfig}
\usepackage{lscape}
\usepackage{epsfig}
\usepackage[hang]{caption2} % to indent subsequent lines of
captions
\usepackage{graphicx}
\usepackage{float}
\usepackage[colorlinks=true,breaklinks]{hyperref} % for
hyperlinking...


\renewcommand{\captionfont}{\bfseries} % bold caption (needed with
caption
% package; otherwise bold is
default)
\newcommand{\sups}[1]{\raisebox{1ex}{\small #1}}
\newcommand{\subs}[1]{\raisebox{-1ex}{\small #1}}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{hypernat}
\usepackage{miller}
%\includeonly{2195weldTEM} % use \includeonly to process only
% the file(s) listed inside the braces
%\usepackage{gensymb}
\begin{document}

\include{rpititle-phd} % titlepage material for PhD thesis
%\include{rpiack}
%\include{rpiabs}
%%\include{hist_bm}
%\include{introhist.tex}
%\include{Objectives}
%\include{basemetalchr}
%\include{Experimental Procedures}
%\include{Mechanical_Properties}
%\include{2024weldTEM}
\include{2195weldTEM}
%\include{rpiapp}
\newpage
\bibliographystyle{Myunsrtnat}% Change this one to format bibliography
differently
\bibliography{bibliography}
%\include{rpibib}

\end{document}
\input{../../../../../../Volumes/BibDesk/BibDesk.app}

HondaCB750K

unread,
Apr 28, 2006, 4:07:17 PM4/28/06
to
I tried somethign based on your input:

When I use \usepackage[hang]{caption} (instead of caption2) PLUS
\usepackage{subfigure} I don't get any problems (but I still want to
use subfig} (BTW, what is hang here?)

When I use \usecaption[hang]{caption} PLUS \usepackage{subfig}, I get
this error:

option clash for package option
....


\usepackage{graphicx}

Alpesh

Axel Sommerfeldt

unread,
Apr 28, 2006, 4:27:02 PM4/28/06
to
"HondaCB750K" <alpes...@gmail.com> wrote:

> I have already done most of the dissertation using the subfigure
> package, and if I use subfig and caption (v3) package, will I have to
> make changes in all the subfigure codes?? I would not like to do that.

Replacing \subfigure or \subtable with \subfloat should be no problem
using a proper text editor.

If you want to keep subfigure anyway, you can't use subfig. It's like
using the same package twice, but with different version numbers.

And using the caption and caption2 package together is not possible for
the same reason, too, and the subfig package is using the caption package
(See subfig documentation). So at least you should replace your lines

> \usepackage[hang]{caption2}
> \renewcommand{\captionfont}{\bfseries}

with

\usepackage[format=hang,font=bf]{caption}

and put this line BEFORE \usepackage{subfig} (and update your caption
package to the actual version 3.0).

So here are the possible combinations:

caption(2) + subfigure + captcont

-or-

caption (v3.0) + subfig

BUT: If you want some features like continuation figures working together
with hyperref, you have to use the newer versions, that means caption
(v3.0) and subfig. The old stuff (caption2+subfigure+captcont) is not
able to handle that correctly since they are not prepared for using them
with the hyperref package.

> Also how do I know what versions of packages I am using. I tried
> putting \listfiles in the beginnign of the preamble and typset it
> (without puttign \include{subfig} and it just gave me the document
> (pdf) like it normally gives

You will find the output of \listfiles at the end of your log file, here
comes an example so you see how it will look like:

*File List*
article.cls 2004/02/16 v1.4f Standard LaTeX document class
size10.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2004/02/22 v1.99f Standard LaTeX file
inputenc.sty 2004/02/05 v1.0d Input encoding file
latin1.def 2004/02/05 v1.0d Input encoding file
booktabs.sty 2005/04/14 v1.61803 publication quality tables
array.sty 2003/12/17 v2.4a Tabular extension package (FMi)
caption.sty 2006/02/23 v3.0j Customising captions (AR)
caption3.sty 2006/02/23 v3.0j caption3 kernel (AR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
float.sty 2001/11/08 v1.3d Float enhancements (AL)
longtable.sty 2004/02/01 v4.11 Multi-page Table package (DPC)
subfig.sty 2005/06/28 ver: 1.3 subfig package
algorithm2e.sty 2005/10/04 v3.9 algorithms environments
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
xspace.sty 1997/10/13 v1.06 Space after command names (DPC)
ragged2e.sty 2003/03/25 v2.04 ragged2e Package (MS)
everysel.sty 1999/06/08 v1.03 EverySelectfont Package (MS)
t1cmtt.fd 1999/05/25 v2.5h Standard LaTeX font definitions
t1cmss.fd 1999/05/25 v2.5h Standard LaTeX font definitions
***********

HTH,
Axel

Axel Sommerfeldt

unread,
Apr 28, 2006, 4:32:54 PM4/28/06
to
"HondaCB750K" <alpes...@gmail.com> wrote:

> When I use \usecaption[hang]{caption} PLUS \usepackage{subfig}, I get
> this error:
>
> option clash for package option

You have to use \usepackage[...]{caption} BEFORE \usepackage{subfig}.

Please take a look at the caption and subfig documentation.

Axel

HondaCB750K

unread,
Apr 28, 2006, 5:22:37 PM4/28/06
to
Thanks Axel and all.

Things are becoming more clear to me now, but I still have the problem.
I did follow ur instructions and when I use caption (which is version
3, i checked using that log file) and subfig and include a chapter with
text only, no problems.

But when I include a chapter with subfigures, (and like i said earlier
i have use \subfigure in all the chapters) it gives an error
"undefined control sequence"" and stops wherever I have used
\subfigure.

So it seems that it doesnt like me using \subfigure everywhere. So
although it would be very time consuming and I would liek to avoid
this, will my problem be solved if I replace all the "subfigure" s with
"subfig" in all the chapters?

Or, is there a way (liek a command} which will consider all my
subfigure's as subfig's ?

I am using TexShop on Mac OS 10.4.6 (MacBook Pro)

Thanks!

alpesh

I am including the filelist (when I used subfig and used a chapter
without figures) below.
*File List*
thesis.cls 1996/04/11 Rensselaer Polytechnic Institute
report.cls 2004/02/16 v1.4f Standard LaTeX document class
size12.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
lscape.sty 2000/10/22 v3.01 Landscape Pages (DPC)
graphics.sty 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2005/02/03 v1.3 graphics configuration of teTeX/TeXLive
dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
epsfig.sty 1999/02/16 v1.7a (e)psfig emulation (SPQR)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)


keyval.sty 1999/03/16 v1.13 key=value parser (DPC)

caption.sty 2004/07/16 v3.0c Customising captions (AS)
subfig.sty 2004/01/28 ver: 1.2 subfig package


float.sty 2001/11/08 v1.3d Float enhancements (AL)

hyperref.sty 2003/11/30 v6.74m Hypertext links for LaTeX
pd1enc.def 2003/11/30 v6.74m Hyperref: PDFDocEncoding definition
(HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive and
teTeX
url.sty 2004/03/15 ver 3.1 Verb mode for urls, etc.
hdvips.def 2003/11/30 v6.74m Hyperref driver for dvips
pdfmark.def 2003/11/30 v6.74m Hyperref definitions for pdfmark
specials
natbib.sty 2003/06/06 7.1 (PWD)
hypernat.sty 2001/07/09 v1.0b hyperref and natbib compatibility (jb)
miller.sty 2004/09/20 v1.2 print miller indices


ragged2e.sty 2003/03/25 v2.04 ragged2e Package (MS)
everysel.sty 1999/06/08 v1.03 EverySelectfont Package (MS)

color.sty 1999/02/16 v1.0i Standard LaTeX Color (DPC)
color.cfg 2005/02/03 v1.3 color configuration of teTeX/TeXLive
dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
nameref.sty 2003/12/03 v2.21 Cross-referencing by name of section
rpithes.out
rpithes.out

HondaCB750K

unread,
Apr 28, 2006, 6:30:20 PM4/28/06
to
So I didn't read ur earlier message (about replacing subfigure with
subfloat) properly. SO it seems that if I want to take the advantage of
subfig package I will have to replace all subfigure with subfloat. That
will be a big job! Thanks but atleast now I have the solution

HondaCB750K

unread,
Apr 28, 2006, 6:30:24 PM4/28/06
to

Tom Micevski

unread,
Apr 28, 2006, 8:33:12 PM4/28/06
to
HondaCB750K wrote:
> I am including the filelist (when I used subfig and used a chapter
> without figures) below.
> *File List*
> thesis.cls 1996/04/11 Rensselaer Polytechnic Institute
> report.cls 2004/02/16 v1.4f Standard LaTeX document class
> size12.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
> lscape.sty 2000/10/22 v3.01 Landscape Pages (DPC)
> graphics.sty 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR)
> trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
> graphics.cfg 2005/02/03 v1.3 graphics configuration of teTeX/TeXLive
> dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
> epsfig.sty 1999/02/16 v1.7a (e)psfig emulation (SPQR)
> graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
> keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
> caption.sty 2004/07/16 v3.0c Customising captions (AS)
> subfig.sty 2004/01/28 ver: 1.2 subfig package

if you're using the caption and subfig packages, read axel's advice from
another post and update caption to version >= 3.0f:


>> OR use caption (v3.0) and the subfig package
>>
>> Please note that the actual subfig package needs version 3.0f (or newer) of
>> the caption package. (See subfig documentation for details.) So if you want

>> to use the subfig package, you need to update your caption package to a
>> more recent version.

Axel Sommerfeldt

unread,
Apr 29, 2006, 4:51:51 AM4/29/06
to
"HondaCB750K" <alpes...@gmail.com> wrote:

> So it seems that it doesnt like me using \subfigure everywhere. So
> although it would be very time consuming and I would liek to avoid
> this

So do a

\let\subfigure\subfloat
\let\subtable\subfloat

after \usepackage{subfig}. Maybe it would be a good thing if the subfig
package would do that for itself, since this would help migrating from
subfigure to subfig. I will send this suggestion to Steven (the author of
the subfigure+subfig package).

> caption.sty 2004/07/16 v3.0c Customising captions (AS)
> subfig.sty 2004/01/28 ver: 1.2 subfig package

Please note: If you want to use \ContinuedFloat together with `hyperref'
you need caption v3.0g (or newer) and subfig 1.3, otherwise you will get
warnings and wrong hyperlinks.

HTH,
Axel

HondaCB750K

unread,
Apr 30, 2006, 9:44:33 PM4/30/06
to
Can someone tell where to get the caption package v3.0g . When I go to
the CTAN site, it gives me version page (see link below)

http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=caption

THanks

Alpesh

Axel Sommerfeldt

unread,
May 1, 2006, 3:32:30 AM5/1/06
to
"HondaCB750K" <alpes...@gmail.com> wrote:

> Can someone tell where to get the caption package v3.0g .

You will find the actual version 3.0i on CTAN.

Axel

HondaCB750K

unread,
May 6, 2006, 6:08:46 PM5/6/06
to
I think I am having problem understanding this. I have installed (I
cant count how many times) both subfig and the caption (latest from
CTAN) package.

Everytime I typeset it still shows be subfigure and caption2 in the
file list. Am I doing something wrong? I think I am not able to
install properly. When I typeset the ins file it gives me this error:

Overall statistics:
Files processed: 2
Lines processed: 6150
Comments removed: 4850
Comments passed: 2
Codelines passed: 1265
) )
No pages of output.
Transcript written on caption.log.
### /usr/local/teTeX/bin/i386-apple-darwin-current/dvips -R -Poutline
-o /tmp/altpdflatex.1296-1146953140/caption.ps caption.dvi
This is dvips(k) 5.95b Copyright 2005 Radical Eye Software
(www.radicaleye.com)
/usr/local/teTeX/bin/i386-apple-darwin-current/dvips: ! DVI file can't
be opened.
### FAILED to generate /tmp/altpdflatex.1296-1146953140/caption.ps ()


Alpesh

Tom Micevski

unread,
May 6, 2006, 10:01:00 PM5/6/06
to
HondaCB750K wrote:
> I think I am having problem understanding this. I have installed (I
> cant count how many times) both subfig and the caption (latest from
> CTAN) package.
>
> Everytime I typeset it still shows be subfigure and caption2 in the
> file list. Am I doing something wrong? I think I am not able to
> install properly. When I typeset the ins file it gives me this error:

use \listfiles and check the log file to be sure which packages/versions
are being used.

it seems that the easiest (but not very elegant) solution for you would
be to place the latest versions of subfig.sty and caption.sty in the
same directory as your tex file. it will use these versions before
using the ones in your local/texmf directories.

0 new messages