-
Notifications
You must be signed in to change notification settings - Fork 0
/
capucho-report.cls
132 lines (112 loc) · 3.82 KB
/
capucho-report.cls
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{capucho-report}[2024/09/06 v0.1 class for reports by Capucho]
% Passes and class options to the underlying report class
\DeclareOption{code}{\def\needsCode{1}}
\DeclareOption{math}{\def\needsMath{1}}
\DeclareOption{diagrams}{\def\needsDiagrams{1}}
\DeclareOption{small-chapter}{\def\smallChapter{1}}
\DeclareOption{bibliography}{\def\needsBibliography{1}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
% Load report class
\LoadClass[11pt,a4paper]{report}
% Load packages for text and font handling
\RequirePackage{ifluatex}
\ifluatex
\RequirePackage{fontspec}
\RequirePackage{luacode}
\else
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\fi
% Add `showframe` to display geometry guides
\RequirePackage[headheight=20mm,headsep=5mm]{geometry}
% Add support for portuguese writing rules
\RequirePackage[portuguese]{babel}
\babelprovide[transforms = hyphen.repeat]{portuguese}
% Allows setting custom padding
\RequirePackage{setspace}
% Makes all references hyperlinked
% NOTE: Must be loaded after setspace or it breaks
\RequirePackage[
hidelinks,
colorlinks=true,
urlcolor=cyan,
linkcolor=.
]{hyperref}
% Needed for the figure H
\RequirePackage{float}
% Needed for including images
\RequirePackage{graphicx}
% Needed for \Verb and friends (fancy verbatim environments)
\RequirePackage{fancyvrb}
% Needed for custom enumerated environments
\RequirePackage{enumitem}
% Better captions
\RequirePackage[margin=10pt,font=small,labelfont=bf]{caption}
% Allow for verbatim and others in protected environments
\RequirePackage{cprotect}
% Allows control over text alignment
\RequirePackage{ragged2e}
\ifdefined\needsCode
% Code highlighting in code blocks
\RequirePackage{minted}
% Newer versions don't need (or accept) the output dir option, so only add it
% if the versions is older than V3.
\IfPackageAtLeastTF{parskip}{2024-09-22}{}{\PassOptionsToPackage{outputdir=build}{minted}}
\setminted{autogobble}
% Prefix for code listings (default: Listing)
\renewcommand{\listingscaption}{Código}
% Use the chapter number in the listing counter
\counterwithin{listing}{chapter}
% Use TeX box for the minted environment
\RequirePackage{xpatch}
\xpretocmd{\minted}{\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}}{}{}
% Extra Inline code commands
\newmintinline{bash}{}
\fi
\ifdefined\needsMath
% Math environments
\RequirePackage{amsmath}
\fi
% Number ranges
\RequirePackage[detect-all]{siunitx}
% Cells spanning mulitple rows/columns in tables
\RequirePackage{multirow}
% Context sensitive (and language aware) quotation
\RequirePackage[portuguese=portuguese]{csquotes}
\ifdefined\needsDiagrams
% Needed for diagrams
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{tikz}
\usetikzlibrary{shapes, arrows}
\fi
\ifdefined\smallChapter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\fi
% Change the chapter title to the compact format
% Number. Title
% Instead of:
% Capítulo Number.
% Title
\RequirePackage[explicit,compact]{titlesec}
\titleformat{\chapter}[block]
{\bfseries\huge}{\filright\huge\thechapter.}{1ex}{\huge\filright #1}
% Remove the header from the TOC page
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}
\ifdefined\needsBibliography
% Don't sort the bibliography, use the order of the citations usage
\RequirePackage[sorting=none, dateabbrev=false, language=portuguese]{biblatex}
\fi
\newcommand{\VerbSection}[1]{%
\texorpdfstring{\protect\Verb|#1|}{#1}}
%%% START CUSTOM ENVIRONMENTS
% Defines an enumerated description list
\newcounter{descriptcount}
\newlist{enumdescript}{description}{1}
\setlist[enumdescript,1]{%
before={\setcounter{descriptcount}{0}%
\renewcommand*\thedescriptcount{\arabic{descriptcount}.}}
,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
%%% END CUSTOM ENVIRONMENTS