LaTeX forum ⇒ Graphics, Figures & Tablessubfig package destroys figure captions

Information and discussion about graphics, figures & tables in LaTeX documents.
tofergregg
Posts: 3
Joined: Mon Jan 17, 2011 5:20 am

subfig package destroys figure captions

Postby tofergregg » Mon Jan 17, 2011 5:30 am

Hi there -- I am writing a paper using the acm_proc_article-sp.cls class file from the ACM. I'm also trying to use the subfig package as well. But, when I use the subfig package, my figure captions get screwed up. Instead of saying "Figure 1: This is my caption.", it says "1: This is my caption" without the bold and without "Figure".

The following is in acm_proc_article-sp.cls:
  1. \long\def\@makecaption#1#2{
  2. \vskip \baselineskip
  3. \setbox\@tempboxa\hbox{\textbf{#1: #2}}
  4. \ifdim \wd\@tempboxa >\hsize % IF longer than one line:
  5. \textbf{#1: #2}\par % THEN set as ordinary paragraph.
  6. \else % ELSE center.
  7. \hbox to\hsize{\hfil\box\@tempboxa\hfil}\par
  8. \fi}


How might I go about re-defining the caption to reflect the bolded "Figure"? Thanks!

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

Postby sommerfee » Mon Jan 17, 2011 9:38 am

To use the subfig package without the caption package (so especially \@makecaption will not be overwritten) use the argument "caption=false" when loading the subfig package, e.g.
  1. \usepackage[caption=false]{subfig}
See subfig package documentation for details.

tofergregg
Posts: 3
Joined: Mon Jan 17, 2011 5:20 am

Postby tofergregg » Mon Jan 17, 2011 2:38 pm

Thank you! I ended up having to do it this way, though, as simply using the one line command gave me an error ("Error: caption undefined").

  1. \usepackage[caption=false]{caption}
  2. \usepackage{subfig}

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

Postby sommerfee » Mon Jan 17, 2011 9:24 pm

tofergregg wrote:Thank you! I ended up having to do it this way, though, as simply using the one line command gave me an error ("Error: caption undefined").


Then you are using quite an old version of caption and subfig package. When Steven Cochran and I noticed that this feature would be useful, we implemented it first inside the caption package via option "caption=false". But this showed up some drawbacks, and therefore we change it in 2004 by moving the option "caption=false" to the subfig package.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests