Graphics, Figures & Tablessubfig package and amsart

Information and discussion about graphics, figures & tables in LaTeX documents.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subfig package and amsart

Post by dcernst »

I'm having some bizzare issues with the subfig package and the amsart document class. I have several figures that I'm trying to include in an article and some of them are causing the subfloat label and caption to be smashed right. All of the figures were originally created using mfpic, but currently all of the images are saved as eps files and being loaded via \includegraphics (using the graphicx package). I've also had the same problems when converting to ps and pdf (using ps2pdf and pdfcrop).

Here is a minimal example of the source code:

Code: Select all

\documentclass{amsart}

\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

Another thing that is annoying me is how the subfigures are labelled using capitals, but 
when I reference them, they are in lower case.  For example, 
Figure~\ref{FigTest}\subref{Fig008}.  I want the labels on the figures to be lowercase, 
too, like they are using the \texttt{article} class.

\begin{figure}[ht]
\centering
\subfloat[test]{\label{Fig007}\includegraphics{Fig007}}
\hspace{.5cm}
\subfloat[test2]{\label{Fig008}\includegraphics{Fig008}}
\caption{}\label{FigTest}
\end{figure}

\end{document}
I've attached the PDF output as well as the corresponding Fig007 and Fig008 files.
test.pdf
(14.34 KiB) Downloaded 405 times
Fig007.eps
(17.1 KiB) Downloaded 296 times
Fig008.eps
(16.75 KiB) Downloaded 258 times
If you look at the label and caption for the second subfigure, you can see how it isn't being centered. I have 67 figures that I am trying to include in my article and roughly 10% of them are causing this sort of problem. It doesn't appear to be a bounding box issue, but maybe I haven't really verified this.

Here is the really annoying part. When I switch to the article document class, I have none of these issues. Also, if I use the older subfigure package, I don't have any of these issues either.

Another issue that I'm having is that the labels for the subfigures when using the amsart document class are in capital letters, but when you reference them, they are lowercase. Does anyone know how to force them to be lowercase when using the amsart document class?
Last edited by dcernst on Tue Aug 31, 2010 7:25 pm, edited 1 time in total.

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

dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subfig package and amsart

Post by dcernst »

By the way, I running TeXLive 2009 and using TeXShop 2.36 on a computer running OSX 10.6.4.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subfig package and amsart

Post by dcernst »

Adding the following line to my preamble seems to solve all of my issues (non-centered labels and capital letter labels).

Code: Select all

\captionsetup[subfigure]{margin=0pt, parskip=0pt, hangindent=0pt, indention=0pt, 
labelformat=parens, labelfont=rm}
I don't exactly understand why setting margin, parskip, hangindent, and indentation to 0pt is what works since this is apparently the default. Any further insight would be greatly appreciated. Am I really the only one that's had this problem?

(I'm embarrassed how long I spent trying to figure this out.)
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subfig package and amsart

Post by sommerfee »

dcernst wrote:I don't exactly understand why setting margin, parskip, hangindent, and indentation to 0pt is what works since this is apparently the default.
No, it isn't. See caption package documentation, section about amsart, amsproc, and amsbook.
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subfig package and amsart

Post by dcernst »

Hmmm, according to pages 10--11 of the subfig documentation, the default caption settings are given by

Code: Select all

\captionsetup[subfigure]{style=default, margin=0pt, parskip=0pt, hangindent=0pt, 
indention=0pt, singlelinecheck=true}
I didn't realize that the AMS document classes would modify the defaults of the caption package, which apparently subfig relies on. Thanks for your response.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subfig package and amsart

Post by sommerfee »

dcernst wrote:Hmmm, according to pages 10--11 of the subfig documentation, the default caption settings are given by
Then either the subfig documentation is wrong or this is a bug in the subfig package.

If I replace \usepackage{subfig} by \usepackage{caption,subcaption} the result is fine, so I assume this is a bug in the subfig package.

Axel
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

Re: subfig package and amsart

Post by dcernst »

Axel,

Thanks for your responses. Do you have an easy answer for when to use the subfig package over caption & subcaption or vice versa? I wasn't really aware of the caption & subcaption packages until I started exploring this issue a couple of days ago.

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

Re: subfig package and amsart

Post by sommerfee »

subfigure package: The initial one.

subfig package: The new version from the same author, it superseeds the subfigure package. It's using the same kernel macros as the caption package and shares a lot of options with it. Can be used either with or without the main caption package (option "caption=false").

subcaption package: Written by me after the author of the subfig package did not maintained his package anymore. Pro: (Hopefully) less bugs, works with hyperref, and integrates better with the actual version of the caption package. Contra: Needs the caption package, so it cannot be used with document classes unsupported by the caption package.

HTH,
Axel
dcernst
Posts: 19
Joined: Sun Aug 29, 2010 9:50 pm

subfig package and amsart

Post by dcernst »

Axel, thanks again for your response. It seems that it makes sense for me to use the caption & subcaption packages. Thanks for your work on this. One thing that is alluding me at the moment is how to reference subfigures. With the subfig package, I had written things like

Code: Select all

\begin{figure}[h]
\centering
\subfloat[]{\label{Fig050}\includegraphics{Fig050}}
\hspace{1cm}
\subfloat[]{\label{Fig051}\includegraphics{Fig051}}
\caption{}\label{MyFig}
\end{figure}
Later when I wanted to reference say the second subfigure, I would use

Code: Select all

Figure~\ref{MyFig}\subref{Fig051}
But this doesn't seem to work using the captions/subcaptions package. I probably just need to read the documentation...but a quick pointer here would be greatly appreciated.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subfig package and amsart

Post by sommerfee »

When using the subfig package, one can place the label inside the caption or inside the content. The latter one is not intended, but works anyway. (And the author uses this notation within its package documentation, too.)

When using the subcaption package, the label must be placed inside the caption, e.g.:

Code: Select all

\subfloat[\label{Fig050}]{\includegraphics{Fig050}}
So unfortunately the \subfloat command of the subcaption package is not 100% compatible to the one of the subfig package, for that reason I decided not to document it.

HTH,
Axel
Post Reply