tufte-latex 缺少子标题编号

tufte-latex 缺少子标题编号

为什么以下 MWE 中缺少子标题的数字(实际上是字母)?请注意,打印了跟在字母后面的冒号。

\documentclass{tufte-handout}

\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{A circle, bottom-aligned}
    \label{fig:circle}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1cm) {};
    \end{tikzpicture}%
    \caption{A second, smaller circle}
    \label{fig:circle}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{A third circle, with a long caption that will force more
      line breaks and mess up the pretty layout}
    \label{fig:circle3}
  \end{subfigure}%
  \\
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{another circle, in a new row}
    \label{fig:circle4}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{final circle}
    \label{fig:circle5}
  \end{subfigure}%
  \caption{Shapes with no corners. Ugly sub-figure layout. Caption for
    the figure is in the margin per the \texttt{tufte-handout}
    class}\label{fig:circles}
\end{figure}

\end{document}

MWE 的输出

答案1

当我编译你的原始代码时,我得到了错误

Package caption Warning: \caption will not be redefined since it's already
(caption)                redefined by a document class or package which is
(caption)                unknown to the caption package.
See the caption package documentation for explanation.


! Package caption Error: The `subcaption' package does not work correctly
(caption)                in compatibility mode.

您可以在以下位置阅读更多相关信息文档,但本质上这意味着当前documentclass(在您的情况下tufte-handout)已经有了自己的修改caption命令的方式。

你可以通过使用来解决这个问题

\captionsetup{compatibility=false}

正如我在下面的代码中所做的那样 - 您的图像现在有标题!

截屏

我看到您已经询问了有关subfigures 的垂直对齐的另一个问题,因此我们将在该问题中解决这个问题:)

\documentclass{tufte-handout}

\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup{compatibility=false}

\begin{document}

\begin{figure}
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{A circle, bottom-aligned}
    \label{fig:circle}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1cm) {};
    \end{tikzpicture}%
    \caption{A second, smaller circle}
    \label{fig:circle}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{A third circle, with a long caption that will force more
      line breaks and mess up the pretty layout}
    \label{fig:circle3}
  \end{subfigure}%
  \\
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{another circle, in a new row}
    \label{fig:circle4}
  \end{subfigure}%
  ~
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \begin{tikzpicture}
      \draw circle (1.25cm) {};
    \end{tikzpicture}%
    \caption{final circle}
    \label{fig:circle5}
  \end{subfigure}%
  \caption{Shapes with no corners. Ugly sub-figure layout. Caption for
    the figure is in the margin per the \texttt{tufte-handout}
    class}\label{fig:circles}
\end{figure}

\end{document}

相关内容