Subbottom giving weird errors when I use captions for my subfigures

I have a figure with the following syntax:

\begin{figure}[h!] \centering
\subbottom[$H_n = A_n / e$]{
\begin{tikzpicture}[every node/.style=defnode]
...
\end{tikzpicture}
}
\subbottom[$S_n = A_n - e$]{
\begin{tikzpicture}[every node/.style=defnode]
...
\end{tikzpicture}
}
\end{figure}


But when I try to compile I get the two following errors:

undefined control sequence {


and

undefined control sequence \end{figure}


pointing at the last two lines of my figure. These do not make much sense to me. If I try to remove the caption [..] of my subbottoms, I do not get this mistake.

I have included \usepackage{subfig} in a memoir document.

This is a minimum working example:

\documentclass[12pt,a4paper,showtrims,final]{memoir}
\usepackage[utf8]{inputenc} % danske tegn

\usepackage{./memfonts}

\usepackage{tikz}
\usepackage{subfig}
\tikzstyle{defnode}=[circle,fill=white,draw=black,inner sep=0pt,minimum size=5pt]

\begin{document}

\begin{figure}[h!]\centering
\subbottom[$F_n$]{
\begin{tikzpicture}[every node/.style=defnode]
\draw (0,0) node(a) {};
\draw (2.2,1) node(b1) {};
\draw (2.5,0.5) node(b2) {};
\draw (2.6,0) node(b3) {};
\draw (2.5,-0.5) node(b4) {};
\draw (2.2,-1) node(b5) {};
\draw (a) to (b1);
\draw (a) to (b2);
\draw (a) to (b3);
\draw (a) to (b4);
\draw (a) to (b5);
\draw (b1) to (b2) to (b3) to (b4) to (b5);
\end{tikzpicture}
} \hspace{1cm}
\subbottom[$G_n$]{
\begin{tikzpicture}[every node/.style=defnode]
\draw (0,0) node(a) {};
\draw (2.2,1) node(b1) {};
\draw (2.5,0.5) node(b2) {};
\draw (2.6,0) node(b3) {};
\draw (2.5,-0.5) node(b4) {};
\draw (2.2,-1) node(b5) {};
\draw (a) [bend left=10] to (b1);
\draw (a) [bend right=10] to (b1);
\draw (a) to (b2);
\draw (a) to (b3);
\draw (a) to (b4);
\draw (a) to (b5);
\draw (b1) to (b2) to (b3) to (b4) to (b5);
\end{tikzpicture}
}
\end{figure}

\end{document}

-
It's difficult to say without a minimum working example (MWE). Would you mind preparing one that illustrates the issue, and we can try to help? See this discussion if you're unsure what MWE is: meta.tex.stackexchange.com/questions/228/… –  Martin Tapankov Feb 16 '11 at 21:08
Done, it is now in the question. –  utdiscant Feb 16 '11 at 21:53
Is there anything important in memfonts.sty? –  Caramdir Feb 17 '11 at 4:37
You should be able to leave it out, but it will give a warning. –  utdiscant Feb 17 '11 at 8:11
No need for subfig, just add \newsubfloat{figure} to preamble as per manual (I'd better add a comment on the page that describes \subbottom that one need to define it before use –  daleif Mar 8 '11 at 21:34

You try to use subfig package together with memoir. Now, subfig loads the caption package, which memoir doesn't seem to like -- it even throws a warning in the output saying exactly that:

You are using the caption package with the memoir
class. This may cause unexpected or inconsistent
results if you use any of memoir's captioning facilities.


The easiest solution probably would be to replace the \subbottom (from the ccaption package loaded by memoir) with \subfloat and be done about it... Unless you need some of the more advanced functionality ccaption provides (bilingual captions, legends, custom caption styles and whatnot).

\documentclass[12pt,a4paper,showtrims,final]{memoir}
\usepackage[utf8]{inputenc} % danske tegn

%\usepackage{./memfonts}

\usepackage{tikz}
\usepackage{subfig}
\tikzstyle{defnode}=[circle,fill=white,draw=black,inner sep=0pt,minimum size=5pt]

\begin{document}

\begin{figure}[h!]
\centering

\subfloat[$F_n$]{
\begin{tikzpicture}[every node/.style=defnode]
\draw (0,0) node(a) {};
\draw (2.2,1) node(b1) {};
\draw (2.5,0.5) node(b2) {};
\draw (2.6,0) node(b3) {};
\draw (2.5,-0.5) node(b4) {};
\draw (2.2,-1) node(b5) {};
\draw (a) to (b1);
\draw (a) to (b2);
\draw (a) to (b3);
\draw (a) to (b4);
\draw (a) to (b5);
\draw (b1) to (b2) to (b3) to (b4) to (b5);
\end{tikzpicture}
}
\hspace{1cm}
\subfloat[$G_n$]{
\begin{tikzpicture}[every node/.style=defnode]
\draw (0,0) node(a) {};
\draw (2.2,1) node(b1) {};
\draw (2.5,0.5) node(b2) {};
\draw (2.6,0) node(b3) {};
\draw (2.5,-0.5) node(b4) {};
\draw (2.2,-1) node(b5) {};
\draw (a) [bend left=10] to (b1);
\draw (a) [bend right=10] to (b1);
\draw (a) to (b2);
\draw (a) to (b3);
\draw (a) to (b4);
\draw (a) to (b5);
\draw (b1) to (b2) to (b3) to (b4) to (b5);
\end{tikzpicture}
}

\end{figure}
\end{document}


Besides, \subbottom is used (AFAIR) for providing a caption to a piece of text that can be tracked as a float. I'm not sure you can use it for captioning non-text stuff.

-