converted professor, class and institution data into optional arguments through some TeX wizardry

This commit is contained in:
Felipe Portales-Oliva 2019-04-18 02:11:20 -04:00
parent ea785099bb
commit 025c0152db
2 changed files with 13 additions and 12 deletions

View file

@ -17,11 +17,11 @@
%%%% These are some commands where we declare new commands for the class %%%% These are some commands where we declare new commands for the class
% We define the macro for the name of the professor % 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 % 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 % 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 %these are auxiliary definitions used in the title section
\newcommand{\CourseLang}{Course} \newcommand{\CourseLang}{Course}
@ -90,14 +90,14 @@
\renewcommand{\headrulewidth}{0.4pt} % we want rules \renewcommand{\headrulewidth}{0.4pt} % we want rules
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
\fancyhead[RO] {\footnotesize\thepage} \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} \fancyfoot[RO] {\footnotesize\itshape\makeatletter\@author\makeatother}
% New title style for the document % New title style for the document
\renewcommand{\maketitle}{% \renewcommand{\maketitle}{%
\thispagestyle{plain} \thispagestyle{plain}
\begin{center} \begin{center}
{\scshape \institute} \\[10pt] \ifx\instituteloc\undefined{}\else{\scshape \instituteloc} \\[10pt] \fi
\hrule \hrule
\vspace{10pt} \vspace{10pt}
{\LARGE \bfseries \@title} \\[5pt] {\LARGE \bfseries \@title} \\[5pt]
@ -105,7 +105,8 @@
\vspace{8pt} \vspace{8pt}
\hrule \hrule
\vspace{10pt} \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} \DateLang: {\itshape\@date}
\vspace{20pt} \vspace{20pt}

View file

@ -10,15 +10,15 @@
]{fphw} ]{fphw}
% Packages added % Packages added
\usepackage{lipsum} % to fill the document, this line can be removed \usepackage{mathpazo} % if you want to use Palatino fonts
% Identification % Identification
\title{Homework \#1} % a simple title \title{Homework \#1} % a simple title
\author{Felipe Portales Oliva} % me :) \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 \institute{University of Life} % where this is going to be delivered
\class{QFT in Curved Spacetimes} % for the class... \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 % Finally we can start writing
\begin{document} \begin{document}
@ -26,9 +26,9 @@
\maketitle % Put all that nicely \maketitle % Put all that nicely
\begin{problem} \begin{problem}
\lipsum[1] This is where you put the problem you have to solve.
\end{problem} \end{problem}
\lipsum[2-15] % My homework This is where you put your solution \newpage
This is how a second page looks
\end{document} \end{document}