subfig、ref 和 renewcommand 的問題

subfig、ref 和 renewcommand 的問題

subfigure我在使用該包和相應的參考資料時遇到問題。

我正在寫我的論文,我希望這個角色像這樣命名

\numberwithin{figure}{part}
\renewcommand{\thefigure}{\arabic{part}.\arabic{figure}}

這很好用。

如果我現在有一個subfigure我希望輸出像1.1.a(部分,圖,子圖)但我只得到1.a(圖,子圖)

我嘗試使用

\numberwithin{subfigure}{part}
\renewcommand{\thesubfigure}{\arabic{part}.\arabic{figure}.\alph{subfigure
} } 

但這搞砸了圖片的標題。我透過以下方式包含子圖:

\begin{figure}[htbp]
\centering
\subfigure[][]{
\includegraphics[width=0.4\textwidth]{Picture1}
\label{fig:Picture1}}
\subfigure[][]{\vspace{2pt}
 \includegraphics[width=0.5\textwidth]{Picture2.png}
\label{fig:Picture2}}
 \caption[What is seen on Pic1 and 2 ]{(a)text Pic 1 (b) text Pic 2}
\end{figure} 

並用 引用它\ref{fig:Picutre1}。有人有想法嗎?

答案1

確保在載入subfigure套件之前重新定義圖形編號。然後你應該得到你想要的輸出。

請注意,\numberwithin已經更改了標籤格式,因此您的\renewcommands 是多餘的。如果您希望更改part這些參考文獻中 的列印表示形式,那麼您應該透過重新定義 來實現\thepart。這將使更改保持一致。

樣本輸出

\documentclass{book}

\usepackage{amsmath}
\numberwithin{figure}{part}
\usepackage{subfigure,graphicx}

\renewcommand{\thepart}{\arabic{part}}

\begin{document}

\part{A part}
\begin{figure}[htbp]
\centering
\subfigure[][]{
\includegraphics[width=0.4\textwidth]{example-image-a}
\label{fig:Picture1}}
\subfigure[][]{\vspace{2pt}
 \includegraphics[width=0.5\textwidth]{example-image-b}
\label{fig:Picture2}}
 \caption[What is seen on Pic1 and 2]{(a) text Pic 1 (b) text Pic 2}
\end{figure} 

A reference to \ref{fig:Picture2}.
\end{document}

相關內容