I'm currently working on building a new class file based on an old one which is my university thesis class. And I am totally new user for such a work.
Here is the code in the old file named "muthesis09.cls"
Code: Select all
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{muthesis09}[2010/04/24 v0.91 Mahidol University thesis class]
\LoadClass[12pt,a4paper]{report}
\RequirePackage{times}
\RequirePackage{ifthen}
\newboolean{@natbibmode}\setboolean{@natbibmode}{false}
\DeclareOption{natbib}{%
\setboolean{@natbibmode}{true}%
}
\ProcessOptions\relax
\if@natbibmode
\RequirePackage{natbib}% this cannot go inside \DeclareOption argument
\bibpunct{(}{)}{;}{a}{}{,}%
\else
\fi
@natbibmode
, execute, then ask if it is a require package; at last, changing the way of producing the bibliography using a natbib package command \bibpunct
.Now suppose there is a "new way" to achieve the aiming work as listed above---my own code:
Code: Select all
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{muthesis15}[2015/03/09 My custom muthesis]
% below are some packages needed to use:
% package IFTHEN for coding this cls file
\RequirePackage{ifthen}
\DeclareOption{natbibmode}
{\newboolean{natbibmode}%
\setboolean{natbibmode}{true}}
\ifthenelse
{\boolean{natbibmode}}
{
\RequirePackage{{natbib}
\bibpunct{(}{)}{;}{a}{}{,}
}
{}
% package NATBIB for using the bibliography enviroment more effective
\PassOptionToClass{report}
% the typesetting thesis will made use of: 12pt (font size), A4 paper;
% and natbib for the bibliography (references)
\LoadClass[12pt,a4paper]{report}
- Why in the old code the author need to set the false value boolean to
@natbibmode
? Why didn't he just creat it and then set the value to be true later in the\DeclareOption
command? Alternative, why didn't he set it to be true at the time he created that boolean? - From the above questions, I have my own code. Is it right?
- What is the difference between
\ExecuteOptions
and\ProcessOptions
commands? Do I need any of them in the above code? - (Side question) Do I need to include the special character @ at the very begining of each command or counter convention name? The reason of this question is, in the file muthesis09, the author then put @ in names of every counter and every command name that made used(!!!), and his action make me headache to classify which one is LaTeX primitive (or TeX primitive) and which one is his code