GeneralInstalled but got an error using subcaption package

LaTeX specific issues not fitting into one of the other forums of this category.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Installed but got an error using subcaption package

Post by hzmonte »

I read that subfig is deprecated and one should use the subcaption package. I installed it and have the following files in my working directory:

Code: Select all

% ls *sty
bicaption.sty  caption2.sty  caption3.sty  caption.sty 
                                                            ltcaption.sty  newfloat.sty  subcaption.sty
I also have them in ~/texmf/tex
I also did a texhash
But when I ran latex, I got an error as follows.

Code: Select all

% make 
pdflatex modelpaper; bibtex modelpaper; pdflatex modelpaper; pdflatex modelpaper; \
        bibtex modelpaper; pdflatex modelpaper; dvips -Pwww -t letterSize modelpaper.dvi; rm core
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(./modelpaper.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, ...
(./IEEEtran.cls
Document Class: IEEEtran 2007/03/05 V1.7a by Michael Shell
-- See the "IEEEtran_HOWTO" manual for usage information.
-- http://www.michaelshell.org/tex/ieeetran/
(/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd)
-- Using 8.5in x 11in (letter) paper.
-- Using PDF output.
-- This is a 10 point document.
) (/usr/share/texmf/tex/latex/microtype/microtype.sty
...
(/usr/share/texmf/tex/latex/stmaryrd/stmaryrd.sty) (./caption.sty
(./caption3.sty
! Undefined control sequence.
l.752 \cs
         {DeclareCaptionDefaultJustification}}
? 
What's wrong?

Recommended reading 2024:

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

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

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

Installed but got an error using subcaption package

Post by sommerfee »

hzmonte wrote:I installed it
How exactly did you installed it?

Code: Select all

! Undefined control sequence.
l.752 \cs
         {DeclareCaptionDefaultJustification}}
? 
What's wrong?
There is only one occurrence of \cs{DeclareCaptionDefaultJustification}, in caption3.dtx:

Code: Select all

% \changes{v1.2a}{2008/01/31}{Renamed from \cs{DeclareDefaultCaptionJustification} to \cs{DeclareCaptionDefaultJustification}}
This is code intended for the changelog only and should not occur in one of the resulting *.sty files.

So your installation of the subcaption package is faulty.

I recommend removing the faulty files, going to http://mirrors.ctan.org/install/macros/latex/contrib/, getting caption.tds.zip, unzipping it, and putting its contents to ~/texmf/.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Installed but got an error using subcaption package

Post by hzmonte »

I installed the package by "latex caption.ins". And I reviewed the caption.log after installation and it does not indicate any error.
I am going to re-install it. Thanks.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Installed but got an error using subcaption package

Post by localghost »

Why don't you just install the package by the package manager of your TeX distribution?


Thorsten
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Installed but got an error using subcaption package

Post by hzmonte »

I re-installed it, using "latex caption.ins" and now there is no error. I don't know how to use "the package manager of [my] TeX distribution".
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Installed but got an error using subcaption package

Post by localghost »

hzmonte wrote:[…] I don't know how to use "the package manager of [my] TeX distribution".
Then you should take a look at its manual. Every common TeX distribution has a package manager which makes manual package installation superfluous. But if you don't tell us what distribution you have installed, you won't get specific help in this regard.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Installed but got an error using subcaption package

Post by sommerfee »

hzmonte wrote:I re-installed it, using "latex caption.ins" and now there is no error.
Anyway, it seems that your way of installing LaTeX packages is not very reliable. I suspect that you have saved the *.dtx files as text files (copy-paste?), and during this process an extra (unwanted) line break was inserted into caption3.dtx. (Since the unpacking process via *.ins file is quite dumb such problems will not be detected automatically.)

So better use zip files for download, this way you get sure that its contents will not get corrupt.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Installed but got an error using subcaption package

Post by hzmonte »

Yes, I did use copy-and-paste to save a couple dtx files!
Now that there is no error, I'd set aside the package manager issue.
Now I notice that the following message appears when I latex my .tex file:
"Package caption Warning: Unsupported document class (or package) detected,
(caption) usage of the caption package is not recommended.
See the caption package documentation for explanation."
Anyone knows the specific reason why "caption" is not recommended? Isn't it preferred over subfig.sty?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Installed but got an error using subcaption package

Post by localghost »

Why don't you just say which TeX distribution you have installed? With its package manager your problem could have been solved already well before. m(
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Installed but got an error using subcaption package

Post by hzmonte »

I do not know what TeX distribution the system administrator installed on my system. Is there a way to find out?
Is it related to the "caption" warning message?
Post Reply