-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tex
229 lines (188 loc) · 6.97 KB
/
main.tex
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USP-DOC
% Template para documentos técnicos das USP
%
% Copyright (c) 2023 Estevão Soares dos Santos
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTA: Este ficheiro é o template e NÃO DEVE SER ALTERADO.
% Para alterar o conteúdo, editar os ficheiros da pasta "conteudos"
% AS informações acerca da recomendação estão no ficheiro "metadados.tex"
\documentclass[12pt]{article}
%! suppress = MultipleIncludes
\usepackage{luacode}
\usepackage{tabularx}
\usepackage[portuguese]{babel} % Language setting
\usepackage{csquotes}
\usepackage{titlesec} % Load the titlesec package for formatting section and subsection titles
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=1.75cm]{geometry} % Set page size and margins
\usepackage[T1]{fontenc} % fonts
\usepackage{Oswald} % Oswald
\usepackage{helvet} % Helvetica
\renewcommand*\familydefault{\sfdefault} % Makes Helvetica the default sans-serif font
\usepackage[backend=biber]{biblatex} % Bibliografia
\addbibresource{conteudo/referencias.bib}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage[table]{xcolor}
\usepackage{ltablex}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[export]{adjustbox}
\usepackage{afterpage}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage[shiftHeadings=1, startNumber=false, pipeTables=true, fencedCode]{markdown}
\usepackage{fancyhdr}
\usepackage{catchfile}
\usepackage{etoolbox}
\usepackage{subfiles} % Best loaded last in the preamble
% my packages
\usepackage{template/cabecalho}
%\usepackage{showframe}
\begin{luacode}
dofile("./template/utils/parse_config.lua")
\end{luacode}
\directlua{parse_config("./conteudo/config.yml")}
%\input{metadados}
%\newcommand{\numero}{D\id.\ano}
%\newcommand{\versao}{\major.\minor.\patch}
%Esquema de Cores
\definecolor{gray1}{RGB}{240, 240, 240}
\definecolor{gray2}{RGB}{245, 245, 245}
\definecolor{red1}{RGB}{204, 0, 51} % recomendacao
\definecolor{blue1}{RGB}{0,103,153} % procedimento
\definecolor{blue2}{RGB}{0,145,145} % instrucao trabalho
\definecolor{green1}{RGB}{0,150,97}
\definecolor{orange1}{RGB}{224,73,0}
\let\oldaddcontentsline\addcontentsline
\newcommand{\stoptocentries}{\renewcommand{\addcontentsline}[3]{}}
\newcommand{\starttocentries}{\let\addcontentsline\oldaddcontentsline}
\newcommand{\nonumbersections}[1]{
% Remove numbers from sections and subsections
% format sections and subsections titles to be red
\titleformat{\section}
{\normalfont\sffamily\Large\bfseries\color{#1}}
{}{0em}{}
\titleformat{\subsection}
{\normalfont\sffamily\normalsize\bfseries\color{#1}}
{}{0em}{}
\titleformat{\subsubsection}
{\normalfont\sffamily\normalsize\bfseries\color{#1}}
{}{0em}{}
}
\newcommand{\numberedsections}[1]{
% Remove numbers from sections and subsections
% format sections and subsections titles to be red
\titleformat{\section}
{\normalfont\sffamily\Large\bfseries\color{#1}}
{\thesection.}{1em}{}
\titleformat{\subsection}
{\normalfont\sffamily\normalsize\bfseries\color{#1}}
{\thesubsection.}{1em}{}
\titleformat{\subsubsection}
{\normalfont\sffamily\normalsize\bfseries\color{#1}}
{\thesubsubsection.}{1em}{}
}
% definition to store the type of document
\newcommand{\docname}{Documento}
%! suppress = NonMatchingIf
\ifdefstring{\tipodocumento}{recomendacao}{
\colorlet{colorschema}{red1}
\renewcommand{\docname}{Recomendação}
\renewcommand{\numero}{R\id.\ano}
\nonumbersections{colorschema}
}{
\ifdefstring{\tipodocumento}{procedimento}{
\colorlet{colorschema}{blue1}
\renewcommand{\docname}{Procedimento}
\renewcommand{\numero}{P\id.\ano}
\numberedsections{colorschema}
}{
\ifdefstring{\tipodocumento}{instrucaotrabalho}{
\colorlet{colorschema}{blue2}
\renewcommand{\docname}{Instrução de Trabalho}
\renewcommand{\numero}{T\id.\ano}
\numberedsections{colorschema}
}{
\ifdefstring{\tipodocumento}{checklist}{
\colorlet{colorschema}{orange1}
\renewcommand{\docname}{Lista de Verificação}
\renewcommand{\numero}{C\id.\ano}
\nonumbersections{colorschema}
}{
\colorlet{colorschema}{green1}
\renewcommand{\docname}{Documento}
\renewcommand{\numero}{D\id.\ano}
\numberedsections{colorschema}
}
}
}
}
% Change the font of the bibliography
\renewcommand*{\bibfont}{\sffamily\scriptsize}
% Define the header and footer styles for the entire document
\pagestyle{fancy}
\fancyhf{} % Clear existing header and footer
\renewcommand{\headrulewidth}{0pt} % No line in header area
\fancyhead[L]{{
\fontfamily{phv}
\selectfont
{\cabecalho[\docname]{colorschema}}
}} % Use \cabecalho in the left header % Use \cabecalho in the left header
\fancyfoot[C]{\thepage} % center-align the page number in the footer
\setlength{\headheight}{35pt}
%% METADATA ON PDFs
\hypersetup{pdfinfo={
Title={\titulo},
Author={\equipaRedatora, \equipaRevisora, \equipaConsultora},
Subject={\tipodocumento},
Keywords={\pchave}
}}
\begin{document}
\input{template/capa}
% Turn off PDF bookmarking, reset page counter
\hypersetup{pageanchor=false}
\setcounter{page}{1}
\input{template/contracapa}
% Turn PDF bookmarking back on and continue with your document
\hypersetup{pageanchor=true}
\setcounter{page}{3}
%reset geometry
\newgeometry{top=4cm, bottom=2cm, left=2cm, right=2cm}
%% LOAD BIBLIOGRAPHY EVEN IF THERE's NO CITATIONS
\nocite{*}
\keepXColumns
%% CONDITIONAL LOADING OF TYPES OF DOCS
%! suppress = NonMatchingIf
\ifdefstring{\tipodocumento}{recomendacao}{
% recomendação
\input{template/recomendacao/base}
}{
\ifdefstring{\tipodocumento}{procedimento}{
% procedimento
\input{template/procedimento/base}
}{
\ifdefstring{\tipodocumento}{instrucaotrabalho}{
% instrução de trabalho
\input{template/instrucaotrabalho/base}
}{
\ifdefstring{\tipodocumento}{checklist}{
% instrução de trabalho
\input{template/checklist/base}
}{
% default (Documento)
\input{template/documento/base}
}
}
}
}
\pagebreak
\begin{luacode}
dofile('template/utils/directory.lua')
if (Directory.exists('conteudo/anexos') == true and not Directory.is_empty('conteudo/anexos')) then
tex.print('\\section{Anexos}')
Directory.tex.include_all_tex_files('./conteudo/anexos')
end
\end{luacode}
\end{document}