![如何将项目推送到 Beamer 中的幻灯片开头?](https://linux22.com/image/347237/%E5%A6%82%E4%BD%95%E5%B0%86%E9%A1%B9%E7%9B%AE%E6%8E%A8%E9%80%81%E5%88%B0%20Beamer%20%E4%B8%AD%E7%9A%84%E5%B9%BB%E7%81%AF%E7%89%87%E5%BC%80%E5%A4%B4%EF%BC%9F.png)
我有一张幻灯片,上面有一些项目,下面有一个图形,定义为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}