如何為一張圖加上兩個標籤

如何為一張圖加上兩個標籤

我有一張圖片,但實際上它是兩個數字的組合。因此我只能使用\includegraphics一次。不過,我想在左側和右側使用兩個標籤。我尋找答案但找不到。我正在發送預期結果的圖片。請你幫助我好嗎?

在此輸入影像描述

答案1

您可以新增一個空的子標題minipage,類似於第 2 節中所示的內容subcaption文件

在此輸入影像描述

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

\begin{document}

\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}

\begin{minipage}{0.25\textwidth}
\subcaption{\label{left} Left half}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\subcaption{\label{right} Right half}
\end{minipage}

\caption{\label{figure} Overall caption}
\end{figure}

Figure~\ref{figure} has \ref{left} on the left, and \ref{right} on the right,
also known as \subref{left} and \subref{right}.

\end{document}

相關內容