[texhax] Making a class

GrdScarabe grdscarabe at grdscarabe.net
Sun Sep 4 22:46:36 CEST 2005


Hi everybody...

I'm trying to write a LaTeX class for my classes exercises...and also 
and above all for fun !
I've read LaTeX2e for class and package writers and I tried to apply 
their tips, but my class (very simple one) still doesn't work !

Perhaps you can help me with this ?

---------------------------------

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{exercises}[2005/09/01 v1.0]

%% Fonts needed commands
%\newcommand  {\tiny}         {\fontsize{7pt}\selectfont}
%\newcommand  {\footnotesize} {\fontsize{8pt}\selectfont}
%\newcommand  {\small}        {\fontsize{9pt}\selectfont}
\renewcommand{\normalsize}{\fontsize{10}{12}\selectfont}
\newcommand{\large}{\fontsize{10}{13}\selectfont}
%\newcommand  {\Large}        {\fontsize{12pt}\selectfont}
\newcommand{\LARGE}{\fontsize{10}{15}\selectfont}
%\newcommand  {\huge}         {\fontsize{14pt}\selectfont}
%\newcommand  {\Huge}         {\fontsize{15pt}\selectfont}

%% Informations about the pages
\pagenumbering{arabic}

%% Prepare the document size : a4paper
\setlength\paperheight {297mm}
 \setlength\paperwidth  {210mm}

%% Usefull values
\def\today{
  \ifcase\month\or January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December
  \fi
  \space\number\day, \number\year}


%% MAKETITLE COMMAND
\newcommand{\maketitle}{%
  \newpage
  \begin{tabular}{lr}
      {\Large \@date}
    & {\Large \@author}
  \end{tabular}
  \begin{center}%
    {\LARGE Class : \@title}%
  \end{center}%
  \hrule
}


%% TITLES DEFINITIONS
\setcounter{secnumdepth}{3}

\newcounter{exercise}
\newcounter{question}[exercise]
\newcounter{subquestion}[question]
\newcounter{subsubquestion}[subquestion]

\setcounter{exercise}{0}
\setcounter{question}{0}
\setcounter{subquestion}{0}
\setcounter{subsubquestion}{0}

\renewcommand{\theexercise}{\@arabic\c\@exercise}
\renewcommand{\thequestion}{\theexercise.\@Alph\c\@question}
\renewcommand{\thesubquestion}{\thequestion-\@roman\c\@subquestion}
\renewcommand{\thesubsubquestion}{\thesubquestion .\@alph\c\@subsubquestion}

%% EXERCISE DEFINITION
\newcommand\exercise{\@startsection {exercise}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\Large\bfseries}}

%\newcommand \exercise{\@startsection {exercise}{1}{\z@}%
%                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
%                                   {2.3ex \@plus.2ex}%
%                                   {\normalfont\Large\bfseries}}

%% QUESTION DEFINITION
\newcommand\question{\@startsection {question}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}

%% SUBQUESTION DEFINITION
\newcommand\subquestion{\@startsection {subquestion}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}

%% SUBSUBQUESTION
\newcommand\subsubquestion{\@startsection {subsubquestion}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}

%%
%% End of file `exercises.cls`

-------------------------------------------------

I try to use it with a simple document :

-------------------------------------------------
\documentclass{exercises}

\begin{document}

\author{Fabien POULARD}
\date{\today}
\title{CS570 - Automatons theory}

\maketitle{}

\end{document}

-------------------------------------------------

The document compile, but the result is a blank page .... and the logs 
are clean !
If you have an idea ... I'd be happy to know where I'm wrong !

GrdScarabe



More information about the texhax mailing list