在正文中引用附录中的图表,以便包含附录字母和图表编号

在正文中引用附录中的图表,以便包含附录字母和图表编号

我在正文中引用了附录中的一张图,但如果引用附录中的一张图,我希望引用显示附录字母和图号。

例如,现在当我引用附录 A 中的图 1 时,它只显示 .1,但我希望它在正文中显示 A.1。我已将我的全部序言(因为我不确定哪些部分是相关的)以及我的文档和附录 A 中的行都包括在内。

请注意,我在 Overleaf 中使用模板(aip)。

以下是我的正文的序言和相关内容。

\documentclass[%
 aip,
% jmp,
% bmf,
% sd,
% rsi,
 amsmath,amssymb,
%preprint,%
 reprint,%
%author-year,%
%author-numerical,%
% Conference Proceedings
]{revtex4-1}

\usepackage{graphicx}% Include figure files
\usepackage{float}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage[mathscr]{euscript}% use for script letters
\usepackage[english]{babel}
\usepackage{multirow}% use for having parts of table cover multiple lines
%\usepackage{array,booktabs}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[nottoc]{tocbibind}
\renewcommand\bibname{References}
\usepackage{mathptmx}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{nicefrac}
\usepackage{appendix}
\usepackage{hyperref}
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  citecolor=blue,
  urlcolor=black,
  hypertexnames=false
  }
%\usepackage{nameref}% loads gettitlestring
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@ssect@ltx}{\@xsect}{\protected@edef\@currentlabelname{#8}\@xsect}{}{}% Patch \<section>*
\xpatchcmd{\@sect@ltx}{\@xsect}{\protected@edef\@currentlabelname{#8}\@xsect}{}{}% Patch \<section>
\makeatother
\usepackage[pagewise]{lineno}% Enable numbering of text and display math
\linenumbers\relax % Commence numbering lines

% for response to reviewers
%\usepackage[dvipsnames]{xcolor}
\usepackage{soul}

\begin{document}

\preprint{AIP/123-QED}

...

\subsection{Identification of the Quasi-Steady Period}\label{sec:2C-Quasi-Steady}

since the time-averaged lift-coefficient $\overline{C_L}$ had become roughly constant across all $AR$, and ${Re}_g$ considered in this study (see Figure \mbox{\ref{fig:A1}}b).

...

\clearpage
\input{Writing/SupA}

\end{document}

以下是我的附录 A 中的相关内容。

\preprint{AIP/123-QED}

\setcounter{page}{1}
\renewcommand{\appendixname}{Supplementary Material}
\appendix
\section*{Supplementary Material A}\label{Supplementary Material A}

\setcounter{figure}{0}

\renewcommand\thefigure{\thesection.\arabic{figure}}
\begin{figure*}[ht!]
  \centering
  \includegraphics[]{Figures/SupA/FigA1/FigA1.pdf}
  \caption{I have removed the caption in my question.}
  \label{fig:A1}
\end{figure*}

答案1

这显示了如何为图形创建第二个\label\ref我进一步最小化了您的 MWE。

\documentclass[%
 aip,
% jmp,
% bmf,
% sd,
% rsi,
 amsmath,amssymb,
%preprint,%
 reprint,%
%author-year,%
%author-numerical,%
% Conference Proceedings
]{revtex4-1}

\usepackage{appendix}

\makeatletter
\newcommand{\locallabel}[1]% #1 = label name
{\bgroup% temporary
  \edef\@currentlabel{\arabic{figure}}%
  \label{#1}%
\egroup}
\makeatother

\begin{document}
\listoffigures
\hrule
One can use \ref{fig:A1} or \ref{fig:1}.

\preprint{AIP/123-QED}

\setcounter{page}{1}
\renewcommand{\appendixname}{Supplementary Material}
\appendix

\section{Supplementary Material A}\label{Supplementary Material A}

\setcounter{figure}{0}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}% defaul \ref and \listoffigures

\begin{figure*}[ht!]
  \caption{I have removed the caption in my question.}
  \label{fig:A1}
  \locallabel{fig:1}
\end{figure*}

\end{document}

相关内容