beamer 中单词之间带有 tikz 的箭头

beamer 中单词之间带有 tikz 的箭头

理想情况下,我希望重现以下图片。 在此处输入图片描述

我目前正在使用 tikz 包,我的代码如下(所有包和我想要修改的框架):

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage{amsmath,amssymb,braket,tikz}
\usetikzlibrary{tikzmark,calc}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\usepackage[scale=2]{ccicons}
\usepackage{enumitem}


\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}

\title{At the intersection between Machine Learning and
Econometrics: theory and applications}
\subtitle{}
% \date{\today}
\date{}
\author{Federico Nutarelli}
\institute{IMT School for Advanced Studies, Lucca}
\titlegraphic{
    \includegraphics[width=4cm]{Logo.png}
}
% \titlegraphic{\hfill\includegraphics[height=1.5cm]{logo.pdf}}

\begin{document}

\maketitle

%%%%%% HERE IS THE FRAME I WOULD LIKE TO BE AS THE IMAGE ABOVE:

\begin{frame}[fragile]{}
The major current challenges are:
\clearpage
\begin{itemize}
      \tikzmark{t1}  \item[1.] Optimize the acquisition costs (time and money) of big data to create novel opportunities for academics (Sivarajah et al., 2017).
      
    \tikzmark{t2} \item[2.] Combine the significant advantages provided by the two disciplines of ML and econometrics (H. R. Varian, 2014).
\end{itemize}

\tikzmark{n1} 1. is addressed in the first part of the Dissertation; \\~\\
\tikzmark{n2} 2. is addressed in the second part of the Dissertation;

\begin{tikzpicture}[remember picture,overlay]
        %\path[draw=magenta,thick,->]<3-> ([yshift=3mm]n1) to ++(0,3mm) to [out=0, in=0,distance=2.5in] (t1);
   \path[draw=magenta,thick,->]<3-> ([yshift=3mm]n1) -- (t1);
\end{tikzpicture}

\end{frame}

\end{document} 

我的实际代码根本没有显示任何箭头。是否存在软件包冲突?我做错了什么吗?

谢谢

答案1

这里有几个问题,其中一些与您的问题没有直接关系:

  1. 您不应该在代码中两次加载包(例如tikz),并保持序言有序且干净。在下面的代码中,我删除了与实际问题无关的所有内容。

  2. \clearpage此处不应使用。请使用\bigskip或类似符号来插入垂直空间。

其他问题与您的问题直接相关,即:

  1. 你不能放置任何东西 \item。这总是会导致错误。您可以将 放在包含标签\tikzmark的可选参数内。\item

  2. 使用宏定义的标记可以在以下环境\tikzmark中用 引用。请注意与 的区别。tikzpicturepic cs:<name>\tikzmarknode

可能的解决方案如下:

\documentclass[10pt]{beamer}
\usetheme{metropolis}

\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}

\begin{document}

%%%%%% HERE IS THE FRAME I WOULD LIKE TO BE AS THE IMAGE ABOVE:

\begin{frame}{}
The major current challenges are:
\bigskip

\begin{itemize}
    \item[\tikzmark{t1}1.] Optimize the acquisition costs (time and money) of big data to create novel opportunities for academics (Sivarajah et al., 2017).
    \item[\tikzmark{t2}2.] Combine the significant advantages provided by the two disciplines of ML and econometrics (H. R. Varian, 2014).
\end{itemize}

\tikzmark{n1}1. is addressed in the first part of the Dissertation; \\~\\
\tikzmark{n2}2. is addressed in the second part of the Dissertation;

\begin{tikzpicture}[remember picture,overlay]
    \path[draw=magenta,thick,->]<3-> ([xshift=-2pt]pic cs:t1) to[bend right] ([xshift=-2pt, yshift=1ex]pic cs:n1);
    \path[draw=magenta,thick,->]<3-> ([xshift=-2pt]pic cs:t2) to[bend right] ([xshift=-2pt, yshift=1ex]pic cs:n2);
\end{tikzpicture}

\end{frame}

\end{document} 

在此处输入图片描述

答案2

谢谢贾斯珀·哈比希特为了简化的MWE

这是一个使用enumerate及其可选参数的自动解决方案(并通过\automarkenumi宏添加具有当前值的 tikzmark enumi)。

\documentclass[10pt]{beamer}
\usetheme{metropolis}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}

\def\automarkenumi#1{\tikzmark{#1\theenumi}}

\begin{document}

\begin{frame}{}
The major current challenges are:
\bigskip

\begin{enumerate}[\automarkenumi{t}1.]
    \item Optimize the acquisition costs (time and money) of big data to create novel opportunities for academics (Sivarajah et al., 2017).
    \item Combine the significant advantages provided by the two disciplines of ML and econometrics (H. R. Varian, 2014).
\end{enumerate}

\begin{enumerate}[\automarkenumi{n}a.]
\item is addressed in the first part of the Dissertation;
\item is addressed in the second part of the Dissertation;
\end{enumerate}

\begin{tikzpicture}[remember picture,overlay]
    \path[draw=magenta,thick,->]<1-> ([xshift=-2pt]pic cs:t1) to[bend right] ([xshift=-2pt, yshift=1ex]pic cs:na);
    \path[draw=magenta,thick,->]<1-> ([xshift=-2pt]pic cs:t2) to[bend right] ([xshift=-2pt, yshift=1ex]pic cs:nb);
\end{tikzpicture}

\end{frame}

\end{document} 

在此处输入图片描述

相关内容