Graphics, Figures & TablesTrouble with sub figures with a custom documentclass

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Trouble with sub figures with a custom documentclass

Post by daviddoria »

I just started using a big template for a paper. With this template ( rpi.edu/dept/arc/docs/latex-thesis/thesis.cls) and this minimal example, I get "undefined control sequence }".

Code: Select all

\documentclass[chap]{thesis}
    
    %\usepackage{subfig} % Error: Unsupported document class (or package) detected, (caption) usage of the caption package is not recommended. Fixed by caption=false below:
    \usepackage[caption=false]{subfig} % Error: Undefined control sequence }
    
    \begin{document}
     
    \begin{figure}[H]
    \centering
    \subfloat[Correct position]{
    \fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
    \label{fig:CatExperiments:Correct}
    }
    \caption{Cat sculpture in varying positions.}
    \label{fig:CatExperiments}
    \end{figure}
    
    \end{document}
In the full output the only thing more descriptive I see is "! Undefined control sequence.
\captionlabelfont@default ->\cph@font "

The above example works fine on my system if I change to \documentclass{article}.

Any suggestions of what I should do to fix this?

Thanks,

David

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Trouble with sub figures with a custom documentclass

Post by Stefan Kottwitz »

Hi David,

the example with \usepackage[caption=false]{subfig} works for me. Perhaps post your .log file here, as attachment to a post.

Stefan
LaTeX.org admin
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Re: Trouble with sub figures with a custom documentclass

Post by daviddoria »

Here is the log (attached).
Attachments
test_figure.log
(6.26 KiB) Downloaded 302 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Trouble with sub figures with a custom documentclass

Post by Stefan Kottwitz »

Your caption package is a bit old (2009 I can see in the .log file, I have one of 2010), I recommend to update it.

As I can see you still use TeX Live 2009, Debian packaged, it's perhaps not that simple. I would install TeX Live 2011 over the internet - I did it on Ubuntu.

Or download caption from CTAN and install it.

Stefan
LaTeX.org admin
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Re: Trouble with sub figures with a custom documentclass

Post by daviddoria »

I downloaded this file http://mirror.ctan.org/macros/latex/contrib/caption.zip, unzipped it to /usr/share/texmf/tex/latex/caption, then ran 'sudo texhash'. However, when I tried again and looked at the log, it still looks like it is using the 2009 version. That is the procedure I've used in the past to install new packages, but I've never updated one - is there a different procedure? I'm using Kile on Ubuntu 11.10 if that matters.

Thanks,

David
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Trouble with sub figures with a custom documentclass

Post by Stefan Kottwitz »

Go to /usr/share/texmf/tex/latex/caption/ and run

Code: Select all

latex caption.ins
at the command prompt. Or open this caption.ins there with your editor and compile with LaTeX. Then run sudo texhash again and test your document.

Stefan
LaTeX.org admin
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Re: Trouble with sub figures with a custom documentclass

Post by daviddoria »

Awesome! It worked, thank you very much.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Trouble with sub figures with a custom documentclass

Post by sommerfee »

In case anyone is interested in details:

The caption package is adapted to the thesis document class which can be found on CTAN: http://ctan.org/pkg/thesis

Unfortunately the method detecting this class was simply \@ifclassloaded{thesis} so this was doomed to fail with any other document class with the same name "thesis". This was fixed in version 3.1l (2010/01/09), so you need at least this version when using a "thesis" document class which is not the one which can be found on CTAN.
Post Reply