3

I have a document class for theses which, up until now, only accepted one author name. But now, due to a change in the university's regulation, the document will have to accept more than one author name.

Currently, I am using the standard \author{} command to get the author name . My question is: how can I get the separate author names in order to apply the correct formatting to them? Are there different variable names for each one? I know multiple authors are separated by \and and, after I am able to get each author name, I would like to put them one below the other, in a centered position (just like the example below, but with each additional author name below the previous one).

Here I have the code of my \maketitle command, which is the only one that uses the author names. In the image below, I show the resulting title page.

\renewcommand{\maketitle}{
\clearpage % clears pages just to be sure
\thispagestyle{empty} % this page has no numbering
\begin{center} %text is centered
\textbf{ % and bold
\MakeUppercase{\@institution}\\[\baselineskip] % institution name
\MakeUppercase{\@author} % author name
\vfill
\MakeUppercase{\@title}\ifthenelse{\isundefined{\@subtitle}}{}{:\@subtitle}} % title and optional subtitle
\vfill
\@city\\ % city
\number\year %year
\end{center}
}

Here's an image of how it looks now

Clarifying Update

I believe I wasn't clear before, but now I have additional information regarding the issue. Following the recent answer, I decided to forget about \and and try to separate author names with \\ so they could each go in a separate line, but it seems that \MakeUppercase{} does not allow for line breaks to be inserted inside it. Any advice?

So you see, my issue is not related to the \and command in itself, but rather with a way to break a string in many lines while keeping it in uppercase.

I guess an example of what I'm trying to do, but which is not working, is the following:

\documentclass{report}
\author{Doug \\ Lou}

\begin{document}
\MakeUppercase{\@author}
\end{document}

End result update

Just for posterity, I will add here the end result, after using the chosen solution from this post.

\def\and{\\} % redefine so it is compatible with other classes

\renewcommand{\maketitle}{
\clearpage % clears pages just to be sure
\thispagestyle{empty} % this page has no numbering
\begin{center} %text is centered
\textbf{ % and bold
\MakeUppercase{\@institution}\\[\baselineskip] % institution name
\uppercase\expandafter{\@author} % uppercase author names!!
\vfill
\MakeUppercase{\@title}\ifthenelse{\isundefined{\@subtitle}}{}{:\@subtitle}} % title and optional subtitle
\vfill
\@city % city
\number\year % year
\end{center}
}
  • 2
    For a more specific answer, you would have to include a compilable MWE that recreates your situation. As it is, I cannot make your code snippet work in action, as it has too many user-defined portions. – cslstr May 5 '14 at 18:12
  • @cslstr I just expanded my question based on your answer. – Douglas De Rizzo Meneghetti May 5 '14 at 20:25
1

The report.cls defines the author portion of \maketitle to be a tabular array, that is

{\large   
 \lineskip .75em%
  \begin{tabular}[t]{c}%
    \@author
  \end{tabular}\par}%

The default definition of \and from latex.ltx is used to end the tabular environment, add a bit of horizontal space, and then start a new tabular environment:

\def\and{%                  % \begin{tabular}
  \end{tabular}%
  \hskip 1em \@plus.17fil%
  \begin{tabular}[t]{c}}%   % \end{tabular}

So, when you write \author{First \and Second}, the result is that both names get typeset side-by-side in individual tabular environments. You could just as easily write \author{First \\ Second} to have the two names typeset in a column (that is, in the single centered column of the first tabular environment). The same could be done by redefining \and as \def\and{\\}; only through chance does simply writing \author{First & Second} do the same thing, as the "extra" alignment character, &, is interpreted as \\ automatically.

But this last approach will only work for you if you include something along the lines of the original author portion of \maketitle, that defines the tabular array in your own \maketitle.

Updated from OP Edit:

You can use \uppercase to do the uppercase translation in the following manner. As noted, I suggest you use the entire structure (with tabular) as originally defined in report.cls for the author portion in your own \maketitle. This keeps the original format with \and working, along with the other methods I mention above.

\documentclass{report}
\author{Doug \\ Lou}

\begin{document}

\makeatletter
\begin{center}

% Suggest using the tabular in your \maketitle definition
{\large   
 \lineskip .75em%
  \begin{tabular}[t]{c}%
    \uppercase\expandafter{\@author}
  \end{tabular}\par}%

\end{center}
\makeatother

\end{document}
  • That is very enlightening, but it did not solve my problem, unfortunately. I just expanded my question to see if I could clarify some things. – Douglas De Rizzo Meneghetti May 5 '14 at 20:26
  • @DouglasDeRizzoMeneghetti I have updated my answer. Also note that you must wrap any code using the @ character in \makeatletter ... \makeatother for it to compile correctly. – cslstr May 5 '14 at 20:48
  • That's exact what I needed, that line with \uppercase\expandafter did the trick. Since I will be using this inside a cls file, there is no need to use \makeatletter and \makeatother. I also added \def\and{\\} so that it would be compatible with my class style. Thank you very much. – Douglas De Rizzo Meneghetti May 6 '14 at 1:33
1

Addressing only the matter that's mentioned in the "update" part of your posting: Whenever a macro -- in the present case, \@author -- contains one or more @ ("at") symbols, one has to encase it (the macro) in a pair of \makeatletter and \makeatother directives.

enter image description here

\documentclass{report}
\author{Doug \\ Lou}
\begin{document}
\makeatletter   % new
\noindent       % new, for more consistent formatting
\MakeUppercase{\@author}
\makeatother    % new
\end{document}
  • As I explained above, my plan is to use this code inside a cls file, so I will not need to encase it between \makeatletter and \makeatother. I only did that in the question so I could give the minimal working example. – Douglas De Rizzo Meneghetti May 6 '14 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.