
我有以下 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
。第一幀使上部塊相對於下部塊居中。
第二框架將上部塊相對於框架居中。