我希望能够将东西放在此图形白色区域的顶部 - 浅灰色条下方,即“框架”字幕文本,但要接触它。最大限度地利用白色区域。有没有办法从textheight
或frameheight
或其他一些变量中确定这一点?我尝试定义一个新\bodyheight
变量,但没有成功。
上面的图形是使用这个 MWE 制作的
\documentclass[presentation, smaller, compress, aspectratio=169]{beamer}
\usetheme{Frankfurt}
\usecolortheme{seagull}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{}
\setbeamertemplate{frametitle}{%
\nointerlineskip
\begin{beamercolorbox}[sep=0.1cm,wd=\paperwidth,leftskip=.2cm,rightskip=0cm]{frametitle}%
\usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle
\end{beamercolorbox}%
}
\usepackage{graphicx}
\usepackage{tikz}
\newcommand{\bodyheight}{\textheight - \footskip}
\begin{document}
\section{Section}
\begin{frame}{Frame}
\begin{tikzpicture}[remember picture,overlay,shift=(current page.south west)]
\draw[help lines,line width=1pt,step=1,black!50] (0,0) grid (20,\bodyheight);
\end{tikzpicture}
\end{frame}
\end{document}
答案1
您可以使用tikzpage节点包。它提供了各种节点,例如current page text area
。例如,使用它从 到 画一条线(current page text area.north west)
几乎(current page text area.north east)
可以得到你想要的:
为了完整性,下面是代码:
\documentclass[presentation, smaller, compress, aspectratio=169]{beamer}
\usetheme{Frankfurt}
\usecolortheme{seagull}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{}
\setbeamertemplate{frametitle}{%
\nointerlineskip
\begin{beamercolorbox}[sep=0.1cm,wd=\paperwidth,leftskip=.2cm,rightskip=0cm]{frametitle}%
\usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle
\end{beamercolorbox}%
}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\newcommand{\bodyheight}{\textheight - \footskip}
\begin{document}
\section{Section}
\begin{frame}{Frame}
\begin{tikzpicture}[remember picture,overlay,shift=(current page.south west)]
\draw[help lines,line width=1pt,step=1,black!50] (0,0) grid (20,\bodyheight);
\draw[blue, thick](current page text area.north west)--(current page text area.north east);
\end{tikzpicture}
\end{frame}
\end{document}
编辑 评论中说:
我正在寻找“Frame”下方的行,而不是“Frame”上方的行。
使用要点tikzpage节点从页面顶部到框架顶部并不难。例如,我们可以得到:
使用
\documentclass[presentation, smaller, compress, aspectratio=169]{beamer}
\usetheme{Frankfurt}
\usecolortheme{seagull}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{}
\setbeamertemplate{frametitle}{%
\nointerlineskip
\begin{beamercolorbox}[sep=0.1cm,wd=\paperwidth,leftskip=.2cm,rightskip=0cm]{frametitle}%
\usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle
\end{beamercolorbox}%
}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\newcommand{\bodyheight}{\textheight - \footskip}
\begin{document}
\section{Section}
\begin{frame}{Frame}
\begin{tikzpicture}[remember picture,overlay,shift=(current page.south west)]
\draw[help lines,line width=1pt,step=1,black!50] (0,0) grid (20,\bodyheight);
\draw[blue, thick]([yshift=-4ex]current page text area.north west)--([yshift=-4ex]current page text area.north east);
\end{tikzpicture}
\end{frame}
\end{document}