我想创建beamer
幻灯片,但我经常需要使用命令更改框架的边距(感谢萨姆卡特提供原始代码)
% Page wide frame
\makeatletter
\def\Gm@lmargin{\widthTextMarginLeftPageWide}%
\def\Gm@rmargin{\widthTextMarginRightPageWide}%
\textwidth=\dimexpr\paperwidth-\Gm@lmargin-\Gm@rmargin\relax
\hsize\textwidth
\columnwidth\textwidth
\hoffset=\dimexpr-\beamer@leftsidebar+\Gm@lmargin-\widthTextMarginLeftPageWide\relax
\makeatother
我尝试以更短的形式存储它,如下所示
\newcommand{\framePageWide}{<the code above>}
但我收到错误“@\Gm 与其定义不匹配”
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\useoutertheme{split}
\useinnertheme{inmargin}
\newlength{\widthTextMarginLeftPageWide}
\setlength{\widthTextMarginLeftPageWide}{5mm}
\newlength{\widthTextMarginRightPageWide}
\setlength{\widthTextMarginRightPageWide}{5mm}
\newcommand{\framePageWide}{}
\begin{document}
{
% Page wide frame
\makeatletter
\def\Gm@lmargin{\widthTextMarginLeftPageWide}%
\def\Gm@rmargin{\widthTextMarginRightPageWide}%
\textwidth=\dimexpr\paperwidth-\Gm@lmargin-\Gm@rmargin\relax
\hsize\textwidth
\columnwidth\textwidth
\hoffset=\dimexpr-\beamer@leftsidebar+\Gm@lmargin-\widthTextMarginLeftPageWide\relax
\makeatother
\begin{frame}
\frametitle{Minipages in beamer}
\rule{\textwidth}{1pt}
\begin{columns}[T,onlytextwidth]
\column{0.45\textwidth}
\rule{\textwidth}{1pt}
\column{0.45\textwidth}
\rule{\textwidth}{1pt}
\end{columns}
\end{frame}
}
\end{document}
答案1
正如我在原始评论中指出的那样,\makeatletter
和\makeatother
围绕着实际定义,而不是围绕着定义的内容。也就是说,
是的:
\makeatletter\newcommand\framePageWide{...}\makeatother
不:
\newcommand\framePageWide{\makeatletter...\makeatother}
数学家协会
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\useoutertheme{split}
\useinnertheme{inmargin}
\newlength{\widthTextMarginLeftPageWide}
\setlength{\widthTextMarginLeftPageWide}{5mm}
\newlength{\widthTextMarginRightPageWide}
\setlength{\widthTextMarginRightPageWide}{5mm}
\makeatletter
\newcommand{\framePageWide}{%
\def\Gm@lmargin{\widthTextMarginLeftPageWide}%
\def\Gm@rmargin{\widthTextMarginRightPageWide}%
\textwidth=\dimexpr\paperwidth-\Gm@lmargin-\Gm@rmargin\relax
\hsize\textwidth\relax
\columnwidth\textwidth\relax
\hoffset=\dimexpr-\beamer@leftsidebar+\Gm@lmargin-\widthTextMarginLeftPageWide\relax
}
\makeatother
\begin{document}
{\framePageWide
% Page wide frame
\begin{frame}
\frametitle{Minipages in beamer}
\rule{\textwidth}{1pt}
\begin{columns}[T,onlytextwidth]
\column{0.45\textwidth}
\rule{\textwidth}{1pt}
\column{0.45\textwidth}
\rule{\textwidth}{1pt}
\end{columns}
\end{frame}
}
\end{document}
如果没有\framePageWide
,就会得到