From f1b793e8eef6534130761bf3d421e7da3d5552d6 Mon Sep 17 00:00:00 2001 From: Felipe Portales-Oliva Date: Thu, 28 Mar 2019 04:25:21 -0300 Subject: [PATCH] Al fin en un estado decente --- fphw.cls | 58 ++++++++++++++++++++++++++++++++++++++------------------ test.tex | 22 ++++++++++----------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/fphw.cls b/fphw.cls index ec83a54..2ecee2c 100644 --- a/fphw.cls +++ b/fphw.cls @@ -7,7 +7,7 @@ \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} +\LoadClassWithOptions{article}[] % UTF-8 is best coding \RequirePackage[utf8]{inputenc} @@ -18,24 +18,10 @@ % we will modify sections, subsections and sub subsections \RequirePackage{titlesec} +% Header and footers, we will use the titles also +\RequirePackage{fancyhdr,titling} -% Minipage is cool -% \RequirePackage{minipage} - -%%% set margins for the document -% Narrow -\DeclareOption{narrow}{\geometry{left=1.5cm,right=1.5cm,top=2cm,bottom=2cm}} - -% two columns are really difficult to grade, this is to avoid them -% \DeclareOption{twocolumn}{\OptionNotUsed} - -% As we loaded the article class we need to pass it options not specifically -% defined, such as font size -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} - - -% This is the point when we pass the options -\ProcessOptions\relax +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We define the macro for the name of the professor \newcommand{\professor}[1]{ \renewcommand{\professor}{#1} } @@ -46,9 +32,11 @@ % We define the macro for the name of the institution \newcommand{\institute}[1]{ \renewcommand{\institute}{#1} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Redefine the title for the class \renewcommand{\maketitle}{% + \thispagestyle{plain} \begin{center} {\scshape \institute} \\[10pt] \hrule @@ -65,6 +53,8 @@ \end{center} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Modification of section \titleformat{\section}[block]{\normalsize\bfseries\filcenter}{\thesection.}{.3cm}{} @@ -74,5 +64,37 @@ \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}} + +% 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} + \fancyfoot[RO] {\footnotesize\itshape\theauthor} +} + +% As we loaded the article class we need to pass it options not specifically +% defined, such as font size +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} + +% This is the point when we pass the options +\ProcessOptions\relax + + % we finish the class \endinput diff --git a/test.tex b/test.tex index e837797..b467ed1 100644 --- a/test.tex +++ b/test.tex @@ -1,27 +1,27 @@ % this is a test document for the class we defined in this project -\documentclass[10pt,narrow]{fphw} +\documentclass[11pt,standard,decorate,a4paper]{fphw} -\usepackage{lipsum} +\usepackage{lipsum,mathpazo} -\title{Homework \#1} -\author{Felipe Portales Oliva} -\date{\today} + +\title{Homework \#1} +\author{Felipe Portales Oliva} +\date{\today} \professor{Dr. A. Landulfo} \class{Relativistic Quantum Mechanics} -\institute{Universidad Federal do ABC \\ Programa de Pos Graduaçao en Física} - +\institute{Universidad Federal do ABC \\ Programa de Pós Graduaç\~ao em Física} + \begin{document} -\maketitle - - \section{Lorem} +\maketitle + \section{Lorem} \lipsum[1-3] \[ E= mc^2 \] \subsection{Ipsum} \lipsum[4-5] \subsubsection{Dolor} -\lipsum[6-20] +\lipsum[6-20]