我有一个具有以下语法的图:
\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}
但是当我尝试编译时出现以下两个错误:
undefined control sequence {
和
undefined control sequence \end{figure}
指向我图的最后两行。这对我来说没有多大意义。如果我尝试删除子底部的标题 [..],我不会犯这个错误。
我已将其包含\usepackage{subfig}
在memoir
文档中。
这是一个最小工作示例:
\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}
答案1
您尝试将subfig
包与一起使用memoir
。现在,subfig
加载caption
包,这memoir
似乎不太好——它甚至在输出中抛出一个警告,确切地说:
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.
最简单的解决方案可能是用替换\subbottom
(来自ccaption
加载的包memoir
)\subfloat
并完成它......除非您需要一些更高级的功能ccaption
(双语字幕,图例,自定义字幕样式等等)。
\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}
此外,\subbottom
它(据我所知)用于为一段可以作为浮点数跟踪的文本提供标题。我不确定您是否可以用它来为非文本内容添加标题。