我想要一张有两列的幻灯片,其中一列是文本,另一列是 tikz 图片。问题是,当我将一列设为 tikz 图片时,它不允许文本从页面顶部开始,而是将文本推到 tikz 图片的水平以下。任何建议都将不胜感激。说明这一点的源代码如下:
\documentclass[10pt]{beamer}
\title{My title is quite short}
\author[My Team]{My Name}
\date{\today}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{My slide title -- What I want}
Both columns start from the top of the page, which is what I want. I
just want one column to be a tikz drawing.
\begin{columns}[t]
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A
\item A
\item A
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item B
\item B
\item B
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\begin{frame}[t]
\frametitle{My slide title -- Not what I want}
The text column begins vertically where the tikz picture ends.
\begin{columns}[t]
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A
\item A
\item A
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\draw (0,-2) circle (1cm);
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
您可以为该选项使用适当的值baseline
;例如current bounding box.north
:
\documentclass[10pt]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{My slide title -- What I want}
Both columns start from the top of the page, which is what I want. I
just want one column to be a tikz drawing.
\begin{columns}[t]
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A
\item A
\item A
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{tikzpicture}[baseline=(current bounding box.north)]
\draw (0,0) circle (1cm);
\draw (0,-2) circle (1cm);
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案2
beamer
提供两种顶部模式:
t
将导致列的第一行对齐。如果t
使用全局选项,则为默认值。T
与选项类似t
,但T
对齐第一行的顶部,而t
对齐第一行的所谓基线。如果使用该t
选项时似乎发生了奇怪的事情(例如,如果图形在使用选项时突然“下降”t
而不是“上升”),请尝试使用此选项。
这里您的示例使用T
而不是t
:
\begin{frame}[t]
\frametitle{My slide title -- Not what I want}
The text column begins vertically where the tikz picture ends.
% T instead of t !!!
\begin{columns}[T]
\begin{column}{0.5\textwidth}
\begin{itemize}
\item A
\item A
\item A
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\draw (0,-2) circle (1cm);
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}
答案3
我有部分解决方案\usepackage{multicol}
。
\begin{multicols}{2}
\begin{itemize}
\item A
\item A
\item A
\vfill
\end{itemize}
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\draw (0,-2) circle (1cm);
\end{tikzpicture}
\end{multicols}