I am trying to write a document class highschool.cls
for the high school research papers in our school based on the book.cls
in order to make the format of the papers standardized. I am trying to define a signature page with heading “CERTIFICATION'' such that the following text appears on the page.
To achieve this, I made the following definitions on LaTeX class highschool.cls
.
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{highschool}
[2012/08/22 v0.1e
Standard LaTeX document class]
\newcommand\@ptsize{}
\newif\if@surnamea \@surnameafalse
\newif\if@surnameb \@surnamebfalse
\newif\if@surnamec \@surnamecfalse
\newif\if@firstnamea \@firstnameafalse
\newif\if@firstnameb \@firstnamebfalse
\newif\if@firstnamec \@firstnamecfalse
\newif\if@midinitiala \@midinitialafalse
\newif\if@midinitialb \@midinitialbfalse
\newif\if@midinitialc \@midinitialcfalse
\setlength\paperheight {11in}%
\setlength\paperwidth {8.5in}%
\setlength\textwidth {6in}%
\def\defenseDate#1{\gdef\@defensedate{#1}}
\def\surnamea#1{\gdef\@surnamea{#1}}
\def\firstnamea#1{\gdef\@firstnamea{#1}}
\def\midinitiala#1{\gdef\@midinitiala{#1}}
\def\surnameb#1{\gdef\@surnameb{#1}}
\def\firstnameb#1{\gdef\@firstnameb{#1}}
\def\midinitialb#1{\gdef\@midinitialb{#1}}
\def\surnamec#1{\gdef\@surnamec{#1}}
\def\firstnamec#1{\gdef\@firstnamec{#1}}
\def\midinitialc#1{\gdef\@midinitialc{#1}}
\if@compatibility
\renewcommand\@ptsize{0}
\else \DeclareOption{10pt}{\renewcommand\@ptsize{0}} \fi
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
\ExecuteOptions{12pt,oneside,final,openright}
\ProcessOptions
\input{bk1\@ptsize.clo}
\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{``{\uppercase\expandafter{\@title}}''} and submitted by
\textbf{\uppercase\expandafter{\@firstnamea} \uppercase\expandafter{\@midinitiala}. \uppercase\expandafter{\@surnamea}}, \textbf{\uppercase\expandafter{\@firstnameb} \uppercase\expandafter{\@midinitialb}. \uppercase\expandafter{\@surnameb}}, and \textbf{\uppercase\expandafter{\@firstnamec} \uppercase\expandafter{\@midinitialc}. \uppercase\expandafter{\@surnamec}}
to fulfill part of the requirements for
the course Science and Technology Research II was successfully
defended and approved on \expandafter{\@defensedate}.
}%% signature page
\def\prelim{%%prelim page
\typeout{Making SMCT preliminary headings...}%
\pagestyle{plain}
\pagenumbering{roman}
\signaturep \newpage
\baselineskip=20pt
} %%prelim
\endinput
In my source TeX file, I would type something like
\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}
What I want to achieve is that
- when there are no
\surnameb,\firstnameb,\midinitialb,\surnamec,\firstnamec,
and\midinitialc
declared, I get the following text:
- when there are no
\surnamec,\firstnamec,
and\midinitialc
declared, I get the following text:
- and when all are declared, I get the text:
Is it possible to do this? If it is, how do I do it?
Best Answer
The following solution is based on these assumptions:
You can only have
and not, for example
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:
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
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.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).