
そこで、私は図に「図セクション.図番号」というラベルを付けました。つまり、セクション 1 と 2 の場合は、各キャプションがそれぞれ「図 1.1」、「図 1.2」、「図 2.1」で始まるということです。私は、前文に次の記述を入れることでこれを実現しました。
\renewcommand{\thesubfigure}{図 \arabic{section}.\arabic{subfigure}}
サブ図を使用する理由は、ページ上で図を並べて表示できるようにするためです。とにかく、実際のテキストでこれらの図を参照する場合、たとえば「図 \ref{label1} と \ref{label2} を参照してください」とすると、実際の出力は「図 1.1 と図 1.2 を参照してください」となります。
キャプション内の「図」という単語を維持しながら、テキスト内で図を参照するときにそれを抑制するにはどうすればよいでしょうか。
以下に最小限の動作例を示します。
\documentclass{article}
\usepackage{graphicx, caption}
\usepackage{float} %Needed for the [H] after \begin{figure}. [H] stands for "Here",
i.e., the figures appear in the PDF in the same location as in the TeX code.
\usepackage[labelformat=simple]{subcaption}
\renewcommand{\thesubfigure}{Figure \arabic{section}.\arabic{subfigure}}
\begin{document}
\section{First section}
\section{Second section}
\begin{figure}[H]
\centering
\begin{subfigure}[t]{.45\textwidth}
\begin{center} \includegraphics[scale=0.2]{stars.jpeg} \end{center}
\caption{A picture of the past.}
\label{fig:stars}
\end{subfigure}
~~~
\begin{subfigure}[t]{.45\textwidth}
\begin{center} \includegraphics[scale=0.2]{monkeys.jpeg} \end{center}
\caption{Humans not too long ago.}
\label{fig:primates}
\end{subfigure}
~~~
\begin{subfigure}[t]{.42\textwidth}
\begin{center} \includegraphics[scale=0.16]{lion.jpeg} \end{center}
\caption{Not today Satan.}
\label{fig:predator}
\end{subfigure}
~~~
\begin{subfigure}[t]{.42\textwidth}
\begin{center} \includegraphics[scale=0.16]{blueberry.jpeg} \end{center}
\caption{Is this a blueberry-topped cupcake, or just a cup of blueberries?.}
\label{fig:enigma}
\end{subfigure}
~~~
\end{figure}
As we can see in figures \subref{fig:stars} and \subref{fig:enigma}, I'm not very good at making a minimal working example.
\end{document}
出力は次のようになります。
答え1
コメントから、あなたはサブフィギュアが何であるかをまったく知らないようですが、
\documentclass{article}
\renewcommand\thefigure{\thesection.\arabic{figure}}
\usepackage{graphicx}
\begin{document}
\section{Zzzzzz}
\begin{figure}[htp]
\begin{minipage}[t]{.33\linewidth}
\centering
\includegraphics[width=.7\linewidth]{example-image-a}
\caption{Zzzzz\label{zza}}
\end{minipage}\hfill
\begin{minipage}[t]{.33\linewidth}
\centering
\includegraphics[width=.7\linewidth]{example-image}
\caption{Zzzzz zzz\label{zzb}}
\end{minipage}\hfill
\begin{minipage}[t]{.33\linewidth}
\centering
\includegraphics[width=.7\linewidth]{example-image-b}
\caption{Zzzzz zzzzzz\label{zzc}}
\end{minipage}
\end{figure}
See figures \ref{zza} to \ref{zzc}
\end{document}