有没有办法对每个子字幕框进行编号?

有没有办法对每个子字幕框进行编号?

我开始放弃我的希望,但我想再试一次:

有没有办法对每个子标题框进行编号?我的代码具有以下结构:

\begin{figure}
\centering
\begin{tikzpicture}
\newcommand\mypic{
  \draw (0,0) -- (3,0);
  % do you really need draw and fill, or just fill?
  \draw[fill] (0.7,0) circle [radius=0.05]
    node[below, xshift=-0.2cm, font=\small] {0};
  \draw[fill] (2.3,0) circle [radius=0.05]
    node[below, xshift=0.2cm, font=\small] {1};
}

\mypic
-----
\end{tikzpicture}
% adjust vertical spacing
\par\vspace{-5pt}
% emulate the width of each drawing and the separation between them
\subcaptionbox{Dog}{\rule{3cm}{0pt}}\hspace{1.25cm}%
\subcaptionbox{Cat}{\rule{3cm}{0pt}}\hspace{1.25cm}%
\subcaptionbox{Tiger}{\rule{3cm}{0pt}}\hspace{1.25cm}%
\subcaptionbox{Lion}{\rule{3cm}{0pt}}%


 \end{figure}
   \begin{figure}
  \centering
   \begin{tikzpicture}
\newcommand\mypic{
  \draw (0,0) -- (3,0);
  % do you really need draw and fill, or just fill?
  \draw[fill] (0.7,0) circle [radius=0.05]
    node[below, xshift=-0.2cm, font=\small] {0};
  \draw[fill] (2.3,0) circle [radius=0.05]
    node[below, xshift=0.2cm, font=\small] {1};
}

 \mypic
  -----  ;
  \end{tikzpicture}
   % adjust vertical spacing
      \par\vspace{-5pt}
        % emulate the width of each drawing and the separation between them
    \subcaptionbox{X}{\rule{3cm}{0pt}}\hspace{1.25cm}%
    \subcaptionbox{Y}{\rule{3cm}{0pt}}\hspace{1.25cm}%
        \subcaptionbox{Z}{\rule{3cm}{0pt}}\hspace{1.25cm}%
          \subcaptionbox{D}{\rule{3cm}{0pt}}%
         \end{figure}

所以我希望有 1. 狗、2. 猫、3. 狮子等...问题是,我可以手动执行此操作,但我有 7000 行这样的代码,我宁愿不手动执行此操作。是否有一个简单的技巧可以为每个子标题框编号?我很高兴听到这个。此外,作为构建,我的代码基本上在一页上有 16 个数字。所以它是 4 x 4,这就是我采用子标题框方法的原因。除此之外,如果有一种方法不需要比手动执行 1.、2. 等花费更多精力,那就太好了。我在考虑类似 \newcounter{subboxcounter} 的东西

\setcounter{subboxcounter}{1} 并以某种方式将数字插入标题,但我不知道该怎么做。有人能帮忙吗?

相关内容