通过使用 \ref,它会显示完整的标签和标题,而我只想要编号

通过使用 \ref,它会显示完整的标签和标题,而我只想要编号

最小工作代码 =

\RequirePackage[2020-02-02]{latexrelease}
\documentclass{article}
%
\usepackage{graphicx}
\RequirePackage{hyperref}
%
\hypersetup{colorlinks=true,
    breaklinks=true,
    citecolor=black,
    urlcolor=blue,
    linkcolor=black,
    menucolor=blue,
    anchorcolor=red,
    pdfstartview={XYZ null null 1},
    bookmarksnumbered=false,
    bookmarksopen=true,
    bookmarksopenlevel=0}
%
\begin{document}
    For a full understanding of the air intake system relevant to the problem Figure \ref{fig:1.1} will be used as an example
    %
    \begin{figure}[ht]
        \centering
        \includegraphics[width=40mm,height=50mm]{system outline.PNG}
        \caption{simplified block diagram air intake system}
        \label{fig:1.1}
    \end{figure}
\end{document}

但结果却如下图所示: 在此处输入图片描述

然而,我只想显示数字,如果我的问题表述有误,请原谅。

答案1

最后我找到了解决方案:交叉引用未按预期工作,引用和标签的完整名称都被打印出来了?作者:Ulrike Fischer

您只需添加以下代码:

\makeatletter
 \DeclareRobustCommand\ref{%
    \@ifstar\@refstar\T@ref
  }%
  \DeclareRobustCommand\pageref{%
    \@ifstar\@pagerefstar\T@pageref
  }%
 \makeatother

完整代码:

\RequirePackage[2020-02-02]{latexrelease}
\documentclass{article}
%
\usepackage{graphicx}
\RequirePackage{hyperref}

\makeatletter
 \DeclareRobustCommand\ref{%
    \@ifstar\@refstar\T@ref
  }%
  \DeclareRobustCommand\pageref{%
    \@ifstar\@pagerefstar\T@pageref
  }%
 \makeatother

%
\hypersetup{colorlinks=true,
    breaklinks=true,
    citecolor=black,
    urlcolor=blue,
    linkcolor=black,
    menucolor=blue,
    anchorcolor=red,
    pdfstartview={XYZ null null 1},
    bookmarksnumbered=false,
    bookmarksopen=true,
    bookmarksopenlevel=0}
%
\begin{document}
    For a full understanding of the air intake system relevant to the problem Figure \ref{fig:1.1} will be used as an example
    %
    \begin{figure}[ht]
        \centering
        \includegraphics[width=40mm,height=50mm]{system outline.PNG}
        \caption{simplified block diagram air intake system}
        \label{fig:1.1}
    \end{figure}
\end{document}

相关内容