Расположение блока TikZ по центру над двумя дочерними блоками

Расположение блока TikZ по центру над двумя дочерними блоками

У меня есть следующие MWE слайдера Beamer:

\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. Первый кадр центрирует верхний блок относительно нижних блоков.

центрированный узел относительно блоков

Вторая рама центрирует верхний блок относительно рамы.

центрированный узел относительно рамы

Связанный контент