图题中多次引用子图

图题中多次引用子图

由于某些原因,我需要在图形环境中对子图进行特定编号。我希望图形环境的标题引用子图如下:图 1-4。我该怎么做?

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage[caption=false]{subfig}

\begin{document}
\newcommand{\gridsize}{0.45}
\begin{figure*}[t!]
\centering
\renewcommand{\thesubfigure}{\thefigure}
\subfloat[Subfigure (1)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image-a}
    \label{fig:subfig1}
}
\renewcommand{\thesubfigure}{\thefigure\alph{subfigure}}
\setcounter{figure}{1}
\setcounter{subfigure}{0}
\subfloat[Subfigure (2a)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image-b}
    \label{fig:subfig2a}
}
\setcounter{figure}{1}
\setcounter{subfigure}{1}
\subfloat[Subfigure (2b)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image-b}
    \label{fig:subfig2b}
}
\setcounter{figure}{1}
\setcounter{subfigure}{2}
\subfloat[Subfigure (2c)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image-b}
    \label{fig:subfig2c}
}\\
\renewcommand{\thesubfigure}{\thefigure}
\setcounter{figure}{2}
\setcounter{subfigure}{0}
\subfloat[Subfigure (3)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image-c}
    \label{fig:subfig3}
}
\renewcommand{\thesubfigure}{\thefigure\alph{subfigure}}
\setcounter{figure}{3}
\setcounter{subfigure}{0}
\subfloat[Subfigure (4a)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image}
    \label{fig:subfig4a}
}
\setcounter{figure}{3}
\setcounter{subfigure}{1}
\subfloat[Subfigure (4b)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image}
    \label{fig:subfig4b}
}
\setcounter{figure}{3}
\setcounter{subfigure}{2}
\subfloat[Subfigure (4c)]{
    \includegraphics[width=\gridsize\columnwidth]{example-image}
    \label{fig:subfig4c}
}
\label{fig:figure}
\caption{Main caption}
\end{figure*}
\end{document}

感谢您的帮助,

答案1

由于您没有提供实际的子图标题,我尝试进行调整。

\documentclass[twocolumn]{article}
\usepackage{graphicx}

\begin{document}
\begin{figure*}[t!]
    \centering
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-a}
        \label{fig:subfig1}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-b}
        \label{fig:subfig2}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-c}
        \label{fig:subfig3}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image}
        \label{fig:subfig4}
    \end{minipage}
    Main Caption% will not increment figure counter nor appear in list of figures
\end{figure*}
\end{document}

演示

相关内容