答案1
答案2
根据 samcarters 的回答,我编写了一个新的背景模板lines
。它具有与模板相同的选项grid
。
\documentclass{beamer}
\usepackage{lipsum}
\makeatletter
\usepackage{pgffor}
\newdimen\beamer@bglines@y
\defbeamertemplate{background}{lines}[1][]
{%
\setkeys{beamer@backgroundgrid}{step=0.5cm,color=fg!10!bg}%
\setkeys{beamer@backgroundgrid}{#1}%
\begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{\the\paperheight}
\beamer@bggc
\pgfmathsetmacro{\beamer@bglines@num}{int(\the\paperheight/\beamer@bggw)}
\foreach \y in {0,...,\beamer@bglines@num}{
\pgfmathsetlength{\beamer@bglines@y}{\y*\beamer@bggw}
\pgfpathmoveto{\pgfpoint{0pt}{\the\beamer@bglines@y}}
\pgfpathlineto{\pgfpoint{\the\paperwidth}{\the\beamer@bglines@y}}
}
\pgfusepath{stroke}
\end{pgfpicture}%
}
\makeatother
\setbeamertemplate{background}[lines][step=13.6]
\begin{document}
\begin{frame}
\vspace{-0.2cm}
\lipsum[2]
\end{frame}
\end{document}