fphw/fphw.cls
Felipe Portales-Oliva f5f61a6518 cleanup
2019-03-28 19:30:17 -03:00

123 lines
3.7 KiB
TeX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Felipe Portales' HomeWorks
% Maintainer: Felipe Portales-Oliva (f.portales.oliva@gmail.com)
%
% Document class to produce simple yet stylish homework submsissions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Identification
\NeedsTeXFormat{LaTeX2e} % we need to have LaTeX2e for this to compile
\ProvidesClass{fphw}[2019/03/19] % fpshw is the name we need to provide to
% the documentclass command on the .tex file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Preliminary declarations:
%%%% These are some commands where we declare new commands for the class
% We define the macro for the name of the professor
\newcommand{\professor}[1]{ \renewcommand{\professor}{#1} }
% We define the macro for the name of the class
\newcommand{\class}[1]{ \renewcommand{\class}{#1} }
% We define the macro for the name of the institution
\newcommand{\institute}[1]{ \renewcommand{\institute}{#1} }
% UTF-8 is best coding
\RequirePackage[utf8]{inputenc}
% We won't need those ugly margins
\RequirePackage{geometry}
% Header and footers, we will use the titles also
\RequirePackage{fancyhdr}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Options
%%%% We now pass the options of the class
% Two Columns are difficult to read and grade, we will not use them
\DeclareOption{twocolumn}{\OptionNotUsed}
% Two sided paper are difficult to read and grade, we will not use them
\DeclareOption{twoside}{\OptionNotUsed}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
% we hardcode some language options
\DeclareOption{spanish}{
\newcommand{\CourseLang}{Curso}
\newcommand{\ProfessorLang}{Docente}
\newcommand{\DateLang}{Fecha de entrega}
\newcommand{\StudentLang}{Nombre estudiante}
}
\DeclareOption{english}{
\newcommand{\CourseLang}{Course}
\newcommand{\ProfessorLang}{Professor}
\newcommand{\DateLang}{Due date}
\newcommand{\StudentLang}{Student name}
}
% \ExecuteOptions{english}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Bulk Declarations
%%%% Here we do more declarations and call other files
% we need to load
\LoadClass{article}
% we will modify sections, subsections and sub subsections
\RequirePackage{titlesec}
% Modification of section
\titleformat{\section}[block]{\normalsize\bfseries\filcenter}{\thesection.}{.3cm}{}
% modification of subsection and sub sub section
\titleformat{\subsection}[runin]{\bfseries}{ \thesubsection.}
{1mm}{}[.\quad]
\titleformat{\subsubsection}[runin]{\bfseries\itshape}{ \thesubsubsection.}
{1mm}{}[.\quad]
% Decent margins for the documents, as it is meant to be printed
\geometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}
\fancyhead{}
\fancyfoot{}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt} % we want rules
\renewcommand{\footrulewidth}{0.4pt}
\fancyhead[RO] {\footnotesize\thepage}
\fancyhead[LO] {\footnotesize\itshape\class{} -- \makeatletter\@title\makeatother }
\fancyfoot[RO] {\footnotesize\itshape\makeatletter\@author\makeatother}
% New title style for the document
\renewcommand{\maketitle}{%
\thispagestyle{plain}
\begin{center}
{\scshape \institute} \\[10pt]
\hrule
\vspace{10pt}
{\LARGE \bfseries \@title} \\[5pt]
\StudentLang: {\itshape \@author}
\vspace{8pt}
\hrule
\vspace{10pt}
\CourseLang: {\itshape\class} -- \ProfessorLang: {\itshape\professor}
\\
\DateLang: {\itshape\@date}
\vspace{20pt}
\end{center}
}
%%% We finish the class with this command
\endinput