TikZブロックを2つの子ブロックの中央に配置する

TikZブロックを2つの子ブロックの中央に配置する

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}

上のボックスを水平方向に中央揃えにしたいと思います。また、スライドの左端から左のボックスまでの距離は、スライドの右端から右のボックスまでの距離と同じである必要があります。2 つの方法を試しましたが、どちらもうまくいきませんでした。

ムウェ

答え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。最初のフレームは、上のブロックを下のブロックに対して中央に配置します。

ブロックに対して中心に置かれたノード

2 番目のフレームは、上部のブロックをフレームに対して中央に配置します。

フレームに対して中央に配置されたノード

関連情報