我正在编写 Beamer 演示文稿,但无法找到一种方法来将各种框内文本关联到一页内的图表中。我尝试使用列环境,但我的解决方案在我看来太幼稚了:
1)箭头对于我的目的来说太短了;
2)对齐取决于文本的长度,并且只能通过仔细调整空格跳跃才能获得;
3)我看不出最终能添加诸如对角箭头之类的更复杂功能的方法;
tikz 方法可能会更有效率。
\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetheme{Boadilla}
\usepackage[overlay]{textpos}
\begin{frame}{Title here}
\begin{columns}[t]
\column{0.25\textwidth}
\centering
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\vspace{1.7cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\column{0.30\textwidth}
\center
$\overset{\mathrm{long text here}}{\longrightarrow}$
\vspace{1.7cm}
$\overset{\mathrm{long text here}}{\longleftrightarrow}$
\column{0.25\textwidth}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\vspace{1.7cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{columns}
\end{frame}
答案1
你是对的,用tikz
更简单的方法来绘制你的关系:
\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetheme{Boadilla}
\usepackage[overlay]{textpos}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, shadows}
\begin{document}
\begin{frame}
\frametitle{Title here}
\begin{center}
\begin{tikzpicture}[
node distance = 11mm and 44mm,
block/.style = {rectangle, rounded corners, fill=gray!30,
text width=0.24\linewidth, align=left,
drop shadow},
LA/.style = {-Straight Barb, semithick, % LA: left arrow
shorten >=3mm, shorten <=3mm},
LRA/.style = {Straight Barb-Straight Barb, semithick, % LRA: left right arrow
shorten >=3mm, shorten <=3mm}
]
\node (n1) [block] {Some text with math formulae e.g. $\alpha=f$};
\node (n2) [block,right=of n1] {Some text with math formulae e.g. $\alpha=f$};
\node (n3) [block,below=of n1] {Some text with math formulae e.g. $\alpha=f$};
\node (n4) [block,right=of n3] {Some text with math formulae e.g. $\alpha=f$};
%
\draw[LA] (n1) -- node[above] {long text here} (n2);
\draw[LRA] (n3) -- node[above] {long text here} (n4);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
答案2
只是为了完整性,以防你不想用 Ti 重新发明投影机块钾Z,每次更改外观时都要重新调整。您可以将箭头添加为覆盖层。
\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{Connect/.style={ultra thick,>=latex,shorten >=0.5cm,shorten <=1cm}}
\newcommand{\tikznode}[2]{\tikz[remember picture,baseline=(#1.base),inner
sep=0pt]{\node(#1)[inner sep=0pt]{#2};}}
\usetheme{Boadilla}
\usepackage[overlay]{textpos}
\begin{document}
\begin{frame}{Title here}
\begin{overlayarea}{\textwidth}{8cm}
\begin{columns}[t]
\column{0.25\textwidth}
\centering
\begin{block}{}
\tikznode{1a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{1b}{\strut}
\end{block}
\vspace{1.7cm}
\begin{block}{}
\tikznode{2a}{\strut}
Some text with math formulae e.g.\ $\alpha=f$
\tikznode{2b}{\strut}
\end{block}
\column{0.30\textwidth}
\center
\vspace{1.7cm}
\column{0.25\textwidth}
\begin{block}{}
\tikznode{3a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{3b}{\strut}
\end{block}
\vspace{1.7cm}
\begin{block}{}
\tikznode{4a}{\strut}Some text with math formulae e.g.\ $\alpha=f$\tikznode{4b}{\strut}
\end{block}
\end{columns}%
\begin{tikzpicture}[overlay,remember picture]
\draw[Connect,->] ($(1a-|1b)!0.5!(1b)$) -- ($(3a)!0.5!(3a|-3b)$)
node[pos=0.55,above]{some text here};
\draw[Connect,<->] ($(2a-|2b)!0.5!(2b)$) -- ($(4a)!0.5!(4a|-4b)$)
node[pos=0.55,above]{some other text here};
\end{tikzpicture}
\end{overlayarea}
\end{frame}
\end{document}
我还添加了一个覆盖区域,以防您想暂停。这可以防止幻灯片跳动。
答案3
为什么采用 tikz 方法?
\documentclass[aspectratio=169]{beamer}
\usepackage{lmodern}
\usepackage{amsmath}
\usetheme{Boadilla}
\begin{document}
\begin{frame}{Title here}
\centering
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
$\underrightarrow{\makebox[3cm][r]{long text here}\hspace{3em}}$
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
\vfill
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
$\underleftrightarrow{\makebox[3cm][r]{long text here}\hspace{3em}}$
\begin{minipage}{4cm}
\begin{block}{}
Some text with math formulae e.g. $\alpha=f$
\end{block}
\end{minipage}
\end{frame}
\end{document}