我对 Beamer 幻灯片有以下 MWE:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes,calc}
\usetheme{Singapore}
\begin{document}
\begin{frame}
\begin{tikzpicture}[node distance=15mm, >=latex',
block/.style = {draw, rectangle, minimum height=10mm, minimum width=28mm,align=center},]
\node [block] (dose_reduction) {Dose reduction};
\node [block, below left=of dose_reduction] (filtering) {Filtering techniques};
% issues with either of these lines
%\node [block, below right=of dose_reduction] (reconstruction) {Reconstruction techniques};
\node [block, right=of filtering] (reconstruction) {Reconstruction techniques};
\draw[->] (filtering) edge (dose_reduction);
\draw[->] (reconstruction) edge (dose_reduction);
\end{tikzpicture}
\end{frame}
\end{document}
我希望上面的框水平居中。另外,左幻灯片边缘到左框的距离应该与右幻灯片边缘到右框的距离一样大。我尝试了两种方案,但都没有成功。
答案1
最简单的方法可能是将节点below right
和上部节点的below left
锚点放置.south
在相对于下部块的中心位置。
为了使上部块相对于框架居中,最简单的方法可能是先绘制下部块,然后使上部块相对于当前边界框居中。
我还更新了要使用的语法,arrows.meta
而不是弃用的arrows
库。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usetheme{Singapore}
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}[node distance=15mm, >=Latex,
block/.style = {draw, rectangle, minimum height=10mm, minimum width=28mm,align=center},]
\node [block] (dose_reduction) {Dose reduction};
\node [block, below left=of dose_reduction.south] (filtering) {Filtering techniques};
\node [block, below right=of dose_reduction.south] (reconstruction) {Reconstruction techniques};
\draw[->] (filtering) edge (dose_reduction);
\draw[->] (reconstruction) edge (dose_reduction);
\end{tikzpicture}
\end{frame}
\begin{frame}
\centering
\begin{tikzpicture}[node distance=15mm, >=Latex,
block/.style = {draw, rectangle, minimum height=10mm, minimum width=28mm,align=center},]
\node [block] (filtering) {Filtering techniques};
\node [block, right=of filtering] (reconstruction) {Reconstruction techniques};
\node [block, above=of filtering.north -| current bounding box.center] (dose_reduction) {Dose reduction};
\draw[->] (filtering) edge (dose_reduction);
\draw[->] (reconstruction) edge (dose_reduction);
\end{tikzpicture}
\end{frame}
\end{document}
两张幻灯片中的图片均使用 相对于框架居中\centering
。第一张框架将上部块相对于下部块居中。
第二框架使上部块相对于框架居中。