
我有一個擴展 AMS 文章類的乳膠類amsart
。我調整了邊距,並想添加一些新的序言樣式參數\author{Name}
,例如\class{Algebra}
。這樣做之後,我希望作者姓名、班級、日期和標題在\maketitle
調用時顯示如下。請注意,如果未提供其中之一,我希望導致缺少該字段並且不是一場車禍。例如,如果序言沒有,\class{...}
則文件中應該只有學生姓名和日期。如果未提供學生姓名、班級名稱和日期,則文件應以居中標題開頭。
Student Name
Algebra
Decembruary 3, 1947
Centred Title
.
.
.
這是我整理的,
% this handles the info tags at the beginning
\makeatletter
% defining new variables
\gdef\@class{\empty}
\def\author#1{\gdef\@author{#1\\}}
\def\class#1{\gdef\@class{#1\\}}
\renewcommand{\maketitle} {
\bgroup
\setlength{\parindent}{0em}
\begin{flushleft}
\ifx\@author\empty \else \@author\fi
\ifx\@class\empty \else \@class\fi
\@date
\end{flushleft}
\egroup
\begin{center}
\textbf{\@title} \\
\end{center}
\bigskip
}
\makeatother
老實說,我不知道這段程式碼是如何或為什麼工作的,因為我從某些東西開始,然後進行反覆試驗,直到有些東西起作用為止。這就是為什麼,我有理由相信這可能不是實現我想要的最乾淨或最好的方式。真正了解乳膠程式設計的人可以看一下,也許可以告訴我如何更好地寫這個或我擁有的東西已經足夠好了嗎?