The following solution is based on these assumptions:
You can only have
- Author 1; or
- Author 1, and Author 2; or
- Author 1, Author 2, and Author 3
and not, for example
- Author 1, and Author 3; or
- Author 2, and Author 3; or
- Author 2 only; or
- Author 3 only.
It is sufficient to supply only a first name to distinguish whether an author "exists" or not.
The second condition can be modified, but it seemed logical that one would have a first name and a surname and possibly a middle initial, but never not a first name. Consequently, you can then use the following definitions:
\def\defenseDate#1{\gdef\@defensedate{#1}}
\def\surnamea#1{\gdef\@surnamea{#1}\@surnameatrue}
\def\firstnamea#1{\gdef\@firstnamea{#1}\@firstnameatrue}
\def\midinitiala#1{\gdef\@midinitiala{#1}\@midinitialatrue}
\def\surnameb#1{\gdef\@surnameb{#1}\@surnamebtrue}
\def\firstnameb#1{\gdef\@firstnameb{#1}\@firstnamebtrue}
\def\midinitialb#1{\gdef\@midinitialb{#1}\@midinitialbtrue}
\def\surnamec#1{\gdef\@surnamec{#1}\@surnamectrue}
\def\firstnamec#1{\gdef\@firstnamec{#1}\@firstnamectrue}
\def\midinitialc#1{\gdef\@midinitialc{#1}\@midinitialctrue}
\def\signaturep{ %% signature page..
\topmargin 0in \headsep 0in
\begin{center}
\textbf{CERTIFICATION}\\[6pt]
\end{center}
This is to certify that this research paper entitled,
\textbf{``{\MakeUppercase{\@title}}''} and submitted by
\textbf{\MakeUppercase{\@firstnamea} \MakeUppercase{\@midinitiala}.\ \MakeUppercase{\@surnamea}}%
\if@firstnameb, \if@firstnamec\else and \fi
\textbf{\MakeUppercase{\@firstnameb} \MakeUppercase{\@midinitialb}.\ \MakeUppercase{\@surnameb}}\if@firstnamec, \else\space\fi
\if@firstnamec and \textbf{\MakeUppercase{\@firstnamec} \MakeUppercase{\@midinitialc}.\ \MakeUppercase{\@surnamec}} \fi\else\space\fi
to fulfill part of the requirements for
the course Science and Technology Research II was successfully
defended and approved on \expandafter{\@defensedate}.
}%% signature page
I've added the conditional definitions inside each of the respective author components (this is not really necessary, since only \if@firstnameX
is used) and placed the conditions throughout \signaturep
to include/exclude certain words/phrases/punctuation based on the truth of the conditions.
The input
\documentclass{highschool}
\defenseDate{18 August 2012}
\title{This is the Title of the Paper}
\surnamea{Author}
\firstnamea{First}
\midinitiala{N}
\surnameb{Author}
\firstnameb{Second}
\midinitialb{N}
%\surnamec{Author}
%\firstnamec{Third}
%\midinitialc{N}
\begin{document}
\prelim %% Prints Preliminary chapters
\end{document}
yields
The following minimal example adds an option to specify the list of authors as a single macro \listauthors{{<first>},{<second>},{<third>},...}
using a CSV list.
\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\def\@firstmiddlelast#1,#2,#3\@nil{%
\gdef\@firstname{#1}% Extract first name
\gdef\@middlename{#2}% Extract middle name
\gdef\@lastname{#3}% Extract last name
}
\newcommand{\authorfml}{{\bfseries\MakeUppercase{\@firstname\ \@middlename\unskip\ \@lastname}}}% First Middle Last
\newcommand{\authorlfm}{\@lastname,\ \@firstname\ \@middlename\unskip}% Last, First Middle
\newcommand{\authorseq}{\authorfml}% Default author order
\newcounter{@list@item}\newcounter{@total@item}
\newcommand{\listauthors}[1]{%
\setcounter{@total@item}{0}% Reset total count
\renewcommand*{\do}[1]{\stepcounter{@total@item}}%
\docsvlist{#1}% Count number of items in list
\setcounter{@list@item}{1}% Start at first item
\renewcommand*{\do}[1]{%
\stepcounter{@list@item}% Move to next item
\@firstmiddlelast##1\@nil% Extract first/middle/last names
\authorseq% Print author names
\ifnum\value{@list@item}=\value{@total@item}\relax
, and % Second-to-last name
\else
\ifnum\value{@list@item}<\value{@total@item}\relax
, % First set of names
\fi
\fi
}%
\docsvlist{#1}% Print list
}
\makeatother
\begin{document}
See \listauthors{{First1,Middle1,Last1},{First2,,Last2},{First3,Middle3,Last3},
{First4,Middle4,Last4},{First5,,Last5},{First6,Middle6,Last6},
{First7,Middle7,Last7},{First8,Middle8,Last8},{First9,,Last9}} from first to last. \par
\renewcommand{\authorseq}{\authorlfm}
See \listauthors{{First1,Middle1,Last1},{First2,,Last2},{First3,Middle3,Last3}} from first to last. \par
\end{document}
The definition of \authorseq
determines how the titles are printed. \authorseq
defaults to \authorfml
which prints the author list as <first name>\ <middle name>\unskip\ <last name>
(\unskip
takes care of missing/non-existent <middle name>
in removing the preceding control space \
). Switching around the author display (for use in your abstract and introduction, if needed) is done by a redefinition of \authorseq
, while formatting is controlled within the macros used (\authorfml
or \authorlfm
or whatever).
Best Answer
I will use a general class file that can load the specific class as an option and create a boolean type test for all the different classes. The following is just a first try. It can be enhanced with keyvalues, etc.
Edit 1: Add command
\ClassList
to provide your own class list.It can then be used as follows: