如何知道带有页眉和页脚的投影仪框架中的 tikz 工作区域坐标?

如何知道带有页眉和页脚的投影仪框架中的 tikz 工作区域坐标?

在此例子,稍作修改,“N”的位置已被更正,textheight不会被标题掩盖:

\documentclass[beamer]{beamerswitch}
\usetheme{metropolis}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{frame}\frametitle{My title}
\thispagestyle{empty} 
\begin{tikzpicture}[remember picture,overlay]
  \node[anchor=north] at ($(current page.north)+(0,-0.1\textheight)$) {N};
  \node[anchor=west] at (current page.west) {W};
  \node[anchor=east] at (current page.east) {E};
  \node[anchor=south] at (current page.south) {S};
  \node at (current page.center) {C};
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

  • textheight除了管理 tikz 绘图的框架的不同区域(页眉、页脚、之间)之外,还有其他指标吗?
  • 哪一个特别允许工作之间从 0.0 到 1.0?

答案1

可以tikzmark自动获取frametitle结束的位置:

\documentclass[beamer]{beamerswitch}
\usetheme{metropolis}
\usepackage{tikz}
\usetikzlibrary{calc}

\usetikzlibrary{tikzmark}
\addtobeamertemplate{frametitle}{}{\tikzmark{endframetitle}}

\begin{document}
\begin{frame}\frametitle{My title}
\thispagestyle{empty} 
\begin{tikzpicture}[remember picture,overlay]
  \node at (pic cs:endframetitle) {N};
  \node[anchor=west] at (current page.west) {W};
  \node[anchor=east] at (current page.east) {E};
  \node[anchor=south] at (current page.south) {S};
  \node at (current page.center) {C};
\end{tikzpicture}
\end{frame}

\end{document}

编辑:

\documentclass[beamer]{beamerswitch}
\usetheme{metropolis}
\usepackage{tikz}
\usetikzlibrary{calc}

\usetikzlibrary{tikzmark}
\addtobeamertemplate{frametitle}{}{\tikzmark{endframetitle}}

\begin{document}
\begin{frame}\frametitle{My title}
\thispagestyle{empty} 
\begin{tikzpicture}[remember picture,overlay]
  \node  at (pic cs:endframetitle) {N};
  \node[anchor=west] at (current page.west) {W};
  \node[anchor=east] at (current page.east) {E};
  \node[anchor=south] at (current page.south) {S};
  \node at (current page.center) {C};
  \fill[red] let \p1 = (pic cs:endframetitle),
                 \p2 = (current page.center) in
                    (\x2,\y1) circle (0.1);
\end{tikzpicture}
\end{frame}

\end{document}

相关内容