所以,让我向您展示我的问题的 MWE。
\documentclass[serif, aspectratio=169,t]{beamer}
\usepackage[brazil]{babel}
\usepackage[no-math]{fontspec}
\usepackage{euler}
\setmainfont{Calibri}
\usepackage{lipsum}
\newcommand{\rascunhoem}[1]{{\usebackgroundtemplate{\includegraphics[width=\paperwidth, height = \paperheight]{imagens/image.pdf}}\begin{frame}{#1}\end{frame}}}
\newcommand{\questao}[1]{{\usebackgroundtemplate{\includegraphics[width=\paperwidth, height = \paperheight]{imagens/image.pdf}}\begin{frame}[allowframebreaks]#1\end{frame}}\rascunhoem{Rascunho}\rascunhoem{Rascunho}}
\begin{document}
\questao{\lipsum[1-2]\gab{Teste}\lipsum[3-5]}
\end{document}
如果您想测试它,我会在下面的链接中发送一个 PDF 模板图像供您编译:
所以,这就是我一直尝试但未取得多大成功的操作。如您所见,段落\gab{}
之间有一个我尚未定义的命令lipsum
。
我有很多具有这种配置的幻灯片块,其中第一段包含命令\gab{}
(用于其他目的),然后是其后的幻灯片的其余部分。
我想\gab{}
添加一张幻灯片后两张“Rascunho”幻灯片。例如,如果我创建:
\questao{Here's a text example before the command. \gab{This'll be added after the two ``Rascunho'' slides} Here's the text after.
There's no way I can move the command to the end, I have to leave it here, since I have more than ten thousand blocks like this.}
因此,我想This'll be added after the two ``Rascunho'' slides
使用\gab{}
命令在两张“Rascunho”幻灯片之后创建一张带有文本的幻灯片。
再次,我无法更改命令在文本中的位置,也无法更改我呈现的结构。我只想\gab{}
按照我要求的方式构建它。
答案1
您可以\gab
定义另一个宏(此处\@gab
),该宏在代码末尾使用\questao
,例如
\documentclass[serif, aspectratio=169,t]{beamer}
\usepackage[brazil]{babel}
\newcommand{\rascunhoem}[1]{%
\begingroup
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}}%
\begin{frame}
#1
\end{frame}
\endgroup
}
\makeatletter
\newcommand{\questao}[1]{%
\begingroup
\def\@gab{}%
\def\gab##1{\@bsphack\gdef\@gab{##1}\@esphack}%
\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}}%
\begin{frame}[allowframebreaks]
#1
\end{frame}
\rascunhoem{Rascunho}%
\rascunhoem{Rascunho}%
\ifx\@gab\@empty
\def\next{\relax}%
\else
\def\next{\begin{frame}\@gab\end{frame}}
\fi
\next
\endgroup
}
\makeatother
\begin{document}
\questao{Here's a text example before the command. \gab{This'll be added after
the two ``Rascunho'' slides} Here's the text after. There's no way I can move
the command to the end, I have to leave it here, since I have more than ten
thousand blocks like this.}
\end{document}
这不支持\gab
在一次调用中多次出现\questao
。