[Tex/LaTex] Problem installing subcaption package on texlive

installingsubcaptiontexliveUbuntu

I'm trying to install the subcaption package on TexLive installed on Ubuntu 11.10. When trying to build subcaption.sty, I found that I needed to first download or build several dependencies:

diagbox.sty
epic.sty
footmisc.sty
overpic.sty
pict2e.sty

After putting these files in the same directory as subcaption.dtx, I try to build subcaption.sty and here is the result:

$ latex subcaption.dtx 
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./subcaption.dtx
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/ltxdoc.cls
Document Class: ltxdoc 2007/11/11 v2.0u Standard LaTeX documentation class
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/base/doc.sty
(/usr/share/texmf-texlive/tex/latex/tools/multicol.sty)))
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty) (./footmisc.sty)
(/usr/share/texmf-texlive/tex/latex/tools/array.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
(/etc/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def))) (./overpic.sty
Package: overpic v0.53 <2010/09/13> (RN)
(./epic.sty
Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986
)
overpic: relative positioning in percent
) (./pict2e.sty (./p2e-dvips.def)) (./diagbox.sty
(/usr/share/texmf-texlive/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/share/texmf-texlive/tex/latex/fp/defpattern.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-basic.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-addons.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-snap.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-exp.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-trigo.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-pas.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-random.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-eqn.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-upn.sty)
(/usr/share/texmf-texlive/tex/latex/fp/fp-eval.sty)))
(/usr/share/texmf-texlive/tex/latex/oberdiek/hypdoc.sty
(/usr/share/texmf-texlive/tex/latex/hyperref/hyperref.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texmf-texlive/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texmf-texlive/tex/latex/oberdiek/hycolor.sty
(/usr/share/texmf-texlive/tex/latex/oberdiek/xcolor-patch.sty))
(/usr/share/texmf-texlive/tex/latex/hyperref/pd1enc.def)
(/usr/share/texmf-texlive/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/infwarerr.sty))
(/etc/texmf/tex/latex/config/hyperref.cfg)
(/usr/share/texmf-texlive/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/kvsetkeys.sty))
Implicit mode ON; LaTeX internals redefined
(/usr/share/texmf-texlive/tex/latex/ltxmisc/url.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/bitset.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/intcalc.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/bigintcalc.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texmf-texlive/tex/generic/oberdiek/atbegshi.sty))
*hyperref using default driver hdvips*
(/usr/share/texmf-texlive/tex/latex/hyperref/hdvips.def
(/usr/share/texmf-texlive/tex/latex/hyperref/pdfmark.def

Package hyperref Warning: You have enabled option `breaklinks'.
(hyperref)                But driver `hdvips.def' does not suppport this.
(hyperref)                Expect trouble with the link areas of broken links.

)) (/usr/share/texmf-texlive/tex/generic/thumbpdf/thumbpdf.sty

Package thumbpdf Warning: Missing driver name.

)) (/usr/share/texmf-texlive/tex/latex/caption/subcaption.sty

! Package subcaption Error: `caption' package not loaded
(subcaption)                (which is needed by this package)

See the subcaption package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.38   \endinput}{}

? 

What am I doing wrong? How can I fix this?

(I'm a novice… I don't know what dtx, ins, or sty files are. All I know is that I can usually run latex file.ins to produce file.sty and then put file.sty in an appropriate directory and use that package.)

[After installing the latest version of TexLive, I had problems… see link below]

Problems with TexLive 2012 on Ubuntu after network installation

Best Answer

latex subcaption.dtx will not build subcaption.sty but the documentation subcaption.dvi resp. subcaption.pdf instead. The subcaption package itself does not have dependencies to diagbox.sty, epic.sty, footmisc.sty, overpic.sty, or pict2e.sty, you only need them to build the documentation for yourself. (This step is not necessary since the documentation already comes pre-build as subcaption.pdf.)

You are getting the error message "caption package not loaded" when building the subcaption package documentation for yourself since building the documentation requires the actual version of the subcaption package installed. So you need to update the caption package bundle (which includes subcaption.sty) first.

latex caption.ins or tex caption.ins will build the required package files, i.e. caption.sty, ..., and subcaption.sty. But the easiest way to get a LaTeX package from CTAN is to look for a TDS structured archive first, they are located at

http://mirrors.ctan.org/install/macros/latex/contrib/

As you see there is a caption.tds.zip, so getting this file, unzipping it, and putting its contents to the right location is all you need to do to install/update the whole caption package bundle including sty files and docs.

Related Question