Beamer 中 \ref{} 的问题

Beamer 中 \ref{} 的问题

在{article}环境中,我有以下代码:

\begin{enumerate}[\textit{Stage} $(1)$]
\item \label{st0} Something
    \item \label{st1} Something1
    \item \label{st2} Something2
\end{enumerate}

通过报纸,当我打电话

\ref{st1}

它立即用超链接写入“Stage 2”。但是,我无法在 Beamer 中重现它。特别是,它只打印“1”。

您知道如何修复这个问题吗?

提前致谢!!

编辑. 可编译示例。

\documentclass[english]{beamer}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage{amstext}
\hypersetup{
    colorlinks,
    citecolor=blue,
    linkcolor=blue
}
\usepackage{amsmath, amsthm, amssymb}
\newtheorem{prop}{Proposition}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[authoryear]{natbib}
\makeatletter
\newcommand\makebeamertitle{\frame{\maketitle}}
\AtBeginDocument{
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}}
  \makeatletter
\renewcommand{\itemize}[1][]{%
    \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
    \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
    {\usebeamertemplate{itemize \beameritemnestingprefix item}}
    {\def\makelabel##1{%
            {%
                \hss\llap{{%
                        \usebeamerfont*{itemize \beameritemnestingprefix item}%
                        \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
            }%
        }%
    }
    \fi%
    \setlength\itemsep{\fill}
    \ifnum \@itemdepth >1
     
    \fi%  
    \beamer@cramped%
    \raggedright%
    \beamer@firstlineitemizeunskip%
}
\def\enditemize{\ifhmode\unskip\fi\endlist%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}
    \ifnum \@itemdepth >1
    \vfil
    \fi%  
}
\makeatother
\setbeamercovered{transparent}
\makeatother
\usepackage[english]{babel}
\setbeamercolor{math text}{fg=black!15!blue}
\setbeamertemplate{footline}[frame number]
\begin{document}
\title{Example
\today }
\begin{frame}{Stages}
\begin{center}
\begin{enumerate}[\textit{Stage} $(1)$]
\item \label{st0} Something happens.
\vspace{5mm}
    \item \label{st1} Something happens.
    \vspace{5mm}
    \item \label{st2} Something happens.
    \vspace{5mm}
    \item \label{st3} Something happens.
    \end{enumerate}\end{center}
\end{frame}
\begin{frame}{Call the Stage}
    \begin{itemize}
        \item \ref{st1}
    \end{itemize}
\end{frame}
\end{document}

编辑2

请参阅附件的文章示例。

 \documentclass[english,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{newpxtext,newpxmath}
\usepackage{palatino}
\usepackage{longtable}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{geometry}
 \geometry{
 a4paper,
 left=3.175cm,
 right=3.175cm,
 top=3.175cm,
 bottom=3.175cm,
 }
\usepackage{amssymb}
\usepackage{float}
\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}
\usepackage{appendix}
\usepackage{pgfplots}
\usetikzlibrary{patterns,decorations.pathreplacing}
\pgfplotsset{compat=1.10}
\usepackage{setspace}
\usepackage[round]{natbib}
 \linespread{1.25}
\usepackage{xcolor}
\setcitestyle{square}
\usepackage{hyperref}
\usepackage{tgpagella}
\hypersetup{
  colorlinks,
  citecolor=blue,
  linkcolor=blue,
  urlcolor=blue}
\makeatletter
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\interfootnotelinepenalty=10000
\usepackage{mdframed}
\mdfdefinestyle{myenvs}{%
  hidealllines=true,%
  nobreak=true, % comment this to allow breaking
  leftmargin=0pt,
  rightmargin=0pt,
  innerleftmargin=0pt,
  innerrightmargin=0pt,
}
\newmdtheoremenv[style=myenvs]{prop}{Proposition}
\newtheorem{corollary}{Corollary}
\newmdtheoremenv[style=myenvs]{Lemma}{Lemma}
\usepackage{blindtext}
\usepackage{thmtools}
\usepackage{authblk}
\makeatother
\providecommand{\Propositionname}{Proposition}
\providecommand{\theoremname}{Theorem}

\begin{document}
\title{Example}
}
\author{me}
\date{\today}
\maketitle
\thispagestyle{empty}
\textbf{Keywords}
\newpage{}
\maketitle
\clearpage
\setcounter{page}{1}
\newpage
\section{Example}
\begin{enumerate}[\textit{Stage} $(1)$]
\item \label{st0} Something happens.
    \item \label{st1} Example.
\end{enumerate}
In \ref{st0}, something happens.
\end{document}

答案1

您可以使用enumitem包:

\documentclass{beamer}
\usepackage{enumitem}
\begin{document}
\begin{frame}
\begin{enumerate}[label=\textit{Stage (\arabic*)}]
    \item \label{st0} Something
    \item \label{st1} Something1
    \item \label{st2} Something2
\end{enumerate}
\end{frame}
\begin{frame}
This is a reference to \ref{st1}.
\end{frame}
\end{document}

相关内容