
我希望能夠將東西放置在該圖形中白色區域的頂部 - 在淺灰色條下方,即“框架”副標題文本,但觸摸它。最大限度地利用白色區域。有什麼方法可以從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
您可以使用tikz頁面節點包裹。它提供了各種節點,例如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}
編輯 評論中說:
我正在尋找“框架”下方的行,而不是“框架”上方的行。
使用要點tikz頁面節點問題是從頁面頂部到框架頂部並不難。例如,我們可以得到:
使用
\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}