# How to make a new command similar to \author

I'm preparing a new template for our students' projects based on memoir. All this projects are supervised (directed) by one or more professors so I would like to declare a command like \author but called \director.

This way the student can declare \director{My professor} and the template will place and format the name.

I would like to be like \author and not just a simple \newcommand because it can include affiliation, several names, etc.

I don't know where is \author declared, where should I look?

-
Be specific over the placement of the new \director location. It's easy to find where \author is defined/declared (in memoir.cls) –  Werner Jun 4 '12 at 15:53
How about \let\author\director? This will make the command \director inherit/receive all properties of the \author command -- how ever the latter command is set up. –  Mico Jun 4 '12 at 16:53
then \director{foo} will overwrite the author setting. –  Herbert Jun 4 '12 at 17:03
@Werner Previous to my question I looked for \author and \@author definitions in memoir.cls. \author appears in lines 2493 and 2525 but there is no definition there. And \@author is used in \maketitle (lines 2449-2465). Looking there more carefully I've understood how to declare and insert a \director command into \maketitle. –  Ignasi Jun 4 '12 at 17:16

As mentioned, \author and \@author are defined in latex.ltx, but memoir adds some extra flair to them (for example, allowing multiple authors via \and and properly setting them). The following minimal example adds \director to the mix:

\documentclass{memoir}% http://ctan.org/pkg/memoir
\makeatletter
\newcommand{\director}[1]{\gdef\@director{#1}}%
\newcommand{\@director}{\@latex@warning@no@line{No \noexpand\director given}}
\begingroup\let\footnote\@gobble}{%
\begingroup
\renewcommand{\thanks}[1]{}
\renewcommand{\and}{\unskip, }
\renewcommand{\andnext}{\unskip, }
\renewcommand{\thanksmark}[1]{}
\renewcommand{\thanksgap}[1]{}
\protected@xdef\thedirector{#1}
\endgroup\endgroup}
\newcommand{\predirector}[1]{\def\@bspredirector{#1}}
\newcommand{\postdirector}[1]{\def\@bspostdirector{#1}}
\renewcommand{\maketitlehookc}{%
{\@bspredirector \@director \@bspostdirector}%
}
\predirector{\begin{center}
\large \lineskip .5em%
\begin{tabular}[t]{c}}
\postdirector{\end{tabular}\par\end{center}}
\makeatother
\title{A Title}
\author{An Author \and Another Author}
\director{My Director \and My other Director}
\date{\today}
\begin{document}
\maketitle
\end{document}


The process is a duplication of the components of \author and inserts the \director below the \author inside \@maketitle using the hooks provided. That is, \@maketitle has a hook:

• \maketitlehooka before \title;
• \maketitlehookb before \author;
• \maketitlehookc before \date; and
• \maketitlehookd after \date.

I've redefined \maketitlehookc to now be/contain \director and it is formatted in the same way \author is (centered and \large).

-
Can this be used in an article? How? I tried to change memoir with article but it won't work. –  71GA Sep 30 '13 at 9:36

author is defined in latex.ltx

\def\author#1{\gdef\@author{#1}}
\def\@author{\@latex@warning@no@line{No \noexpand\author given}}


you can load the file under Linux with

gedit kpsewhich latex.ltx


However, memoir has some more definitions of authors. Have a look into the file memoir.cls and search for author. In the title the macro \@author is used and set to \relax after the title.

-