aboutsummaryrefslogtreecommitdiff
path: root/fphw.cls
blob: 0fc4170bef4dc76eb0d74b10b9accfbcc8aee39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
%% Stilish homeworks
%% Felipe Portales-Oliva (f.portales.oliva@gmail.com)
%% 
%% Clase para crear respuestas a tareas de manera sencilla

\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}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% 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}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 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} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Redefine the title for the class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput