如何将项目推送到 Beamer 中的幻灯片开头?

如何将项目推送到 Beamer 中的幻灯片开头?

我有一张幻灯片,上面有一些项目,下面有一个图形,定义为tikzpicture,我想将一些箭头从项目指向图形。问题是,现在图形和项目都从幻灯片的中心开始,基本上图形位于项目的顶部。有什么想法可以解决这个问题吗?

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,tikzmark}

\begin{document}

\begin{frame}{Test}
\begin{itemize}
\item Item 1 \tikzmark{a}
\item Item 2 \tikzmark{b}
\item Item 3 \tikzmark{c}
\item Item 4
\end{itemize}
\centering
\begin{tikzpicture}[remember picture,overlay]
    \node {\includegraphics[width=0.8\textwidth]{my-picture}};
    \foreach \i/\j in {(0.5,0.66)/a} \draw [cyan,->] ({pic cs:\j}) -- \i;
\end{tikzpicture}
\end{frame}

\end{document}

最终的布局看起来应如下图所示:

在此处输入图片描述

答案1

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,tikzmark}

\begin{document}

\begin{frame}[t]{Test}
\begin{itemize}
\item Item 1 \tikzmark{a}
\item Item 2 \tikzmark{b}
\item Item 3 \tikzmark{c}
\item Item 4
\end{itemize}

\centering
\begin{tikzpicture}[remember picture,overlay, yshift=-2cm]
    \node {\includegraphics[width=0.5\textwidth]{example-image}};
    \foreach \i/\j in {(0.5,0.66)/a} \draw [cyan,->] ({pic cs:\j}) -- \i;
\end{tikzpicture}
\end{frame}

\end{document}

在此处输入图片描述

答案2

使用表格环境将解决这个问题:

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,tikzmark}

\begin{document}

\begin{frame}{Test - column}
    \begin{columns}[t]
        \begin{column}{.4\textwidth}
            \begin{itemize}
                \item Item 1 \tikzmark{a}
                \item Item 2 \tikzmark{b}
                \item Item 3 \tikzmark{c}
                \item Item 4
            \end{itemize}

        \end{column}
        \begin{column}{.6\textwidth}
            \centering
            \begin{tikzpicture}[remember picture,overlay]
            \node {\includegraphics[width=0.8\textwidth]{example-image}};
            \foreach \i/\j in {(0.5,0.66)/a} \draw [cyan,->] ({pic cs:\j}) -- \i;
            \end{tikzpicture}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}{Test - tabular}
    \begin{tabular}{lc}
        \parbox{.4\textwidth}{
            \begin{itemize}
                \item Item 1 \tikzmark{a}
                \item Item 2 \tikzmark{b}
                \item Item 3 \tikzmark{c}
                \item Item 4
            \end{itemize}

        }
        \parbox{.6\textwidth}{
            \centering
            \begin{tikzpicture}[remember picture,overlay]
            \node {\includegraphics[width=0.8\textwidth]{example-image}};
            \foreach \i/\j in {(0.5,0.66)/a} \draw [cyan,->] ({pic cs:\j}) -- \i;
            \end{tikzpicture}
        }
    \end{tabular}
\end{frame}
\end{document}

在此处输入图片描述

答案3

[t]通过使用和解决了该问题at(...,...)

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning,tikzmark}

\begin{document}

\begin{frame}[t]{Test}
\begin{itemize}
\item Item 1 \tikzmark{a}
\item Item 2 \tikzmark{b}
\item Item 3 \tikzmark{c}
\item Item 4
\end{itemize}
\centering
\begin{tikzpicture}[remember picture,overlay]
    \node at(1.5,-2) {\includegraphics[width=0.8\textwidth]{my-picture}};
    \foreach \i/\j in {(0.5,0.66)/a} \draw [cyan,->] ({pic cs:\j}) -- \i;
\end{tikzpicture}
\end{frame}

\end{document}

相关内容