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

Re: subfig package and amsart

Post by dcernst »

Thanks! That works as expected.

Two questions:

1. Should I even be using \subfloat? Or, would it be better to use \begin{subfigure}...\end{subfigure}?

2. I have my subfigures labelled with lowercase roman letters wrapped in parentheses (e.g. (b)). However, when I use "Figure~\ref{MyFig}\subref{Fig051}" I get "Figure 1b" instead of "Figure 1(b)." This must be easy to fix and I had it working as expected using the subfig package.

Axel, thanks for all of your responses. I'll be chipping in a donation to the LaTeX Community site soon:)

Dana
Last edited by dcernst on Tue Aug 31, 2010 7:25 pm, edited 2 times 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

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

subfig package and amsart

Post by sommerfee »

dcernst wrote:1. Should I even be using \subfloat? Or, would it be better to use \begin{subfigure}...\end{subfigure}?
You can use the subfigure environment, or \subcaptionbox (which is the equivalent to \subfloat), or \subfloat, as you like. \subcaptionbox has more options than \subfig, and the subfigure environment will not do automatic horizontal alignment but is more flexable. Personally I use \subcaptionbox in most cases, and the subfigure environment only if I need fancy layouts, e.g. having the sub-captions on the right side of the sub-figures.
2. I have my subfigures labelled with lowercase roman letters wrapped in parentheses (e.g. (b)). However, when I use "Figure~\ref{MyFig}\subref{Fig051}" I get "Figure 1b" instead of "Figure 1(b)." This must be easy to fix and I had it working as expected using the subfig package.
The handling of the labelformat and the reference is different to the subfig package but exactly the same as in caption package. The counter itself will be generated by using \theXXX, where XXX is the name of the counter. This is what is used by the label, the reference and the list of figures. The caption label will be generated by wrapping the counter with the given labelformat. The default will give you an alphanumeric counter and the labelformat will wrap it by parenthesis.

So if you want the parenthesis around the counter, you have to put them into the counter format and take them out of the labelformat.
Another thing that is annoying me is how the subfigures are labelled using capitals, but when I reference them, they are in lower case.
This is because the AMS document classes put the caption label in \scshape. You can set your own font by using the labelfont option here.

A different thing: You don't have to write \ref{FigTest}\subref{Fig008} but can use \ref{Fig008} instead, it will give you the same output.

In total we have now:

Code: Select all

\documentclass{amsart}

\usepackage{graphicx}
\usepackage{caption}
\usepackage[labelformat=simple,labelfont={}]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}

\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{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}
If you have questions about this or further questions please don't hesitate to ask.

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

Re: subfig package and amsart

Post by dcernst »

Your suggestions work perfectly! Thank you very much.

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

subfig package and amsart

Post by sommerfee »

sommerfee wrote: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.
Just a short note: Because of the incompatibility (and reported problems, and other reasons) I decided to drop \subfloat in the very next version of the subcaption package. Please use \subcaptionbox instead. I'm sorry for the inconvenience.
Post Reply