From f5f61a6518eaccd7d31eafff630f660b96a181be Mon Sep 17 00:00:00 2001 From: Felipe Portales-Oliva Date: Thu, 28 Mar 2019 19:30:17 -0300 Subject: [PATCH] cleanup --- fphw.cls | 194 +++++++++++++++++++++++++------------------------------ test.tex | 5 +- 2 files changed, 88 insertions(+), 111 deletions(-) diff --git a/fphw.cls b/fphw.cls index 0fc4170..80bef44 100644 --- a/fphw.cls +++ b/fphw.cls @@ -1,54 +1,22 @@ -%% Stilish homeworks -%% Felipe Portales-Oliva (f.portales.oliva@gmail.com) -%% -%% Clase para crear respuestas a tareas de manera sencilla +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 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 LaTeX class to deliver your homework] - -% We will use the article class as a template, with a fontsize of 11pt -\LoadClass{article}[onecolumn] - -% UTF-8 is best coding -\RequirePackage[utf8]{inputenc} - -% We load languages -\RequirePackage[spanish,british]{babel} - -% We won't need those ugly margins -\RequirePackage{geometry} - -% we will modify sections, subsections and sub subsections -\RequirePackage{titlesec} - -% Header and footers, we will use the titles also -\RequirePackage{fancyhdr,titling} - -\DeclareOption{twocolumn}{\OptionNotUsed} +\ProvidesClass{fphw}[2019/03/19] % fpshw is the name we need to provide to + % the documentclass command on the .tex file -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%% Language support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% we hardcode some language options -\DeclareOption{spanish}{ - \newcommand{\CourseLang}{Curso} - \newcommand{\ProfessorLang}{Docente} - \newcommand{\DateLang}{Fecha de entrega} - \newcommand{\StudentLang}{Nombre estudiante} - \selectlanguage{spanish} -} - -\DeclareOption{english}{ - \newcommand{\CourseLang}{Course} - \newcommand{\ProfessorLang}{Professor} - \newcommand{\DateLang}{Due date} - \newcommand{\StudentLang}{Student name} - \selectlanguage{british} -} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% 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} } @@ -59,9 +27,80 @@ % 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} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%% Redefine the title for the class + +%%% 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} @@ -80,64 +119,5 @@ \end{center} } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% 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] - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%% set margins for the document -% Narrow -\DeclareOption{narrow}{\geometry{left=1.5cm,right=1.5cm,top=2.5cm,bottom=2.5cm}} -% Standard -\DeclareOption{standard}{\geometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}} - -%%% Set paper size for document -\DeclareOption{a4}{\geometry{a4paper}} -\DeclareOption{letter}{\geometry{letterpaper}} - -% two columns are really difficult to grade, this is to avoid them -% \DeclareOption{twocolumn}{\OptionNotUsed} - -% the user can put their name on the header and footers along other info -\DeclareOption{decorate}{ - % clear all data - \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\theauthor} -} - -% if no decoratios indicated, we do not decorate -\DeclareOption{donotdecorate}{\pagestyle{plain}} - - - -%%%%% These are the default options -\ExecuteOptions{donotdecorate,a4} - -% As we loaded the article class we need to pass it options not specifically -% defined, such as font size -\DeclareOption*{\ClassWarningNoLine{fphw}{\CurrentOption not recognized}} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% This is the point when we pass the options -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ProcessOptions\relax - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% we finish the class -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% We finish the class with this command \endinput diff --git a/test.tex b/test.tex index 1538076..b51e6f3 100644 --- a/test.tex +++ b/test.tex @@ -1,6 +1,6 @@ % this is a test document for the class we defined in this project -\documentclass[standard,decorate,spanish,letter]{fphw} +\documentclass[spanish,letterpaper,12pt]{fphw} \usepackage{lipsum,mathpazo} @@ -14,9 +14,6 @@ \class{Teoría General de la Relatividad I} \institute{Universidad de Concepción \\ Programa de Magíster en Ciencias con Mención en Física} - - - \begin{document} \maketitle \section{Lorem}