I would like to know how the \maketitle command works since I am creating my own class and I want to use my own commands. For example, I already create certain commands like \a, \b and \c and I want that with a certain command we say \printabc a new page is created printing such commands.
Thanks in advance
EDIT 1: I try to define
\def\@mycover{% \newpage\null } but get the error
! Use of \@ doesn't match its definition.
EDIT 2: I have made progress.
\documentclass{myclass} \makeatletter \newcommand*{\mytitle}[1]{\gdef\@mytitle{\MakeUppercase{#1}}} \newcommand*{\myauthors}[5]{\gdef\@myauthors{ \begin{tabular}{c} \MakeUppercase{#1} \\ \MakeUppercase{#2} \\ \MakeUppercase{#3} \\ \MakeUppercase{#4} \\ \MakeUppercase{#5} \end{tabular} }} \newcommand*{\myafil}[5]{\gdef\@myafil{ \begin{tabular}{c} \MakeUppercase{#1} \\ \MakeUppercase{#2} \\ \MakeUppercase{#3} \\ \MakeUppercase{#4} \\ \MakeUppercase{#5} \end{tabular} }} \newcommand\makecover{\begin{titlepage}% \thispagestyle{empty}\centering\bfseries \@mytitle \vfill \@myauthors \vfill \@myafil \end{titlepage} \global\let\makecover\relax \global\let\@mytitle\@empty \global\let\@myauthors\@empty \global\let\@myafil\@empty \global\let\mytitle\relax \global\let\myauthors\relax \global\let\myafil\relax } \makeatother \mytitle{The Title} \myauthors{Author 1}{}{}{}{} \myafil{University}{Faculty of exact and natural sciences}{Department of Mathematics}{City}{Year} \begin{document} \makecover \end{document} This is all right, but when I comment for example
%\myauthors{Author 1}{}{}{}{}
the following error arises
! Undefined control sequence.
something that does not happen in class book. why does that happen?
\authorcommand does\gdef\@author{<Something>}, then\maketitlecontains\@author, which will print<Something>. I suggest looking at LaTeX's base classes for some guidance: tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/base/…@in their name you have to say\makeatletterbefore. See What do \makeatletter and \makeatother do?\newcommand, but before it. But if you are writing a class in a.clsfile the\makeatletterthingy should already be active. If you are testing outside the.clsfile then yes, you need the\makeatletter.\maketitlecommand is what the user will use. The\@maketitleis an implementation detail. It could be called (non intuitively)\@potato:P But in this case, the\@maketitleholds the actual formatting of the title and is called differently by\maketitlein case thetwocolumnoption is used.\myauthorscommand then the\@myauthorsmacro will never be defined, then TeX will complain that is isUndefined. You can add\def\@myauthors{}in your class file so you are sure that the macro exists. Or you can use the same approach as LaTeX and do\def\@myauthors{\@latex@warning@no@line{No \noexpand\myauthor given}}. Off-topic: I would go for a comma separated list of authors instead of{}{}{}{}{}...