Debian Codegraph @

texmf-dist/doc/latex/abntexto-uece/abntexto-uece.tex

raw
1 %! abntexto-uece.cls
2 %! Author: Elayson Abreu
3 %! Version: 1.0 2025-08-27
4 %! Contact: [email protected]
5 %! License: Public Domain Software 2025
6
7 % !TeX TS-program = lualatex
8 \documentclass{abntexto-uece}
9
10 \usepackage[brazil,shorthands=off]{babel}
11 \usepackage[cmyk]{xcolor}
12 \usepackage{lipsum}
13 \usepackage[
14 style = abnt,
15 maxbibnames = 100,
16 extrayear = true,
17 ]{biblatex} \addbibresource{abntexto-uece.bib}
18 \usepackage{unicode-math}
19 \usepackage[colorlinks,linktoc=page]{hyperref}
20 \usepackage{microtype}
21 \usepackage{fontspec}
22 \usepackage{listings}
23 \usepackage{lua-widow-control} \clubpenalty=10000\widowpenalty=10000
24
25 \makeatletter
26
27 % VERBATIM
28 % ================================================
29
30 \def\adef#1{\catcode`#1=13 \begingroup \lccode`\~=`#1\lowercase{\endgroup\def~}}
31 \def\setverb{\def\do##1{\catcode`##1=12}\dospecials\space}
32 \def\verbchar#1{%
33 \ifx\savedttchar\undefined\else \catcode\savedttchar=\savedttcharc \fi
34 \chardef\savedttchar=`#1\relax
35 \chardef\savedttcharc=\catcode`#1\relax
36 \adef{#1}{\leavevmode\hbox\bgroup\setverbchar\readverb}%
37 \bgroup\lccode`\~=`#1\lowercase{\egroup\def\readverb ##1~}{##1\egroup}%
38 \catcode`#1=13
39 }
40 \def\setverbchar{\setverb
41 \adef{ }{\ }%
42 \adef{\{}{\bgroup\normalcolor\char`\{}%
43 \adef{\}}{\char`\}\egroup}%
44 \adef{[}{\bgroup\normalcolor\char`[}%
45 \adef{]}{\char`]\egroup}%
46 \ttfamily
47 }
48
49 \edef\bslash{\csstring\\}
50 \def\mytarget#1{\vbox to0pt{\kern-12pt \hypertarget{#1}{}\vss}}
51 \def\1{`}\def\2{``}
52 {\catcode`\`=13 \AtBeginDocument{%
53 \verbchar{`}%
54 \def\^`{\bgroup \docpoint}%
55 \def\docpoint#1`{\egroup\leavevmode\edef\tmp{\csstring#1}%
56 \expandafter\parsecn \string#1\relax
57 \ifcsname \cn s/^\tmp\endcsname \else
58 \mytarget{\cn s/^\tmp}\csgdef{\cn s/^\tmp}{}%
59 \fi
60 \hyperlink{\cn s/\tmp}{\color{blue}\ttfamily\if\cn c\bslash\fi\tmp}%
61 }%
62 \def\parsecn #1#2\relax {\edef\cn{\if\bslash#1c\else n\fi}}%
63 \def\`{\bgroup \mainpoint}%
64 \def\mainpoint #1`{\egroup\leavevmode\edef\tmp{\csstring#1}%
65 \expandafter\parsecn \string#1\relax
66 \ifcsname \cn s/\tmp\endcsname \moremainpoints \else
67 \mytarget{\cn s/\tmp}\csgdef{\cn s/\tmp}{}%
68 \fi
69 \ifcsname \cn s/^\tmp\endcsname
70 \hyperlink{\cn s/^\tmp}{\ttfamily\if\cn c\bslash\fi\tmp}\else
71 {\color{red}\ttfamily\string#1}%
72 \fi
73 }%
74 \def\moremainpoints{\errmessage{Second main documentation point \if\cn c\bslash\fi\tmp}}
75 }}
76
77 \let\lchevron=<
78 {\catcode`<=13 \AtBeginDocument{\catcode`<=13
79 \def<#1>{\ifhmode\else\expandafter\hbox\fi\bgroup\normalcolor\ttfamily
80 $\color{gray}\langle$\/{\rmfamily\itshape #1\/}$\color{gray}\rangle$\egroup}}%
81 }
82
83 \def\type#1{\NoCaseChange{\protect\typeA{#1}}}
84 \def\typeA#1{\bgroup\normalshape\ttfamily{\escapechar=-1\relax\expandafter}\detokenize{#1}\egroup}
85 % Precisamos de \m@ne aqui, \m@ne=-1.
86 \pdfstringdefDisableCommands{%
87 \def\type#1{\bgroup\escapechar\m@ne\expandafter\egroup\detokenize{#1}}%
88 \let\escapechar=\relax
89 \let\m@ne=\relax
90 }
91
92 \definecolor{P}{RGB}{242, 121, 0} % Primitivas.
93 \definecolor{C}{RGB}{23, 230, 23} % Comentários.
94 \definecolor{B}{RGB}{245, 250, 247} % Fundo.
95
96 \lstset{
97 language = [latex]tex,
98 basicstyle = \abntsmall\singlesp\ttfamily,
99 texcsstyle = *\color{P}, % O listings não permite ":"
100 commentstyle = \color{C}, % no nome dessas cores. Bug.
101 backgroundcolor = \color{B},
102 frame = leftline,
103 rulecolor = \color{lightgray},
104 columns = fullflexible,
105 breaklines = false,
106 keepspaces = true,
107 aboveskip = 0pt plus1.2ex minus.67ex,
108 belowskip = 0pt plus1.2ex minus.67ex,
109 abovecaptionskip = 0pt,
110 belowcaptionskip = 0pt,
111 % tabsize = 1, % Sem efeito, porque o documento usa Espaço na tabulação.
112 }
113
114 % #1 = linewidth
115 % #2 = border
116 % #3 = padding
117 % #4 = padding-top
118 % #5 = padding-right
119 % #6 = padding-bottom
120 % #7 = padding-left
121 % #8 = margin-left
122 % #9 = margin-right
123 \def\mylstset#1#2#3#4#5#6#7#8#9{\lstset{
124 linewidth = \dimexpr#1 -#2 -#3 -#5\relax,
125 framerule = \dimexpr#2\relax,
126 framesep = \dimexpr#3\relax,
127 xleftmargin = \dimexpr#2 +#3 +#7 +#8\relax,
128 xrightmargin = \dimexpr#9\relax,
129 framextopmargin = \dimexpr#4\relax,
130 framexrightmargin = \dimexpr#5\relax,
131 framexbottommargin = \dimexpr#6\relax,
132 framexleftmargin = \dimexpr#7\relax,
133 }}
134 \mylstset{\linewidth}{1pt}{0pt}{0pt}{0pt}{0pt}{0pt}{0pt}{0pt}
135
136 \lstnewenvironment{lst}[1][\placepos]{%
137 \let\medskipamount=\smallskipamount
138 \place[#1]\vbox\bgroup
139 }{%
140 \egroup\endplace
141 }
142 \lstnewenvironment{longlst}[1][\placepos]{%
143 \begingroup
144 \processplacearg{#1}%
145 \parskip=0pt \parindent=0pt
146 \initplace
147 \printlegendbox
148 \resetORIlabel \ignorespaces
149 }{%
150 \unskip
151 \savedplacewidth=\hsize
152 \printsrcbox
153 \finishplace
154 \resetplace \gresetORIlabel
155 \endgroup
156 }
157
158 \def\hookXP{}
159 \lstnewenvironment{xp}[1][]{%
160 \lstset{
161 frame = leftline,
162 basicstyle = \normalsize\ttfamily\singlesp\vskip-\baselineskip,
163 texcsstyle = \normalcolor,
164 commentstyle = \normalcolor,
165 backgroundcolor = \color{white},
166 gobble = 4,
167 }%
168 \mylstset{\linewidth}{0pt}{0pt}{0pt}{0pt}{0pt}{\parindent}{0pt}{0pt}%
169 \expandafter\lstset \expandafter{\hookXP,#1}%
170 \endgraf\null
171 }{}
172
173 % ETC.
174 % ================================================
175
176 \setmainfont{XITS}[
177 UprightFont = *-Regular,
178 BoldFont = *-Bold,
179 ItalicFont = *-Italic,
180 BoldItalicFont = *-BoldItalic,
181 Extension = .otf
182 ]
183 \setmathfont{XITSMath-Regular.otf}
184 \setmonofont{InconsolataN}[
185 UprightFont = *-Regular,
186 BoldFont = *-Bold,
187 Extension = .otf
188 ]
189
190 \definelegendplace{code}{Código}{loc}
191 %\definelegendplace{output}{Saída}{loo}
192 %\definelegendplace{scr}{\emph{Screenshot}}{loscr}
193
194 \let\over=\@@over
195 \AtBeginDocument{\def\refname{Referências}} % Removido \^ da definição.
196 \def\hooksection{}
197 \AtBeginDocument{\pretocmd\appendix{\clearpage}{}{}}
198 \pretocmd\annex{\clearpage}{}{}
199 \def\etex{\leavevmode\hbox{$\varepsilon$-\TeX}}
200 \def\pdflatex{\leavevmode\hbox{PDF\LaTeX}}
201 \def\xelatex{\leavevmode\hbox{Xe\LaTeX}}
202 \def\lualatex{\leavevmode\hbox{Lua\LaTeX}}
203 \def\me{Elaboração própria.}
204 \def\bibfont{\raggedright\interlinepenalty=10000\singlesp\bibitemsep=\baselineskip}
205 %\appto\textual{
206 % \def\@evenhead{\abntsmall \firstmarks0\hfil\thepage}
207 % \def\@oddhead {\abntsmall \botmarks1\hfil\thepage}
208 % \def\sectionmark #1{\marks0{Seção \thesection: \unexpanded{#1}}}
209 % \def\subsectionmark#1{\marks1{Subseção \thesubsection: \unexpanded{#1}}}
210 % \preto\@oddhead {\lower4pt\rlap{\vrule width\hsize height.4pt}}
211 % \preto\@evenhead{\lower4pt\rlap{\vrule width\hsize height.4pt}}
212 %}
213 %\patchcmd{\eletroniclayout}{false}{true}{}{}
214 \let\onesidelayout=\eletroniclayout
215 \let\twosidelayout=\eletroniclayout
216 \let\Metadados=\relax
217 \hypersetup{
218 pdfauthor = Elayson Abreu,
219 pdftitle = Classe ABNTexto-UECE: trabalhos
220 conforme as normas da UECE,
221 pdfsubject = Manual da classe ABNTexto-UECE,
222 pdfcreator = LaTeX with abntexto-uece,
223 pdfkeywords = ABNTexto-UECE; LaTeX; Classe; ABNT.
224 }
225 \makeatother
226
227 \begin{document}
228
229 \leavevmode\vskip1.9in
230 \begingroup \centering \LARGE\sffamily\bfseries
231 Classe ABNTexto-UECE\vskip2em \normalfont\large
232 Elayson Abreu\vskip-3pt
233 \href{mailto:[email protected]}%
234 {[email protected]}\vskip2ex
235 \today
236 \vskip2in\endgroup
237
238 \noindent\hfil {\Large\ttfamily 1.0}
239 \newpage
240
241 \nonum\notoc\section{Sumário}
242 \maketoc
243 \newpage
244
245 \section{Introdução}
246
247 Esta classe é destinada aos estudantes da UECE como auxílio na criação de trabalhos acadêmicos: TCCs, dissertações e teses. Ela foi baseada na classe `abntexto.cls` disponível no CTAN: \url{https://ctan.org/pkg/abntexto} e no Guia de Normalização de Trabalhos Acadêmicos da UECE: \url{https://www.uece.br/biblioteca/wp-content/uploads/sites/27/2024/09/GUIA-UECE-2024-Atualizado-1.pdf}, 5ª edição, V1, 2024.
248
249 Exemplo de uso desta classe disponível no arquivo `abntexto-uece-exemplo.tex` (Código~\ref{cd:ex}):
250
251 \legend{code}{Exemplo de uso} \label{cd:ex}
252 \src\me
253 \begin{longlst}
254 % !TeX TS-program = lualatex
255 \documentclass{abntexto-uece}
256
257 \usepackage{hyperref}
258 \usepackage[english,brazil]{babel}
259 \usepackage{fontspec}
260 \usepackage{unicode-math}
261
262 \Autor{Fulano de Tal}
263 \Universidade{Universidade Estadual do Ceará}
264 \SiglaDaInstituicao{SIGLA}
265
266 % Estes três são mutuamente exclusivos.
267 %\Programa{Programa de Pós-Graduação em Saúde Coletiva}
268 %\Faculdade{Faculdade de Filosofia Dom Aureliano Matos}
269 \Centro{Centro de Ciências e Tecnologia}
270
271 % Estes dois são mutuamente exclusivos.
272 %\Especializacao{Especialização em Gestão Pedagógica da Escola Básica}
273 \Curso{Curso de Graduação em Informática Licenciatura a Distância}
274
275 \Cidade{Cidade --- Ceará}
276 \AnoDeEntrega{Ano de Entrega}
277 \Titulo{Um título de exemplo}
278 \Subtitulo{um subtítulo}
279 \TipoDeTrabalho{Dissertação}
280 \DescricaoDoTrabalho{\xTipoDeTrabalho\ apresentada a \xUniversidade\
281 como cumprimento às exigências legais para obtenção do
282 título de Mestre.}
283 \AreaDeConcentracao{Matemática}
284 \Orientador{Dr.\,Nome}
285 \Coorientador{Dr.\,Nome}
286 \AvaliadorA{
287 Dr.\,Nome \\
288 Faculdade \\
289 Universidade
290 }
291 \AvaliadorB{
292 Dr.\,Nome \\
293 Faculdade \\
294 Universidade
295 }
296 \AvaliadorC{
297 Dr.\,Nome \\
298 Faculdade \\
299 Universidade
300 }
301 \Dedicatoria{Dedico este trabalho a\dots}
302 \Epigrafe{Linha de texto}
303 \Resumo{brazil}{Parágrafo do Resumo.}
304 \Resumo{english}{Paragraph.}
305 \PalavrasChave{brazil}{
306 Palavra 1,
307 Palavra 2,
308 Palavra 3,
309 Palavra 4,
310 }
311 \PalavrasChave{english}{
312 Keyword 1,
313 Keyword 2,
314 Keyword 3,
315 Keyword 4,
316 }
317
318 \setmainfont{XITS}[
319 UprightFont = *-Regular,
320 BoldFont = *-Bold,
321 ItalicFont = *-Italic,
322 BoldItalicFont = *-BoldItalic,
323 Extension = .otf
324 ]
325 \setmathfont{XITSMath-Regular.otf}
326
327 \begin{document}
328 \ImprimirPretextual
329 \nonum\notoc\section{Lista de Figuras}
330 \makelof
331 \nonum\notoc\section{Sumário}
332 \maketoc
333 \section{Introdução}
334 \lipsum[1]
335 \legend{figure}{Um título}\src{Elaboração própria.}
336 \begin{place}
337 \includegraphics[width=.3\linewidth]{example-image}
338 \end{place}
339 \subsection{Uma seção secundária}
340 \subsubsection{Uma seção terciária}
341 \section{Desenvolvimento}
342 \section{Conclusão}
343 \end{document}
344 \end{longlst}
345
346 % MACROS PARA O CÓDIGO-FONTE
347 % ================================================
348
349 \pdfstringdefDisableCommands{\def\marks#1#2{}}
350 \appendix{\marks0{}\marks1{}Código-fonte\label{ap:codigo-fonte}}
351
352 \makeatletter
353 \newcounter{codesection}
354 \newcounter{codesubsection}[codesection]
355 \let\c@section=\c@codesection
356 \let\c@subsection=\c@codesubsection
357 \def\thecodesection{\arabic{codesection}}
358 \def\thecodesubsection{\thecodesection.\arabic{codesubsection}}
359 \edef\toclevel@codesection{\mainseclevel}
360 \edef\toclevel@codesubsection{\the\numexpr\mainseclevel-1\relax}
361
362 \appto\hooktocsection{\def\extleaders{}%
363 \edef\savedskips{\rightskip=\the\rightskip \parfillskip=\the\parfillskip\relax}}
364 \appto\hooktocsubsection{\def\extleaders{}%
365 \edef\savedskips{\rightskip=\the\rightskip \parfillskip=\the\parfillskip\relax}}
366 \appto\hookextline{\savedskips}
367
368 \def\toclabelbox{\lowercase{\eqbox{codetoc}}}
369 \def\tocsectionfont{\itshape\MakeUppercase}
370 \def\tocsubsectionfont{}
371 \def\sectionfont{\tocsectionfont}
372 \def\subsectionfont{\itshape}
373
374 % O \addcontentsline{#1}{#2}{#3} está programado para
375 % enviar marcadores apenas se #1 = toc. Podemos
376 % mudar isso com \hypersetup{bookmarkstype=<outro>}.
377 \hypersetup{bookmarkstype=codetoc}
378 \patchcmd{\targetsection}{\refstepcounter{section}}{\refstepcounter{codesection}}{}{}
379 \patchcmd{\targetsection}{\addcontentsline{toc}}{\addcontentsline{codetoc}}{}{}
380 \patchcmd{\targetsubsection}{\refstepcounter{subsection}}{\refstepcounter{codesubsection}}{}{}
381 \patchcmd{\targetsubsection}{\addcontentsline{toc}}{\addcontentsline{codetoc}}{}{}
382
383 \def\hooksection{}
384 \def\codesection{\section}
385 \def\codesubsection{\subsection}
386
387 \colorlet{C}{.}
388 \definecolor{tmp}{RGB}{128, 0, 32} \colorlet{P}{tmp}
389 \definecolor{tmp}{RGB}{255, 228, 236} \colorlet{B}{tmp}
390
391 \expanded{\noexpand\lstdefinelanguage{mylang}{
392 language = [latex]tex,
393 texcs = {\directlua{for k,v in pairs(tex.primitives())
394 do tex.print(k, v.. ',')end}},
395 deletetexcs = {end}
396 }}
397
398 \lstset{
399 language = mylang,
400 frame = single,
401 numbers = left,
402 numbersep = \dimexpr-5pt+\addnumbersep\relax,
403 numberstyle = \fontsize{8bp}{9bp}\selectfont,
404 literate = {\^^M\%.}{}1,
405 }
406 \def\addnumbersep{9pt}
407 \mylstset{\linewidth}{0pt}{0pt}{3pt}{0pt}{3pt}{13pt+\addnumbersep}{0pt}{0pt}
408
409 \newcount\codecount \codecount=1
410 \newbox\mybox
411 \setbox\mybox=\hbox to\hsize{\hfil\abntsmall\ttfamily\bfseries\color{gray}abntexto-uece.cls}
412 \lstnewenvironment{code}[1][]{%
413 \lstset{
414 title = \copy\mybox\nobreak,
415 firstnumber = \codecount,
416 #1
417 }%
418 }{%
419 \global\codecount=\value{lstnumber}\relax
420 }
421 \appto\hookXP{
422 frame = none,
423 numbers = none,
424 numbersep = 0pt,
425 gobble = 4,
426 }
427 \parskip=0pt plus.2ex minus.1ex
428 \@starttoc{codetoc}
429 {\def\excl{!}\catcode\1\!=14 \catcode\1\%=9 \input{abntexto-uece.cls}}
430 \end{document}