-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbrlex2.cls
More file actions
389 lines (287 loc) · 8.8 KB
/
brlex2.cls
File metadata and controls
389 lines (287 loc) · 8.8 KB
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
%% brlex2.cls
%% Copyright 2023 Heliton Martins Reis Filho <helitonmrf@gmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Heliton Martins Reis Filho
%
% This work consists of the files brlex2.cls
%% Referências normativas:
% Manual de Compilação da Legislação Brasileira. Câmara dos Deputados. 2012;
% Decreto nº 9191/2017, de 1º de novembro de 2017;
% Lei Complementar nº 95, de 26 de fevereiro de 1998.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{brlex2}[2023/04/21 Classe para formatação de textos legais.]
\LoadClassWithOptions{article}
\PassOptionsToClass{12pt}{article}
% \ExplSyntaxOn
% Copied from br-lex.cls
\widowpenalty 1000
\clubpenalty 1000
\displaywidowpenalty 1000
\RequirePackage{iftex}
\ifxetex
\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage{brazil}
\else
\RequirePackage[utf8]{inputenc}
\RequirePackage[brazil]{babel}
\fi
\RequirePackage{textcase}
% End of copy
\RequirePackage{fmtcount}
\RequirePackage{geometry}
\RequirePackage{hyperref}
\ExplSyntaxOn
\newcommand*{\makeuppercase}[1]{\text_uppercase:n{#1}}
\ExplSyntaxOff
\def\ifempty#1{\def\temp{#1}\ifx\temp\empty}
% INDENT: se deve condensar o texto usando indentação em vez de linhas em branco.
\newif\ifindent
\DeclareOption{indent}{%
\indenttrue
\setlength{\parskip}{0pt}%
}
\ifindent\else
\setlength{\parskip}{6pt}%
\setlength{\parindent}{0pt}%
\fi
%% CALIBRI: usa a fonte calibri, conforme Decreto nº 9191/2017.
% Desativado por padrão pois não funciona com pdfLaTeX e exige a fonte instalada.
\DeclareOption{calibri}{%
\ifpdftex
\ExplSyntaxOn
\PackageWarningNoLine{brlex2}{Para utilizar calibri, compile com XeLaTeX ou LuaLaTeX. Para continuar usando pdfLaTeX, retire a opção calibri.}
\ExplSyntaxOff
\RequireLuaTeX
\fi
\AtBeginDocument{\setmainfont{Calibri}}
}
%% ARTBOLD: coloca os artigos em negrito
\newif\ifartbold
\DeclareOption{artbold}{\artboldtrue}
%% USETITLE: coloca a epígrafe (ou \title) em negrito. útil para a redação de outras espécies, como estatutos, por exemplo.
\newif\ifusetitle
\DeclareOption{usetitle}{\usetitletrue}
%% USEITALIC: permite o uso padrão de \emph (como itálico).
% Desativado por padrão pois contraria o Decreto nº 9191/2017.
\DeclareTextFontCommand{\oldemph}{\em}
\let\emph\textbf\relax
\DeclareOption{useitalic}{\let\emph\relax\let\oldemph\relax \DeclareTextFontCommand{\emph}{\em}}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%% PARTE PRELIMINAR %%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\def\@epigrafe{}
\newcommand{\epigrafe}[1]{ % LEI Nº XXX/XXXX ou Título geral do documento
\def\@epigrafe{#1}
\begin{center}
\centering \large \ifusetitle\bfseries\fi \makeuppercase{\@epigrafe}
\end{center}
\thispagestyle{plain}%
}
\renewcommand*{\title}[1]{\AtBeginDocument{\epigrafe{#1}}}
\def\@ementa{}
\newcommand{\ementa}[1]{\hfill% % Descreve o objeto do texto.
\def\@ementa{#1}
\begin{minipage}{9cm}
\@ementa
\end{minipage}
\vspace{\baselineskip}\par
}
\def\@preambulo{}
\def\@enunciado{}
\newcommand{\preambulo}[2][]{%
\def\@preambulo{#2}
\def\@enunciado{#1}
\ifempty{\@enunciado}%
\noindent\@preambulo%
\else%
\noindent\textbf{\@enunciado}~~\@preambulo%
\fi
\vspace{2ex}
}
%%%%%
%%%%% DIVISÃO DO TEXTO: LIVROS, PARTES, TÍTULOS, CAPÍTULOS, SEÇÕES, SUBSEÇÕES
%%%%%
\setcounter{secnumdepth}{7}
\setcounter{tocdepth}{7}
\newcounter{parte}
\newcounter{livro}[parte]
\newcounter{titulo}[livro]
\newcounter{capitulo}[titulo]
\newcounter{secao}[capitulo]
\newcounter{subsecao}[secao]
\newcommand*{\@parteromano}[1]{\refstepcounter{parte}
\begin{center}
PARTE \Roman{parte}\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{part}{PARTE \Roman{parte} -- \makeuppercase{#1}}
}
\newcommand*{\@parteextenso}[1]{\refstepcounter{parte}
\begin{center}
PARTE \ORDINALstring{parte}[f]\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{part}{PARTE \ORDINALstring{parte}[f] -- \makeuppercase{#1}}
}
\newcommand*{\parte}{\@ifstar{\@parteextenso}{\@parteromano}}
\newcommand*{\partegeral}[1]{
\begin{center}
PARTE GERAL\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{part}{PARTE GERAL -- \makeuppercase{#1}}
}
\newcommand*{\parteespecial}[1]{
\begin{center}
PARTE ESPECIAL\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{part}{PARTE ESPECIAL -- \makeuppercase{#1}}
}
\newcommand*{\livro}[1]{\refstepcounter{livro}
\begin{center}
LIVRO \Roman{livro}\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{chapter}{TITULO \Roman{titulo} -- \makeuppercase{#1}}
}
\newcommand*{\titulo}[1]{\refstepcounter{titulo}
\begin{center}
TÍTULO \Roman{titulo}\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{section}{TÍTULO \Roman{titulo} -- \makeuppercase{#1}}
}
\newcommand*{\capitulo}[1]{\refstepcounter{capitulo}
\begin{center}
CAPÍTULO \Roman{capitulo}\par
\makeuppercase{#1}\vspace{1ex}
\end{center}
\addcontentsline{toc}{subsection}{CAPÍTULO \Roman{capitulo}~--~\makeuppercase{#1}}
}
\newcommand*{\secao}[1]{\refstepcounter{secao}
\begin{center}
\bfseries
Seção \Roman{secao}\par
#1\vspace{1ex}
\end{center}
\addcontentsline{toc}{subsubsection}{Seção \Roman{secao} -- #1}
}
\newcommand*{\subsecao}[1]{\refstepcounter{subsecao}
\begin{center}
\bfseries
Subseção \Roman{subsecao}\par
#1\vspace{1ex}
\end{center}
\addcontentsline{toc}{paragraph}{Subseção \Roman{secao} -- #1}
}
\newcommand*{\tema}[1]{
\par\noindent\textbf{#1} \par
\addcontentsline{toc}{subparagraph}{#1}
}
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
%% PARTE NORMATIVA %%
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
% Adaptado de br-lex.cls
\newcounter{artigo}
\newcommand{\artigo}{\refstepcounter{artigo} %
\par
\ifnum\theartigo<10%
{\ifartbold\bfseries\fi Art.~\arabic{artigo}º~~}%
\else%
{\ifartbold\bfseries\fi Art.~\arabic{artigo}.~~}%
\fi%
\setcounter{inciso}{0}%
}
\newcounter{artigoletra}[artigo]
\newcommand{\artX}{\refstepcounter{artigoletra} %
\par%
{%
\ifartbold\bfseries\fi%
{Art.~\arabic{artigo}-\Alph{artigoletra}.~~}%%
}%
\setcounter{inciso}{0}%
}
\newcounter{paragrafo}[artigo]
\newcommand{\paragrafo}{\refstepcounter{paragrafo}%
\par%
\ifindent\hangindent=2em \hangafter=0 \fi{%
\ifartbold\bfseries\fi%
\ifnum\theparagrafo<10%
\S~\arabic{paragrafo}º~~%
\else%
\S~\arabic{paragrafo}.~~%
\fi%
}%
}
\newcommand{\paragrafounico}{\ifindent\hangindent=2em \hangafter=0 \fi {\ifartbold\bfseries\fi Parágrafo único.}~~}
\newcounter{inciso}[paragrafo]
\newcommand{\inciso}{\refstepcounter{inciso}%
\newlength{\tempincisomarginleftifparagrafo}%
\par%
\ifnum\theparagrafo=0%
\setlength{\tempincisomarginleftifparagrafo}{2em}%
\else%
\setlength{\tempincisomarginleftifparagrafo}{3.5em}%
\fi%
\ifindent\hangindent=\tempincisomarginleftifparagrafo \hangafter=0 \fi%
{\ifartbold\bfseries\fi\Roman{inciso}~---~}%
\let\tempincisomarginleftifparagrafo\relax
}
\newcounter{alinea}[inciso]
\newcommand{\alinea}{\refstepcounter{alinea}%
\par%
\ifindent\hangindent=5em \hangafter=0 \fi%
{\ifartbold\bfseries\fi\alph{alinea})~~}%
}
\newcounter{itens}[alinea]
\newcommand{\itens}{\refstepcounter{itens}%
\par%
\ifindent\hangindent=6.5em \hangafter=0 \fi%
{\ifartbold\bfseries\fi\arabic{itens}.~~}%
}
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
%% PDF SETUP %%
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
\newcommand*{\metadata}{
\hypersetup{pdftitle={\@epigrafe},
pdfauthor={\@author},
pdfsubject={\@ementa},
pdfproducer={LaTeX},
pdfcreator={brlex2 with LaTeX}
}
}
\geometry{a4paper, lmargin=3cm, rmargin=2cm, vmargin=2.5cm}
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
%% UTILITÁRIOS %%
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
% risca partes do texto
\newcommand{\cortado}[1]{\sout{#1}}
% atalhos de comandos
\let\art\artigo\relax
\let\parag\paragrafo\relax
\let\so\paragrafo\relax
\let\parun\paragrafounico\relax
\let\inc\inciso\relax
\let\itm\itens\relax