更改每行子图中的编号

更改每行子图中的编号

我有 4 行 3 列的 12 个子图。目前我的编号为 (a)、(b)、(c)、....(l)。但我希望每行的所有三个图都为 (a)、(b)、(c),并且以行号开头。例如,编号将是:(1.a)、(1.b)、(ac)、(2.a)、(2.b)、....(4.c)。任何帮助都非常感谢。这是我的代码:

begin{figure*}
  \centering   
   \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/1w}
                \caption{W}
                \label{fig:c1w}
        \end{subfigure}%
        \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/1time}
                \caption{time}
                \label{fig:c1time}
        \end{subfigure}%
\begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/1po}
                 \caption{PO}
                \label{fig:c1po}
        \end{subfigure}%       


                \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/2w}
                 \caption{W}
                \label{fig:c2w}
        \end{subfigure}%
        \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/2time}
                \caption{time}
                \label{fig:c2time}
        \end{subfigure}%
\begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/2po}
               \caption{PO}
                \label{fig:c2po}
        \end{subfigure}%


        \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/0w}
                \caption{W}
                \label{fig:c0w}
        \end{subfigure}%
        \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/0time}
                \caption{time}
                \label{fig:c0time}
        \end{subfigure}%
\begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/0po}
                \caption{PO}
                \label{fig:c0po}
        \end{subfigure}

         \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/3w}
                \caption{W}
                \label{fig:c3w}
        \end{subfigure}%
        \begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/3time}
                \caption{time}
                \label{fig:c3time}
        \end{subfigure}%
\begin{subfigure}[b]{0.33\textwidth}
                \includegraphics[width=\linewidth]{figures/3po}
                \caption{PO}
                \label{fig:c3po}
        \end{subfigure}%
        \caption{\label{fig:coup_parafac}An example of two components extracted by \ourAlgo\ algorithm. }
\end{figure*}

答案1

我把重新定义放在\thesubfigure图形环境里面,以免影响其他图形。

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}

\newcounter{row}
\makeatletter
\@addtoreset{subfigure}{row}
\makeatother

\def\ourAlgo{???}

\begin{document}
\begin{figure*}
  \renewcommand{\thesubfigure}{\arabic{row}.\alph{subfigure}}%
  \centering 
  \setcounter{row}{1}%
  \begin{subfigure}[b]{0.33\textwidth}
     \includegraphics[width=\linewidth]{example-image-a}
     \caption{W}
     \label{fig:c1w}
   \end{subfigure}%
   \begin{subfigure}[b]{0.33\textwidth}
     \includegraphics[width=\linewidth]{example-image-b}
     \caption{time}
     \label{fig:c1time}
     \end{subfigure}%
   \begin{subfigure}[b]{0.33\textwidth}
     \includegraphics[width=\linewidth]{example-image-c}
     \caption{PO}
     \label{fig:c1po}
   \end{subfigure}%       

   \stepcounter{row}%
   \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-a}
      \caption{W}
      \label{fig:c2w}
    \end{subfigure}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-b}
      \caption{time}
      \label{fig:c2time}
      \end{subfigure}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-c}
      \caption{PO}
      \label{fig:c2po}
    \end{subfigure}%

    \stepcounter{row}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-a}
      \caption{W}
      \label{fig:c0w}
    \end{subfigure}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-b}
      \caption{time}
      \label{fig:c0time}
    \end{subfigure}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-c}
      \caption{PO}
      \label{fig:c0po}
    \end{subfigure}

    \stepcounter{row}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-a}
      \caption{W}
      \label{fig:c3w}
    \end{subfigure}%
    \begin{subfigure}[b]{0.33\textwidth}
      \includegraphics[width=\linewidth]{example-image-b}
      \caption{time}
      \label{fig:c3time}
     \end{subfigure}%
     \begin{subfigure}[b]{0.33\textwidth}
       \includegraphics[width=\linewidth]{example-image-c}
       \caption{PO}
       \label{fig:c3po}
     \end{subfigure}%
     \caption{\label{fig:coup_parafac}An example of two components extracted by \ourAlgo\ algorithm. }
\end{figure*}
\end{document}

演示

相关内容