2

I am trying to create a .cls file for use by multiple users for generating \documentclass{article} documents. Inside this class, I want a macro/script to be able to automatically generate a signature line for every entry in the \author{} field. I know \@author contains the information; how do I read the size of \@author to know how many lines to create (or is this the wrong path to be going down)?

EDIT:

Upon further review of TEX.SX questions, I learned where \and was defined and consequently how redefining \and could include the \vspace and \rule for additional authors. My successful solution is listed below.

MWE:

\documentclass{newclass}

\author{Neil Armstrong\\Commander
       \and
        Buzz Aldrin\\Lunar Module Pilot
       \and
        Michael Collins\\Command Module Pilot}

\begin{document}
\end{document}

using newclass.cls

\ProvidesClass{newclass}
\LoadClass{article}

\def\and{%                  % \begin{tabular}
  \end{tabular}%
  \vspace{2ex}\\
  and\\
  \vspace{0.5in}
  \rule{4cm}{0.4pt}\\
  \begin{tabular}[t]{c}}%   % \end{tabular}
Fox
  • 21
  • Ho are you adding the and\\ and the spaces? Can't you just append the code for the rule? – Johannes_B Aug 19 '16 at 06:36
  • You are correct. After posting this question, I stumbled on other "too many authors on one line" topics and realized I could redefine the \and parameter within \author to include the new lines and \rule. I need to edit this subject\question, as I am now curious if I can include the \def\and in the .cls file rather than the .tex file's preamble. – Fox Aug 19 '16 at 15:31
  • You just wrote in your edit, that you were succesful. Can you add your solution as an answer to the question below? It helps keeping the place tidy. – Johannes_B Aug 19 '16 at 16:03
  • I would use \par between the different parts to avoid warnings about underful boxes. – Johannes_B Aug 19 '16 at 16:05
  • @Johannes_B, understood, I will add it as answer; for your \par comment, can you expand? Are you saying replace the \vspace instances? Currently, I do not have underfill errors (but I have only ranged between 1-5 signature lines). – Fox Aug 19 '16 at 16:21
  • The title is typeset centered. You can forget my comment, it doesn't matter. Sorry for the confusiion. – Johannes_B Aug 19 '16 at 16:42
  • Idea: print the \author in white text colour and underline it with another colour, see e.g. http://tex.stackexchange.com/questions/57070/how-to-color-over-underline-or-other-ways-to-highlight-substituted-expressions. This should give you lines corresponding to the author content. – samcarter_is_at_topanswers.xyz Aug 19 '16 at 16:55

1 Answers1

1

Upon further review of TEX.SX questions, I learned where \and was defined and consequently how redefining \and could include the \vspace and \rule for additional authors. My successful solution is listed below.

MWE:

\documentclass{newclass}

\author{Neil Armstrong\\Commander
       \and
        Buzz Aldrin\\Lunar Module Pilot
       \and
        Michael Collins\\Command Module Pilot}

\begin{document}
\end{document}

using newclass.cls

\ProvidesClass{newclass}
\LoadClass{article}

\def\and{%                  % \begin{tabular}
\end{tabular}%
\vspace{2ex}\\
and\\
\vspace{0.5in}
\rule{4cm}{0.4pt}\\
\begin{tabular}[t]{c}}%   % \end{tabular}
  • It's fine to answer your own question, but as this is the answer I'd delete it from the question:) –  Aug 23 '16 at 04:07