typst-template.typ (10770B)
1 // ============================================================ 2 // FORMATO ABNT PARA QUARTO (TYPST) 3 // Baseado na NBR 14724, NBR 6022, NBR 10520, NBR 6023 4 // e no Manual de Normatização FACSUR (2025) 5 // ============================================================ 6 7 #let abnt-recuo = 1.25cm 8 #let abnt-corpo = 12pt 9 #let abnt-nota = 10pt 10 #let abnt-entrelinha-1-5 = 1.04em 11 #let abnt-simples = 0.46em 12 #let abnt-fonte-padrao = ("Liberation Sans",) 13 14 // ---- Capa e folha de rosto --------------------------------------- 15 // Layout medido no PDF do TGPC (Relatório de case): 16 // - instituição e curso no topo, centralizados 17 // - título em caixa alta e negrito no terço central 18 // - autores logo abaixo do título, alinhados à direita 19 // - bloco de dados (disciplina, professor, turma, data) à direita 20 // - local e ano centralizados na base 21 // folha-rosto: true gera uma segunda página com a natureza do trabalho. 22 #let abnt-capa( 23 instituicao: "", 24 curso: "", 25 titulo: "", 26 subtitulo: "", 27 autores: (), 28 dados: (), 29 natureza: "", 30 orientador: "", 31 local: "", 32 ano: "", 33 folha-rosto: false, 34 ) = { 35 let auts = if autores.len() == 0 { "" } else { autores.join(", ", last: " e ") } 36 let linha-entrelinha = abnt-entrelinha-1-5 37 38 let topo = [ 39 #align(center)[ 40 #text(weight: "bold")[#upper(instituicao)] \ 41 #upper(curso) 42 ] 43 ] 44 45 let meio = [ 46 #align(center)[#block(width: 84%)[ 47 #set align(center) 48 #text(weight: "bold")[#upper(titulo)] \ 49 #if subtitulo != "" [#subtitulo \ ] 50 ]] 51 ] 52 53 let direita = [ 54 #align(right)[ 55 #set par(first-line-indent: (amount: 0pt, all: true), leading: 1.04em, spacing: 0pt, justify: false) 56 #auts #linebreak() 57 #for d in dados [ 58 #d.replace("~", " ") #linebreak() 59 ] 60 ] 61 ] 62 63 let base = [ 64 #align(center)[#local \ #ano] 65 ] 66 67 page(numbering: none)[ 68 #set par(first-line-indent: (amount: 0pt, all: true), leading: linha-entrelinha, spacing: 0pt, justify: false) 69 #v(3pt) 70 #topo 71 #v(198.7pt) 72 #meio 73 #v(12.5pt) 74 #direita 75 #place(bottom + center, dy: -6pt)[#base] 76 ] 77 78 if folha-rosto { 79 page(numbering: none)[ 80 #set par(first-line-indent: (amount: 0pt, all: true), leading: linha-entrelinha, spacing: 0pt, justify: false) 81 #topo 82 #v(120pt) 83 #meio 84 #v(1fr) 85 #block(width: 8cm)[ 86 #set par(first-line-indent: (amount: 0pt, all: true), leading: abnt-simples, spacing: 1em, justify: true) 87 #set text(size: abnt-nota) 88 #natureza 89 #if orientador != "" [\ \ Orientador(a): #orientador] 90 ] 91 #v(1fr) 92 #base 93 ] 94 } 95 } 96 97 // ---- Documento ---------------------------------------------------- 98 #let abnt-doc( 99 titulo: none, 100 numeracao: "1", 101 numeracao-secoes: "1.1", 102 pagina-inicial: none, 103 quebra-secoes: false, 104 entrelinha: 1.04em, 105 fonte: abnt-fonte-padrao, 106 capa: none, 107 sumario: false, 108 corpo, 109 ) = { 110 let num-pagina = if numeracao == "none" { none } else { numeracao } 111 let num-secao = if numeracao-secoes == "none" { none } else { numeracao-secoes } 112 let familia = if type(fonte) == str { (fonte, "Liberation Sans") } else { fonte } 113 114 set document(title: titulo) if titulo != none 115 116 // A4; margens: sup. 3 cm, inf. 2 cm, esq. 3 cm, dir. 2 cm 117 set page( 118 paper: "a4", 119 margin: (top: 3cm, left: 3cm, bottom: 2cm, right: 2cm), 120 numbering: num-pagina, 121 number-align: top + right, 122 ) 123 124 // Fonte 12 pt, pt-BR, sem hifenização 125 set text(font: familia, size: abnt-corpo, lang: "pt", region: "BR", hyphenate: false) 126 127 // Parágrafo: entrelinha 1,5, recuo 1,25 cm na 1ª linha, justificado 128 set par( 129 leading: entrelinha, 130 spacing: 1em, 131 justify: true, 132 first-line-indent: (amount: abnt-recuo, all: true), 133 ) 134 135 if pagina-inicial != none { 136 counter(page).update(pagina-inicial) 137 } 138 139 set heading(numbering: num-secao) 140 141 // Títulos: nível 1 = caixa alta + negrito; nível 2 = negrito; nível 3 = itálico 142 show heading: it => { 143 let numero = if it.numbering != none { 144 counter(heading).display(it.numbering) + h(0.5em) 145 } else { none } 146 147 let conteudo = if it.level == 1 { 148 text(weight: "bold", size: abnt-corpo)[#numero#upper(it.body)] 149 } else if it.level == 2 { 150 text(weight: "bold", size: abnt-corpo)[#numero#it.body] 151 } else { 152 text(weight: "regular", style: "italic", size: abnt-corpo)[#numero#it.body] 153 } 154 155 v(1em) 156 block(width: 100%)[ 157 #set par(first-line-indent: (amount: 0pt, all: true)) 158 #conteudo 159 ] 160 v(1em) 161 } 162 163 // Notas de rodapé: 10 pt, simples, sem recuo 164 show footnote.entry: set text(size: abnt-nota) 165 show footnote.entry: set footnote.entry(indent: 0pt, gap: 0.5em) 166 show footnote.entry: set par( 167 leading: abnt-simples, 168 spacing: 0pt, 169 first-line-indent: (amount: 0pt, all: true), 170 justify: true, 171 ) 172 173 // Citação direta longa (> ...): recuo 4 cm, 10 pt, simples, sem aspas 174 show quote.where(block: true): it => { 175 v(1em) 176 block(inset: (left: 4cm), width: 100%)[ 177 #set par(first-line-indent: (amount: 0pt, all: true), leading: abnt-simples, spacing: 0pt, justify: true) 178 #set text(size: abnt-nota) 179 #it.body 180 ] 181 v(1em) 182 } 183 184 if capa != none { 185 abnt-capa(..capa) 186 } 187 if sumario { 188 abnt-sumario() 189 } 190 191 corpo 192 } 193 194 // ---- Sumário ------------------------------------------------------- 195 #let abnt-sumario(titulo: "SUMÁRIO") = page(numbering: none)[ 196 #align(center)[#text(weight: "bold")[#titulo]] 197 #v(2em) 198 #set par(first-line-indent: (amount: 0pt, all: true)) 199 #outline(title: none, indent: auto) 200 ] 201 202 // ---- Referências: página nova + título ---------------------------- 203 #let abnt-referencias(titulo: "REFERÊNCIAS") = { 204 v(1em) 205 align(center)[#text(weight: "bold")[#titulo]] 206 v(1.5em) 207 } 208 209 // ---- Tabela (título acima, fonte abaixo, 10 pt) ------------------- 210 #let abnt-tabela(legenda: none, fonte: none, corpo) = block(breakable: false, width: 100%)[ 211 #set text(size: abnt-nota) 212 #set par(first-line-indent: (amount: 0pt, all: true), leading: abnt-simples, spacing: 0pt, justify: false) 213 #if legenda != none [#legenda #v(0.5em)] 214 #corpo 215 #if fonte != none [#v(0.5em) Fonte: #fonte] 216 ] 217 218 // ---- Figura (título abaixo, fonte depois, 10 pt) ------------------ 219 #let abnt-figura(legenda: none, fonte: none, corpo) = block(breakable: false, width: 100%)[ 220 #set text(size: abnt-nota) 221 #set par(first-line-indent: (amount: 0pt, all: true), leading: abnt-simples, spacing: 0pt, justify: false) 222 #align(center)[#corpo] 223 #v(0.5em) 224 #if legenda != none [#legenda] 225 #if fonte != none [\ Fonte: #fonte] 226 ] 227 228 // ============================================================ 229 // REFERÊNCIAS POR TIPO (NBR 6023 / Manual FACSUR) 230 // ============================================================ 231 232 #let _ref(chave, texto) = (chave: chave, texto: texto) 233 234 #let _chave(s) = { 235 let t = lower(s) 236 for p in ("o ", "a ", "os ", "as ", "um ", "uma ") { 237 if t.starts-with(p) { t = t.slice(p.len()) } 238 } 239 t 240 } 241 242 // Autor: sobrenome em caixa alta. Suporta múltiplos autores separados por ";". 243 #let _autor(a) = { 244 let autores = a.split(";") 245 autores.map(x => { 246 let x = x.trim() 247 if x == "et al." or x == "et al" { return x } 248 let p = x.split(",") 249 if p.len() > 1 { 250 upper(p.at(0).trim()) + "," + p.slice(1).join(",") 251 } else { 252 upper(x) 253 } 254 }).join("; ") 255 } 256 257 #let _dispo(url, acesso) = { 258 let d = if url != none { " Disponível em: " + url + "." } else { "" } 259 let a = if acesso != none { " Acesso em: " + acesso + "." } else { "" } 260 d + a 261 } 262 263 #let ref-livro(autor, titulo, local, editora, ano, 264 subtitulo: none, edicao: none, url: none, acesso: none, extra: none) = { 265 let st = if subtitulo != none { ": " + subtitulo } else { "" } 266 let ed = if edicao != none { " " + edicao + if edicao.ends-with(".") { "" } else { "." } } else { "" } 267 let ex = if extra != none { " " + extra } else { "" } 268 _ref(_chave(autor), [#_autor(autor). #text(weight: "bold")[#titulo#st].#ed #local: #editora, #(ano).#ex#_dispo(url, acesso)]) 269 } 270 271 #let ref-capitulo(autor, titulo, obra, organizador, local, editora, ano, 272 paginas: none, url: none, acesso: none) = { 273 let pg = if paginas != none { " p. " + paginas + "." } else { "" } 274 _ref(_chave(autor), [#_autor(autor). #titulo. In: #organizador. #text(weight: "bold")[#obra]. #local: #editora, #(ano).#pg#_dispo(url, acesso)]) 275 } 276 277 #let ref-artigo(autor, titulo, periodico, local, data, 278 volume: none, numero: none, paginas: none, url: none, acesso: none) = { 279 let v = if volume != none { ", v. " + volume } else { "" } 280 let n = if numero != none { ", n. " + numero } else { "" } 281 let pg = if paginas != none { ", p. " + paginas } else { "" } 282 _ref(_chave(autor), [#_autor(autor). #titulo. #text(weight: "bold")[#periodico], #local#v#n#pg, #(data).#_dispo(url, acesso)]) 283 } 284 285 #let ref-lei(titulo, local, publicacao, data, 286 jurisdicao: "BRASIL", ementa: none, url: none, acesso: none, formato: "diario") = { 287 let em = if ementa != none { " " + ementa + "." } else { "" } 288 let ref = if formato == "diario" { 289 [#jurisdicao. #titulo.#em #publicacao, #local, #(data).#_dispo(url, acesso)] 290 } else { 291 [#jurisdicao. #titulo.#em #local: #publicacao, #(data).#_dispo(url, acesso)] 292 } 293 _ref(jurisdicao + " " + titulo, ref) 294 } 295 296 #let ref-juris(tribunal, numero, relator, julgado, publicacao, 297 tipo: "Recurso Especial", jurisdicao: "BRASIL", orgao: none, url: none, acesso: none) = { 298 let og = if orgao != none { " " + orgao + "." } else { "" } 299 _ref(jurisdicao + " " + tribunal, [#jurisdicao. #tribunal. #text(weight: "bold")[#tipo nº #numero.] Relator: #relator.#og Julgado em: #julgado. #publicacao.#_dispo(url, acesso)]) 300 } 301 302 #let ref-site(titulo, site, ano, url, acesso, autor: none) = { 303 let pre = if autor != none { _autor(autor) + ". " } else { "" } 304 let chave = if autor != none { _chave(autor) } else { _chave(titulo) } 305 _ref(chave, [#pre#titulo. #text(weight: "bold")[#site], #(ano).#_dispo(url, acesso)]) 306 } 307 308 #let ref-doc(titulo, local, orgao, ano, 309 autor: none, url: none, acesso: none, nota: none) = { 310 let pre = if autor != none { _autor(autor) + ". " } else { "" } 311 let nt = if nota != none { " " + nota } else { "" } 312 let chave = if autor != none { _chave(autor) } else { _chave(titulo) } 313 _ref(chave, [#pre#titulo. #local: #orgao, #(ano).#nt#_dispo(url, acesso)]) 314 } 315 316 #let ref-texto(chave, texto) = _ref(_chave(chave), texto) 317 318 #let abnt-bibliografia(entradas, titulo: "REFERÊNCIAS", ordenar: false) = { 319 abnt-referencias(titulo: titulo) 320 set par(first-line-indent: (amount: 0pt, all: true), leading: abnt-simples, spacing: 1em, justify: false) 321 let lista = if ordenar { entradas.sorted(key: e => e.chave) } else { entradas } 322 for e in lista [ 323 #block(spacing: 1em)[#e.texto] 324 ] 325 }