当我使用 hyperref 和 subbottom 引用 memoir 类中的子图时,所有子图标识符(a、b、c、d、e 等)都相差一数。例如,图 1b 显示为图 1a。
说实话,我不知道该如何解决这个问题。我在网上搜索过,但没有发现任何类似的问题。我不确定这是否相关,但当我运行 Windows 7 Professional 时,我没有遇到这个问题。自从升级到 Windows 10(大学也强迫我这样做......)以来,我在编写论文时遇到了这个问题。这是我提交论文之前需要修复的最后一件事,因此任何帮助都将不胜感激。
请参阅以下 MWE:
\documentclass[a4paper,11pt]{memoir}
\usepackage{graphicx}
\usepackage{hyperref} % Creates hyperlinks in cross references
\newsubfloat{figure} % Allow subfloats in figure environment
\begin{document}
\chapter{Test}
\begin{figure}
\begin{tabular}{c c c}
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1a]{\includegraphics[width=1.0\textwidth]{example-image-a}\label{fig1a}}
\end{minipage}
&
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1b]{\includegraphics[width=1.0\textwidth]{example-image-b}\label{fig1b}}
\end{minipage}
&
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1c]{\includegraphics[width=1.0\textwidth]{example-image-c}\label{fig1c}}
\end{minipage}
\end{tabular}
\caption[This is a figure]{A figure showing three panels}
\label{fig1}
\end{figure}
Referencing the main figure works fine!
\begin{itemize}
\item This should be Fig. 1.1 : Fig. \ref{fig1}
\end{itemize}
\noindent
Now try and reference the subfigures individually...
\begin{itemize}
\item This should be Fig. 1.1a: Fig. \ref{fig1a}
\item This should be Fig. 1.1b: Fig. \ref{fig1b}
\item This should be Fig. 1.1c: Fig. \ref{fig1c}
\end{itemize}
\end{document}
答案1
这是手册中的拼写错误,\label
进入的是可选参数而不是实际内容。
这很好用
\documentclass[a4paper,11pt]{memoir}
\usepackage{graphicx}
\usepackage{hyperref} % Creates hyperlinks in cross references
\newsubfloat{figure} % Allow subfloats in figure environment
\begin{document}
\chapter{Test}
\begin{figure}
\begin{tabular}{c c c}
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1a\label{fig1a}]{\includegraphics[width=1.0\textwidth]{example-image-a}}
\end{minipage}
&
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1b\label{fig1b}]{\includegraphics[width=1.0\textwidth]{example-image-b}}
\end{minipage}
&
\begin{minipage}{0.3\textwidth}
\subbottom[Caption 1c\label{fig1c}]{\includegraphics[width=1.0\textwidth]{example-image-c}}
\end{minipage}
\end{tabular}
\caption[This is a figure]{A figure showing three panels}
\label{fig1}
\end{figure}
Referencing the main figure works fine!
\begin{itemize}
\item This should be Fig. 1.1 : Fig. \ref{fig1}
\end{itemize}
\noindent
Now try and reference the subfigures individually...
\begin{itemize}
\item This should be Fig. 1.1a: Fig. \ref{fig1a}
\item This should be Fig. 1.1b: Fig. \ref{fig1b}
\item This should be Fig. 1.1c: Fig. \ref{fig1c}
\end{itemize}
\end{document}