\begin{titlepage} 在新命令中

\begin{titlepage} 在新命令中

我想要创建一个具有给定样式模板(称为template.cls)的通用文档,并且对于标题页,我希望人们只写下标题,其他所有内容都应该在模板中。

我想做的是:

\newcommand{pagegarde}[1]{%
\begin{titlepage}
\begin{tikzpicture}[remember picture,overlay]
\node[above=4.79cm] (entete) at (current page.center) {\includegraphics{entete.jpg}};
\node[below=2cm,text width=15cm] (departement) at (entete.260) {\huge \bfseries \color{red}{Direction...  \\[0.4cm] Département...}};
\node[below=3cm,text width=15cm] (titre) at (departement.south) {\Huge \bfseries \begin{spacing}{1.15} \color{red}{#1} \end{spacing}};
\node[above=1.5cm,right=2cm] at (current page.south west) {\Large \color{red}{\today}}; 
\end{tikzpicture}
\end{titlepage}
}

我将这个命令包含到我的模板中。

但是当我运行代码时,Latex 不喜欢这种\newcommand。我猜是因为\begin{titlepage}里面有一个 。最初,我在主文档中有此代码(没有 then \newcommand),并且它运行正常。

有什么建议可以做我想做的事吗?

相关内容