From 025c0152db35e980250dc95ffa6a61578901ae3b Mon Sep 17 00:00:00 2001 From: Felipe Portales-Oliva Date: Thu, 18 Apr 2019 02:11:20 -0400 Subject: [PATCH] converted professor, class and institution data into optional arguments through some TeX wizardry --- fphw.cls | 13 +++++++------ template.tex | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fphw.cls b/fphw.cls index 1eb18e9..ad2feb1 100644 --- a/fphw.cls +++ b/fphw.cls @@ -17,11 +17,11 @@ %%%% 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} } +\newcommand{\professor}[1]{ \newcommand{\professorloc}{#1} } % We define the macro for the name of the course -\newcommand{\class}[1]{ \renewcommand{\class}{#1} } +\newcommand{\class}[1]{ \newcommand{\classlocal}{#1} } % We define the macro for the name of the institution -\newcommand{\institute}[1]{ \renewcommand{\institute}{#1} } +\newcommand{\institute}[1]{ \newcommand{\instituteloc}{#1} } %these are auxiliary definitions used in the title section \newcommand{\CourseLang}{Course} @@ -90,14 +90,14 @@ \renewcommand{\headrulewidth}{0.4pt} % we want rules \renewcommand{\footrulewidth}{0.4pt} \fancyhead[RO] {\footnotesize\thepage} -\fancyhead[LO] {\footnotesize\itshape\class{} -- \makeatletter\@title\makeatother } +\fancyhead[LO] {\footnotesize{\ifx\classlocal\undefined{}\else\itshape\classlocal{} --{} \fi}\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] + \ifx\instituteloc\undefined{}\else{\scshape \instituteloc} \\[10pt] \fi \hrule \vspace{10pt} {\LARGE \bfseries \@title} \\[5pt] @@ -105,7 +105,8 @@ \vspace{8pt} \hrule \vspace{10pt} - \CourseLang: {\itshape\class} -- \ProfessorLang: {\itshape\professor} + \ifx\classlocal\undefined{}\else\CourseLang: {\itshape \classlocal{ } \ifx\professorloc\undefined{}\else{-- }\fi }\fi + \ifx\professorloc\undefined{}\else{\ProfessorLang: {\itshape\professorloc}}\fi \\ \DateLang: {\itshape\@date} \vspace{20pt} diff --git a/template.tex b/template.tex index 2a17b12..728e454 100644 --- a/template.tex +++ b/template.tex @@ -10,15 +10,15 @@ ]{fphw} % Packages added -\usepackage{lipsum} % to fill the document, this line can be removed +\usepackage{mathpazo} % if you want to use Palatino fonts % Identification \title{Homework \#1} % a simple title \author{Felipe Portales Oliva} % me :) -\date{March 28th, 2019} % when this is going to be delivered/due? +\date{March 28th, 2019} % when this is going to be delivered/due? \institute{University of Life} % where this is going to be delivered \class{QFT in Curved Spacetimes} % for the class... -\professor{Dr. Albert Einstein} % who will grade me +\professor{Dr. Albert Einstein} % who will grade me % Finally we can start writing \begin{document} @@ -26,9 +26,9 @@ \maketitle % Put all that nicely \begin{problem} - \lipsum[1] + This is where you put the problem you have to solve. \end{problem} -\lipsum[2-15] % My homework - +This is where you put your solution \newpage +This is how a second page looks \end{document}