diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/abntex2/tex |
Initial commit
Diffstat (limited to 'macros/latex/contrib/abntex2/tex')
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2-alf.bst | 2162 | ||||
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2-num.bst | 2162 | ||||
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2-options.bib | 216 | ||||
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2.cls | 1125 | ||||
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2abrev.sty | 124 | ||||
-rw-r--r-- | macros/latex/contrib/abntex2/tex/abntex2cite.sty | 1349 |
6 files changed, 7138 insertions, 0 deletions
diff --git a/macros/latex/contrib/abntex2/tex/abntex2-alf.bst b/macros/latex/contrib/abntex2/tex/abntex2-alf.bst new file mode 100644 index 0000000000..f3758383e9 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2-alf.bst @@ -0,0 +1,2162 @@ +%% abntex2-alf.bst, v-1.9.7 laurocesar +%% Copyright 2012-2018 by abnTeX2 group at http://www.abntex.net.br/ +%% +%% 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 +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the abnTeX2 team, led +%% by Lauro César Araujo. Further information are available on +%% http://www.abntex.net.br/ +%% +%% Creator and original mantainer: Gerald Weber <gweber@codigolivre.org.br> +%% Copyright 2001-2002 by the abnTeX group at http://abntex.codigolivre.org.br +%% +%% This file is an *extensive* modification from a file generated with the docstrip utility. +%% The original source files were: +%% merlin.mbs (with options: `babel,nm-revf,aunm-semi,nmlm,x3,m3,dt-end,yr-com,xmth,vnum-x,volp-com,jwdpg,jwdvol,num-xser,btit-rm,bt-rm,pg-bk,add-pub,pub-date,pub-xpar,pre-pub,isbn,issn,pp,ed,abr,ednx,nfss') +%% These sourefiles are copyrighted by Patrick W Daly + +ENTRY + { address author + booktitle booksubtitle + chapter conference-number conference-year conference-location + edition editor editortype + dimensions furtherresp + howpublished illustrated institution + isbn issn journal key month note marginnote number organization + org-short pages pagename + publisher reprinted-from reprinted-text school + series subtitle section title type url urlaccessdate + volume year year-presented + abnt-and-type + abnt-doi abnt-dont-use-etal + abnt-etal-cite abnt-etal-list abnt-etal-text abnt-emphasize abnt-experimental + abnt-full-initials + abnt-last-names abnt-ldots-type + abnt-missing-year abnt-cite-style abnt-no-etal-label abnt-note + abnt-repeated-author-omit abnt-repeated-title-omit + abnt-show-options abnt-refinfo abnt-thesis-year abnt-url-package + abnt-title-command + abnt-verbatim-entry + iso-abbreviation iso-author-punctuation iso-date-place + }{}{ label extra.label year.label} + +%revision string +STRINGS { abnt.bst.revision } + +%general purpose strings +STRINGS { r s t } + +%variables needed to implement the various abnt options +STRINGS {abnt.etal.text abnt.emphasize previous.author previous.title} +INTEGERS {abnt.alf abnt.cite.style abnt.doi + abnt.experimental abnt.etal.cite abnt.etal.list + abnt.full.initials + abnt.last.names abnt.ldots.type + abnt.missing.year + abnt.refinfo abnt.repeated.author.omit abnt.repeated.title.omit + abnt.show.options abnt.and.type + abnt.title.command + abnt.thesis.year + abnt.url.package abnt.verbatim.entry + iso.abbreviation iso.author.punctuation iso.date.place + repeated.author} + +%needed for title formatting +INTEGERS { title.lenght title.pos first.word no.bracket} +STRINGS { title.char} + +%needed for controlling the sentence position +INTEGERS {output.state before.all mid.sentence after.sentence after.block } + +%needed for url identification +INTEGERS {url.type} + +%static values for options +%values for abnt.doi +FUNCTION {abnt.doi.expand.to.url} {#0} %expands a doi address to its url correspondent +FUNCTION {abnt.doi.link} {#1} %links doi to its url correspondent +FUNCTION {abnt.doi.leave.as.is} {#2} %shows doi as is, external viewer will have + %to know what to do with a "doi:" document + +%values for url types +FUNCTION {unknown.url} {#0} +FUNCTION {http.url} {#1} +FUNCTION {file.url} {#2} +FUNCTION {ftp.url} {#3} +FUNCTION {doi.url} {#4} +FUNCTION {mailto.url} {#5} + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + +%output.nonnull decides what is written before the argument s, if a comma, period etc. +FUNCTION {output.nonnull} +{ 's := %the argument is written into s + output.state mid.sentence = + { ", " * write$ } %mid.sentence first write comma + { output.state after.block = + { add.period$ write$ newline$ } + { output.state before.all = 'write$ + { add.period$ " " * write$ } + if$} + if$ + mid.sentence 'output.state := } + if$ + s %now comes s +} +FUNCTION {output.nonnull.dash} +{ 's := %the argument is written into s + output.state mid.sentence = + { " --- " * write$ } %mid.sentence first write comma + { output.state after.block = + { add.period$ write$ newline$ write$} + { output.state before.all = 'write$ + { add.period$ " " * write$ } + if$} + if$ + mid.sentence 'output.state := } + if$ + s %now comes s +} +FUNCTION {output} %does nothing or calls output.nonull +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} +FUNCTION {output.dash} %does nothing or calls output.nonull +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.dash + if$ +} +FUNCTION {output.check} %like ouput, but complains if t empty +{ 't := + duplicate$ empty$ + { pop$ "campo " t * " vazio em " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} +FUNCTION {add.blank} { " " * before.all 'output.state :=} + +FUNCTION {date.block} {new.block} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { abnt.emphasize "{" * swap$ * "}" * } + if$ +} + + +FUNCTION {tie.or.space.prefix} %if text length less than 3 chars. uses a tie +{ duplicate$ text.length$ #5 < + { "~" } + { " " } + if$ + swap$ +} + +FUNCTION {no.space} { { "" } swap$ } + + +FUNCTION {space.word} { " " swap$ * " " * } + +FUNCTION {bbl.and} +{ abnt.and.type #0 = {" e "} 'skip$ if$ + abnt.and.type #1 = {" \& "} 'skip$ if$} +FUNCTION {bbl.chapter} { "cap." } +FUNCTION {bbl.colon} {": "} +FUNCTION {bbl.editors} { "Ed." } +FUNCTION {bbl.editor} { "Ed." } +FUNCTION {bbl.edby} { "editado por" } +FUNCTION {bbl.edition} { "ed." } +FUNCTION {bbl.empty} {""} +FUNCTION {bbl.etal}{abnt.etal.text "" = {""} {" " abnt.etal.text *} if$} +FUNCTION {bbl.doi.url} {"http://dx.doi.org/"} +FUNCTION {bbl.in}{ "In" iso.abbreviation 'skip$ { bbl.colon *} if$} +FUNCTION {bbl.ldots} %#0 use nothing, #1 use \ldots, #2 use $\ldots$, 3# use {...} +{abnt.ldots.type + {abnt.ldots.type #1 = {"\ldots"} 'skip$ if$ + abnt.ldots.type #2 = {"$\ldots$"} 'skip$ if$ + abnt.ldots.type #3 = {"{...}"} 'skip$ if$} + {""} %for #0 use nothing +if$} +FUNCTION {bbl.master} { "Mestrado" } +FUNCTION {bbl.missing.year} +{abnt.missing.year + {"[s.d.]"} %#1 + {""} %#0 + if$} +FUNCTION {bbl.monography} { "Monografia" } +FUNCTION {bbl.mthesis} { "Disserta\c{c}\~{a}o" } +FUNCTION {bbl.no.address} {"[S.l.]"} +FUNCTION {bbl.no.address.no.publisher} {"[S.l.: s.n.]"} +FUNCTION {bbl.no.publisher} {"[s.n.]"} +FUNCTION {bbl.number} { iso.abbreviation {"no."} {"n."} if$ } +FUNCTION {bbl.nr} { "n." } +FUNCTION {bbl.of} { "de" } +FUNCTION {bbl.phd} { "Doutorado" } +FUNCTION {bbl.phdthesis} { "Tese" } +FUNCTION {bbl.pages} + {pagename empty$ + { "p." } + {pagename} + if$ + } +FUNCTION {bbl.page} { bbl.pages } +FUNCTION {bbl.reprint} {"Separata de"} +FUNCTION {bbl.semicolon} { "; "} +FUNCTION {bbl.same.field} {"\underline{\ \ \ \ \ \ \ \ }"} +FUNCTION {bbl.techrep} { "Rel. Tec." } +FUNCTION {bbl.url.accessdate} + {iso.abbreviation { "Cited "} {"Acesso em: "} if$} +FUNCTION {bbl.url.available} +{ iso.abbreviation {"Available from Internet: "} {"Dispon{\'\i}vel em: "} if$} +FUNCTION {bbl.void} {""} +FUNCTION {bbl.volume} { iso.abbreviation {"vol."} {"v."} if$ } + + +MACRO {jan} {"jan."} +MACRO {feb} {"fev."} +MACRO {mar} {"mar."} +MACRO {apr} {"abr."} +MACRO {may} {"maio"} +MACRO {jun} {"jun."} +MACRO {jul} {"jul."} +MACRO {aug} {"ago."} +MACRO {sep} {"set."} +MACRO {oct} {"out."} +MACRO {nov} {"nov."} +MACRO {dec} {"dez."} + + +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} +FUNCTION {str.to.int} +{ duplicate$ is.num + {chr.to.int$ #48 -} + 'skip$ + if$ +} +FUNCTION {bibinfo.check} %usage: field "field" bibinfo.check +{ swap$ duplicate$ missing$ + {pop$ pop$ ""} + { duplicate$ empty$ + {swap$ pop$} + {swap$ pop$} + if$ + } + if$ +} +FUNCTION {bibinfo.warn} +{ swap$ + duplicate$ missing$ + {swap$ "faltando " swap$ * " em " * cite$ * warning$ pop$ ""} + { duplicate$ empty$ + {swap$ "vazio " swap$ * " em " * cite$ * warning$} + {swap$ pop$} + if$ + } + if$ +} + +FUNCTION {write.field.verbatim} +{ +duplicate$ missing$ + {pop$ pop$} + { + s text.length$ #0 > + {s "," * newline$ write$ "" 's :=} + 'skip$ + if$ + swap$ + "={" * swap$ * "}" * + s swap$ * 's := + } +if$ +} + +FUNCTION {write.entry.verbatim1} +{ + "address" address write.field.verbatim + "author" author write.field.verbatim + "booktitle" booktitle write.field.verbatim + "booksubtitle" booksubtitle write.field.verbatim + "chapter" chapter write.field.verbatim + "conference-number" conference-number write.field.verbatim + "conference-year" conference-year write.field.verbatim + "conference-location" conference-location write.field.verbatim + "edition" edition write.field.verbatim + "editor" editor write.field.verbatim + "editortype" editortype write.field.verbatim + "dimensions" dimensions write.field.verbatim + "furtherresp" furtherresp write.field.verbatim + "howpublished" howpublished write.field.verbatim + "illustrated" illustrated write.field.verbatim + "institution" institution write.field.verbatim + "isbn" isbn write.field.verbatim + "issn" issn write.field.verbatim + "journal" journal write.field.verbatim +} +FUNCTION {write.entry.verbatim2} +{ + "key" key write.field.verbatim + "month" month write.field.verbatim + "note" note write.field.verbatim + "marginnote" marginnote write.field.verbatim + "number" number write.field.verbatim + "organization" organization write.field.verbatim + "org-short" org-short write.field.verbatim + "pages" pages write.field.verbatim + "pagename" pagename write.field.verbatim + "publisher" publisher write.field.verbatim + "reprinted-from" reprinted-from write.field.verbatim + "reprinted-text" reprinted-text write.field.verbatim + "school" school write.field.verbatim + "series" series write.field.verbatim + "subtitle" subtitle write.field.verbatim + "section" section write.field.verbatim + "title" title write.field.verbatim + "type" type write.field.verbatim +} +FUNCTION {write.entry.verbatim3} +{ + "url" url write.field.verbatim + "urlaccessdate" urlaccessdate write.field.verbatim + "volume" volume write.field.verbatim + "year" year write.field.verbatim + "abnt-emphasize" abnt-emphasize write.field.verbatim + "abnt-experimental" abnt-experimental write.field.verbatim + "abnt-doi" abnt-doi write.field.verbatim + "abnt-dont-use-etal" abnt-dont-use-etal write.field.verbatim + "abnt-full-initials" abnt-full-initials write.field.verbatim + "abnt-ldots-type" abnt-ldots-type write.field.verbatim + "abnt-missing-year" abnt-missing-year write.field.verbatim + "abnt-cite-style" abnt-cite-style write.field.verbatim + "abnt-no-etal-label" abnt-no-etal-label write.field.verbatim + %abnt-note + "abnt-repeated-author-omit" abnt-repeated-author-omit write.field.verbatim + "abnt-repeated-title-omit" abnt-repeated-title-omit write.field.verbatim + "abnt-show-options" abnt-show-options write.field.verbatim + "abnt-refinfo" abnt-refinfo write.field.verbatim + "abnt-thesis-year" abnt-thesis-year write.field.verbatim + "abnt-title-command" abnt-title-command write.field.verbatim + "abnt-url-package" abnt-url-package write.field.verbatim + "abnt-verbatim-entry" abnt-verbatim-entry write.field.verbatim +} + +FUNCTION {write.entry.verbatim} +{"" 's := "" 't := + abnt.verbatim.entry + {"{\footnotesize\begin{verbatim}" newline$ write$ + "@" type$ * "{" * cite$ * 's := + write.entry.verbatim1 + write.entry.verbatim2 + write.entry.verbatim3 + s "" = {"}"} {s "}" *} if$ + newline$ write$ + "\end{verbatim}}" newline$ write$} + {newline$} +if$} + +STRINGS { bibinfo} +INTEGERS { nameptr namesleft numnames } + +FUNCTION {get.person} {"{vv }{ll}{, jj}{, ff}" format.name$} +FUNCTION {get.last.name} {#1 "{ll}" format.name$} +FUNCTION {get.first.name} {#1 "{ff}" format.name$} +FUNCTION {get.von} {#1 "{vv}" format.name$} +FUNCTION {get.jr} {#1 "{jj}" format.name$} +FUNCTION {is.composed.von} + {get.person + get.von duplicate$ empty$ {pop$ #0} + {duplicate$ + get.first.name empty$ not + swap$ get.last.name empty$ not and + } if$ + } + +FUNCTION {recompose.name} + {get.person duplicate$ duplicate$ duplicate$ + get.von #1 "{ll }" format.name$ swap$ + get.last.name * + swap$ #1 "{, ff}" format.name$ * + swap$ get.von #1 "{ ff}" format.name$ * + } + + +FUNCTION {format.single.name} +{ +s nameptr get.person 'r := +abnt.last.names + {r #1 "{ll}{ jj}" format.name$ "u" change.case$ + abnt.full.initials + {r #1 "{, ff}{ vv}" format.name$ *} + {r #1 "{, f.}{ vv}" format.name$ *} + if$} + {%r #1 is.composed.von {r #1 recompose.name 'r :=} 'skip$ if$ + r #1 "{ll}" format.name$ + #1 "{ll}" format.name$ + r #1 "{ jj}" format.name$ * "u" change.case$ + abnt.full.initials + {r #1 "{, ff}{ vv}" format.name$ * + r #1 "{ll}" format.name$ + #1 "{ ff}{ vv}" format.name$ *} + {iso.author.punctuation + {r #1 "{, f{}}{ vv}" format.name$ *} + {r #1 "{, f.}{ vv}" format.name$ *} if$ + r #1 "{ll}" format.name$ + #1 "{ f.}{ vv}" format.name$ *} + if$} + +if$ +} +FUNCTION {format.names} +{ 'bibinfo := duplicate$ empty$ 'skip$ + {'s := + "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { format.single.name + bibinfo bibinfo.check + 't := + nameptr #1 > + {nameptr #1 #1 + = numnames abnt.etal.list > and + {abnt.etal.list {"others" 't := #1 'namesleft :=} 'skip$ if$ } + 'skip$ + if$ + namesleft #1 > + { "; " * t * } + { numnames #2 > + { "" * } + 'skip$ + if$ + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { bbl.etal *} + { "; " * t *} + if$ } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ + } if$ +} + +%from plain.bst +FUNCTION {format.names.plain} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { ", " * t * } + { numnames #20 > + { "," * } + 'skip$ + if$ + t "others" = + { bbl.etal * } + { bbl.and * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} +FUNCTION {format.names.ed} {format.names} + +FUNCTION {format.authors} +{ +author "author" format.names +} + +FUNCTION {format.authors.plain} +{ +author format.names.plain +} + +FUNCTION {get.bbl.editor} { editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ } + + +FUNCTION {format.book.pages} +{ pages "pages" bibinfo.check duplicate$ empty$ + 'skip$ + { "~" * bbl.pages * } + if$ +} +FUNCTION {format.dimensions} +{ dimensions empty$ + 'skip$ + { dimensions output} + if$ +} +FUNCTION {format.furtherresp} +{ furtherresp empty$ + 'skip$ + { furtherresp output} + if$ +} +FUNCTION {format.illustrated} +{ illustrated missing$ + 'skip$ + {illustrated empty$ + {"il." output} + {illustrated output} + if$} + if$ +} +FUNCTION {format.isbn} +{ isbn "isbn" bibinfo.check duplicate$ empty$ + 'skip$ + {new.block "ISBN " swap$ *} + if$ +} + +FUNCTION {format.issn} +{ issn "issn" bibinfo.check + duplicate$ empty$ 'skip$ + {new.block "ISSN " swap$ *} + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check } + if$ +} + +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { howpublished #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ } + if$ + howpublished #2 global.max$ substring$ * "howpublished" bibinfo.check } + if$ +} + + +%ABNT styles require that the title acts as an author if +%typical author fields are absent. In this case the first +%word is uppercase. Our main problem is to establish what +%the first word actually is since portuguese uses accents. +%For example: Fun{\c c}\ão (Função) is a whole word but contains a +%space, but if we write Fun\c{c}\ão \c is converted to uppercase... +%You get the problem, don't you? +FUNCTION {format.title.as.author} +{ 's := %holds the title + #1 'title.pos := %our position in the title + #1 'first.word := %boolean, true if we already have the first word + #1 'no.bracket := %boolean, false if we are inside a {} + "" 't := %holds the first title.pos characters of the title + {first.word} + {s title.pos #1 substring$ 'title.char := + %checks if the character is a { + title.char "{" = {#0 'no.bracket :=} 'skip$ if$ + %if we are in a bracket + no.bracket 'skip$ {title.char "}" = {#1 'no.bracket :=} 'skip$ if$} if$ + type$ "journalpart" = + {title.char "." = title.char ":" = or title.char "!" = or + title.char "," = or title.char ";" = or title.char "?" = or} + {title.char " " =} + if$ s t = or no.bracket and + {#0 'first.word := + t title.char * "u" change.case$ + title.pos #1 + 'title.pos := + s title.pos global.max$ substring$ * 's :=} + {title.pos #1 + 'title.pos := t title.char * 't :=} + if$ + } + while$ +s +} + + +%compares current title with the title of the previous entry +FUNCTION {compare.title} +{abnt.repeated.title.omit + {duplicate$ "" = 'skip$ + {duplicate$ previous.title = repeated.author and + {duplicate$ 'previous.title := pop$ bbl.same.field} + {duplicate$ 'previous.title :=} + if$} + if$} + 'skip$ + if$ +} + +FUNCTION {apply.title.command} +{abnt.title.command + {duplicate$ empty$ 'skip$ + {"\bibtextitlecommand{" type$ * "}{" * swap$ * "}" *} + if$} + 'skip$ if$ +} + +FUNCTION {format.title} +{author empty$ editor empty$ and organization empty$ and + {title format.title.as.author} + {title duplicate$ empty$ {pop$ ""} {"t" change.case$} if$} + if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$ + apply.title.command + compare.title +} + +FUNCTION {n.dashify} +{ + 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {word.in} { bbl.in " " * } + +FUNCTION {format.month} +{ month empty$ 'skip$ + {month "month" bibinfo.check} + if$ +} + +FUNCTION {format.date} +{ year empty$ + { month empty$ + { bbl.missing.year } + { "existe o campo month (mês) mas não o campo year (ano) em " cite$ * warning$ month} + if$} + { month empty$ + { year n.dashify} + { month " " * year * } + if$} + if$ +} +FUNCTION {format.btitle} +{author empty$ editor empty$ and organization empty$ and + {title format.title.as.author "title" bibinfo.check duplicate$ empty$ 'skip$ {} if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$} + {title "title" bibinfo.check emphasize duplicate$ empty$ 'skip$ {} if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$} +if$ +apply.title.command +compare.title +} +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "não posso usar ambos " swap$ * " os campos em " * cite$ * warning$ } + if$ +} + +FUNCTION {format.volume} %leaves formatted or empty volume on the stack +{volume duplicate$ empty$ + 'skip$ + {volume #1 #1 substring$ is.num + {bbl.volume swap$ tie.or.space.prefix * *} + 'skip$ + if$} + if$ +} + +FUNCTION {format.number} %leaves formatted or empty number on the stack +{ number duplicate$ empty$ + 'skip$ + {bbl.number swap$ tie.or.space.prefix * *} + if$ +} + +FUNCTION {format.patent.number} +{ number +} + +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { format.volume + number empty$ 'skip$ {output format.number} if$ + series "series" bibinfo.check + duplicate$ empty$ 'pop$ + { swap$ bbl.of space.word * swap$ + emphasize * } + if$ + } + if$ +} + +FUNCTION {format.bvolume.if.no.series} +{ series empty$ + { format.bvolume } + { "" } + if$ +} + + +FUNCTION {format.number.or.volume} +{number empty$ + {format.volume} + {number} %we use the pure number here without leading "n." + if$ +} + +FUNCTION {format.volume.and.number} +{format.volume output + format.number +} + +FUNCTION {format.volume.number.series} +{ number empty$ volume empty$ and + { series empty$ + { "" } + {" (" series "series" bibinfo.check * ")" *} + if$} + { series empty$ + {""} %{ format.number.or.volume } + { " (" series "series" bibinfo.check * ", " * + format.number.or.volume * ")" * } + if$ } + if$ +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +FUNCTION {format.edition} +{ edition duplicate$ empty$ 'skip$ + {output.state mid.sentence = { "l" } { "t" } if$ change.case$ + "edition" bibinfo.check + edition #1 #1 substring$ is.num {". " * bbl.edition * } 'skip$ if$} + if$ +} +INTEGERS { multiresult } +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ } + while$ + multiresult +} +FUNCTION {format.pages} +{ pages duplicate$ empty$ 'skip$ + { duplicate$ multi.page.check + { n.dashify bbl.pages swap$} + { bbl.page swap$ } + if$ + tie.or.space.prefix "pages" bibinfo.check * * } + if$ +} +FUNCTION {format.journal.pages} +{ pages empty$ {""} + { pages n.dashify bbl.pages + swap$ tie.or.space.prefix "pages" bibinfo.check * *} + if$ +} + +FUNCTION {get.url.type} +{s #1 #5 substring$ "http:" = {http.url} + {s #1 #6 substring$ "https:" = {http.url} + {s #1 #5 substring$ "file:" = {file.url} + {s #1 #4 substring$ "ftp:" = {ftp.url} + {s #1 #4 substring$ "doi:" = {doi.url} + {s #1 #7 substring$ "mailto:" = {mailto.url} {unknown.url} if$} + if$} + if$} + if$} + if$} + if$ + 'url.type := +} + +FUNCTION {expand.doi} +{s +url.type doi.url = + {#5 global.max$ substring$ bbl.doi.url swap$ *} + 'skip$ if$ +} + +INTEGERS {url.pos url.length} +FUNCTION {filter.url.tex} +{s text.length$ #1 + 'url.length := + #1 'url.pos := "" 't := + {url.pos url.length <} + {s url.pos #1 substring$ + duplicate$ "_" = {pop$ "\underline{\ }" } 'skip$ if$ + duplicate$ "%" = {pop$ "\%" } 'skip$ if$ + duplicate$ "&" = {pop$ "\&" } 'skip$ if$ + duplicate$ "~" = {pop$ "\~{}" } 'skip$ if$ + duplicate$ "/" = {pop$ "\-/" } 'skip$ if$ + duplicate$ "." = {pop$ "\-." } 'skip$ if$ + duplicate$ "\" = {pop$ "{\textbackslash}" } 'skip$ if$ + duplicate$ "#" = {pop$ "\#" } 'skip$ if$ + duplicate$ "_" = {pop$ "\_" } 'skip$ if$ + t swap$ * 't := + url.pos #1 + 'url.pos := + } + while$ +t +} +FUNCTION {filter.url.html} +{s text.length$ #1 + 'url.length := + #1 'url.pos := "" 't := + {url.pos url.length <} + {s url.pos #1 substring$ + duplicate$ "%" = {pop$ "\%" } 'skip$ if$ + duplicate$ "#" = {pop$ "\#" } 'skip$ if$ + duplicate$ "_" = {pop$ "\_" } 'skip$ if$ + t swap$ * 't := + url.pos #1 + 'url.pos := + } + while$ +t +} + +FUNCTION {compose.url} +{'s := + get.url.type + bbl.url.available + abnt.url.package #0 = + { "$<$" * + abnt.doi abnt.doi.expand.to.url = 'expand.doi {s} if$ + * "$>$" *} 'skip$ if$ + abnt.url.package #1 = + { "\url{" * filter.url.html * "}" *} 'skip$ if$ + abnt.url.package #2 = + {url.type http.url = + {"\htmladdnormallink{$<$" * filter.url.tex * "$>$}{" * filter.url.html * "}" *} + 'skip$ if$ + url.type doi.url = url.type ftp.url = or url.type mailto.url = or + {"\htmladdnormallink{$<$" * + abnt.doi abnt.doi.expand.to.url = 'expand.doi {s} if$ + * "$>$}{" * + abnt.doi abnt.doi.leave.as.is = {s} 'expand.doi if$ + * "}" * } + 'skip$ if$ + url.type unknown.url = + {"$<$" * filter.url.tex * "$>$" *} + 'skip$ if$} 'skip$ if$ +} +FUNCTION {format.url} +{ url empty$ 'skip$ + {url compose.url output new.sentence } + if$ + urlaccessdate duplicate$ empty$ 'skip$ + { bbl.url.accessdate swap$ *} + if$ + "urlaccessdate" bibinfo.check output new.sentence +} + +FUNCTION {format.conference.info} +{ conference-number empty$ + 'skip$ + {conference-number "." * output} + if$ + conference-year empty$ + 'skip$ + {conference-year output} + if$ + conference-location empty$ + 'skip$ + {conference-location output} + if$ + new.sentence +} + + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { bbl.chapter } + { type "l" change.case$ + "type" bibinfo.check } + if$ + chapter tie.or.space.prefix "chapter" bibinfo.check * * + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ } + if$ +} + +FUNCTION {format.booktitle} +{author empty$ editor empty$ and organization empty$ and + {booktitle format.title.as.author "booktitle" bibinfo.check duplicate$ empty$ 'skip$ {} if$ + booksubtitle empty$ 'skip$ {booksubtitle ": " swap$ * "t" change.case$ * + apply.title.command} if$} + {booktitle "booktitle" bibinfo.check emphasize duplicate$ empty$ 'skip$ {} if$ + booksubtitle empty$ 'skip$ {booksubtitle ": " swap$ * "t" change.case$ * + apply.title.command} if$} +if$ +} +FUNCTION {format.editors} +{ editor empty$ + {"inbook" type$ = 'bbl.same.field 'skip$ if$} + {author empty$ + {editor "editor" format.names " (" * + editortype empty$ {bbl.editor} {editortype} if$ + ")" * * } + {"inbook" type$ = + {bbl.same.field } + {editor "editor" format.names " (" * + editortype empty$ {bbl.editor} {editortype} if$ + ")" * *} + if$} + if$} + if$ +} +FUNCTION {format.in.ed.booktitle} +{ editor empty$ + {organization empty$ not author empty$ not and %if one of two not empty + {word.in organization "u" change.case$ * output + format.conference.info + booktitle empty$ {""} {new.sentence format.booktitle} if$} + {word.in + organization empty$ author empty$ and 'skip$ + {"inbook" type$ = {bbl.same.field * output new.sentence ""} + 'skip$ if$ } if$ + booktitle empty$ 'skip$ {format.booktitle *} if$} + if$} + {word.in format.editors * output + booktitle empty$ {""} {new.sentence format.booktitle} if$} + if$ + output + new.sentence +} +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "todos os campos relevantes estão vazios ou faltando em " cite$ * warning$ } + 'skip$ + if$ +} +FUNCTION {format.type} +{ type "type" bibinfo.check + duplicate$ empty$ 'skip$ + {new.block "" swap$ * } + if$ +} + + +FUNCTION {format.year} +{year empty$ + { "campo year vazio ou faltando em " cite$ * + abnt.missing.year {" (vou colocar [s.d.])" *} 'skip$ if$ warning$ + abnt.missing.year {", " } {""} if$ bbl.missing.year *} + {year n.dashify "year" bibinfo.check} +if$ +} + +FUNCTION {format.year.presented} +{year-presented empty$ + {""} + {year-presented n.dashify} +if$ +} + +FUNCTION {format.field.address} +{ 't := + address empty$ organization empty$ and url empty$ and t empty$ and + {bbl.no.address.no.publisher} + {address empty$ + %if an url is present we don't give a missing address "[s.l.]" notice + {url empty$ {bbl.no.address ": "} {"" ""} if$} + {address ": "} + if$ + t empty$ + {%if an organization is present then it is OK not to have a publisher + organization empty$ {* bbl.no.publisher * } 'pop$ if$} + {* t * } + if$} + if$ +} + +FUNCTION {format.address} +{address empty$ + { bbl.no.address} + { address} + if$ +} + +FUNCTION {format.publisher.address} +{ publisher "publisher" bibinfo.check format.field.address} + +FUNCTION {format.publisher.address.relax} +{publisher empty$ address empty$ and {""} + {publisher "publisher" bibinfo.check format.field.address} +if$} + +FUNCTION {format.organization.address} +{ organization "organization" bibinfo.check format.field.address} + +%retains current authorship for future use +FUNCTION {compare.authorship} +{abnt.repeated.author.omit + {duplicate$ "" = 'skip$ + {duplicate$ previous.author = + {duplicate$ 'previous.author := + pop$ bbl.same.field + #1 'repeated.author :=} + {duplicate$ 'previous.author := + #0 'repeated.author :=} + if$} + if$} + 'skip$ + if$ +} + +FUNCTION {format.author.or.organization} +{ author empty$ + { organization empty$ 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.authors output.nonnull } + if$ + compare.authorship +} + + +FUNCTION {format.editor.or.organization} +{ editor empty$ + { organization empty$ 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.editors output.nonnull } + if$ + compare.authorship +} + +FUNCTION {format.author.or.editor.or.organization} +{ author empty$ + { editor empty$ + { organization empty$ + 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.editors output.nonnull } + if$} + { format.authors output.nonnull } + if$ + compare.authorship +} + +FUNCTION {format.reprint} +{ reprinted-text missing$ + {""} + {reprinted-text empty$ + {bbl.reprint} {reprinted-text} if$ + bbl.colon *} + if$ +} + +FUNCTION {format.journal} +{ + format.reprint + journal emphasize * +} + + +%generates the first label in \abntrefinfo to be used with \citeonline +FUNCTION {format.names.for.label1} %abnt-alf only +{ 's := "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + {abnt.last.names + {s nameptr "{ll}{ jj}" format.name$} + {s nameptr "{ll}" format.name$ #1 "{ll}" format.name$ + s nameptr "{ jj}" format.name$ *} + if$ + 't := + nameptr #1 > + {namesleft #1 > + { numnames abnt.etal.cite > abnt.etal.cite #0 = not and + {#0 'namesleft := abnt.etal.cite {bbl.etal *} 'skip$ if$} + {", " * t * } if$ } + { t "others" = + {abnt.etal.cite {bbl.etal *} 'skip$ if$} + {numnames nameptr = + {bbl.and * t *} + 'skip$ if$} + if$ + } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ +} + +%generates the second label in \abntrefinfo to be used with \cite +FUNCTION {format.names.for.label2} %abnt-alf only +{ 's := "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + {abnt.last.names + {s nameptr "{ll}{ jj}" format.name$} + {s nameptr "{ll}" format.name$ #1 "{ll}" format.name$ + s nameptr "{ jj}" format.name$ *} + if$ + abnt.cite.style #0 = {"u" change.case$} 'skip$ if$ 't := + nameptr #1 > + {namesleft #1 > + { numnames abnt.etal.cite > + {#0 'namesleft := abnt.etal.cite {bbl.etal *} 'skip$ if$} + {"; " * t * } if$ } + { t "OTHERS" = t "others" = or + {abnt.etal.cite {bbl.etal *} 'skip$ if$} + {numnames nameptr = { bbl.semicolon * t *} 'skip$ if$} + if$ + } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ +} + +FUNCTION {format.title.for.label} +{ 's := + #1 'title.pos := #1 'first.word := + "" 't := + {first.word} + {s title.pos #1 substring$ 'title.char := + title.char "." = title.char ":" = or title.char ";" = or + title.char "," = or title.char " " = or s t = or + {#0 'first.word := + title.pos #1 + 'title.pos :=} + {title.pos #1 + 'title.pos := t title.char * 't :=} + if$ + } + while$ +s t = %title equals first word, dont use bbl.ldots + {t "}{" * t + abnt.cite.style #0 = {"u" change.case$ * } 'skip$ if$} + {t bbl.ldots * "}{" * t + abnt.cite.style #0 = {"u" change.case$} 'skip$ if$ * bbl.ldots *} +if$ +} + +%cvs keys have the general form $key: value $ +INTEGERS {key.pos value.pos} +FUNCTION {extract.cvs.key} %we borrow the functionality of format.title.for.label +{ 's := %holds the entire cvs string + #1 'key.pos := + #0 'value.pos := %0= between first $ and :, 1=between : and second $, 2= at the end + "" 't := %holds the resulting value + {value.pos #0 = value.pos #1 = or} + { s key.pos #1 substring$ 'title.char := + value.pos #0 = + { title.char ":" = {#1 'value.pos := key.pos #1 + 'key.pos :=} 'skip$ if$} + { title.char "$" = + {#2 'value.pos :=} + {t title.char * 't :=} + if$} + if$ + key.pos #1 + 'key.pos := + } + while$ + t +} + +%generates and extended label of type {Author}{AUTHOR}{YEAR} +%for abnt.cite.style=1 they will be of type {Author}{Author}{YEAR} +%final result is placed into variable label +FUNCTION {calc.extended.label} +{ "{" + author empty$ not + {author format.names.for.label1 * "}{" * author format.names.for.label2 *} + {editor empty$ not + {editor format.names.for.label1 * "}{" * editor format.names.for.label2 *} + {org-short empty$ not + {org-short * "}{" * org-short "u" change.case$ *} + {organization empty$ not + {organization * "}{" * organization "u" change.case$ *} + {title empty$ not + {title format.title.for.label *} + {"nada}{NADA" *} + if$} + if$} + if$} + if$} + if$ + "}{" * + year empty$ 'skip$ {year *} if$ + 'label := %place the stack into label + % final } will be placed in reverse.pass +} +%generates and simple label of type "Author YEAR" +%final result is placed onto the stack +FUNCTION {calc.simple.label} +{ author empty$ not + {author format.names.for.label1} + {editor empty$ not + {editor format.names.for.label1} + {organization empty$ not + {organization} + {title empty$ not + {title} + {""} + if$} + if$} + if$} + if$ + year empty$ 'skip$ {" " * year *} if$ +} + +FUNCTION {output.bibitem} +{ newline$ + abnt.alf + {"\bibitem[" write$ + calc.simple.label + write$ "]{"} + {"\bibitem{"} + if$ + write$ cite$ write$ "}" write$ newline$ + abnt.refinfo #1 = {"\abntrefinfo" write$ label write$ newline$} 'skip$ if$ + "{" write$ + "" before.all 'output.state := +} +FUNCTION {output.hiddenbibitem} +{ newline$ + abnt.alf + {"\hiddenbibitem[" write$ + calc.simple.label + write$ "]{"} + {"\bibitem{"} + if$ + write$ cite$ write$ "}" write$ newline$ + abnt.refinfo #1 = {"\abntrefinfo" write$ label write$ newline$} 'skip$ if$ + "{" write$ + "" before.all 'output.state := +} +FUNCTION {fin.entry} +{ add.period$ write$ + reprinted-from empty$ 'skip$ + {" " reprinted-text empty$ + {bbl.reprint} {reprinted-text} if$ * bbl.colon * + "\abntreprintinfo{ " * reprinted-from * "}" * write$} + if$ + abnt-note empty$ 'skip$ + {"\footnote{" abnt-note * "}" * write$} if$ + "}" write$ + %newline$ + write.entry.verbatim +} + +FUNCTION { abnt.display.options} +{ 's := 't := + abnt.show.options #1 = % "warn" + {"opção " t * " passou para " * s * warning$ } 'skip$ if$ + + abnt.show.options #2 = % "list" + {"Op\c c\~ao selecionada {\tt " t * "=}\verb+" * s * "+" * output new.sentence } 'skip$ if$ +} + +FUNCTION { abnt-options1 } + { + abnt-show-options empty$ + 'skip$ + {abnt-show-options "no" = + {#0} {abnt-show-options "warn" = + {#1} {abnt-show-options "list" = + {#2 } {#0 } if$} if$} if$ + 'abnt.show.options :=} % #0 "no"; #1 "warn"; #2 "list" + if$ + + abnt.show.options #2 = + {output.bibitem "Mudan\c ca de estilo ap\'os este ponto com o comando \verb!\citeoption{" + cite$ * "}! " * + output new.sentence} 'skip$ if$ + + abnt-show-options empty$ + 'skip$ {"abnt-show-options" abnt-show-options abnt.display.options} if$ + + abnt-cite-style empty$ + 'skip$ + {abnt-cite-style "(AUTHOR, YEAR)" = + {#0 'abnt.cite.style :=} + {abnt-cite-style "(Author, YEAR)" = + {#1 'abnt.cite.style :=} + {"opção " abnt-cite-style * " desconhecida" * warning$} + if$} + if$ + "abnt-cite-style" abnt-cite-style abnt.display.options}if$ + + abnt-experimental empty$ + 'skip$ {abnt-experimental "yes" = 'abnt.experimental := + "abnt-experimental" abnt-experimental abnt.display.options} if$ + + abnt-emphasize duplicate$ empty$ + 'pop$ {'abnt.emphasize := + "abnt-emphasize" abnt.emphasize abnt.display.options + abnt-emphasize "\bf" = abnt-emphasize "\it" = or abnt-emphasize "\em" = or + abnt-emphasize "\bfseries" = or + {"não use " abnt-emphasize * " para abnt-emphasize em " * cite$ * + ", isto alterará TODO o texto. Use \textbf ou \emph. Veja a documentação abnt-bibtex-doc para mais detalhes." * warning$} + 'skip$ if$ + } if$ + + abnt-doi empty$ + 'skip$ + {abnt-doi "expand" = + {abnt.doi.expand.to.url 'abnt.doi :=} + {abnt-doi "link" = + {abnt.doi.link 'abnt.doi :=} + {abnt-doi "doi" = + {abnt.doi.leave.as.is 'abnt.doi :=} + {"opção " abnt-doi * " desconhecida" * warning$} + if$} + if$} + if$ + "abnt-doi" abnt-doi abnt.display.options}if$ + } +FUNCTION { abnt-options2 } + { + abnt-full-initials empty$ + 'skip$ {abnt-full-initials "yes" = 'abnt.full.initials := + "abnt-full-initials" abnt-full-initials abnt.display.options} if$ + + abnt-last-names empty$ + 'skip$ + {abnt-last-names "abnt" = {#0} + {abnt-last-names "bibtex" = {#1} {#0} if$} if$ + 'abnt.last.names := + "abnt-last-names" abnt-last-names abnt.display.options} + if$ + + + abnt-ldots-type empty$ + 'skip$ + {abnt-ldots-type "none" = {#0} + {abnt-ldots-type "normal" = {#1} + {abnt-ldots-type "math" = {#2} + {abnt-ldots-type "text" = {#1} {#0} + if$} if$} if$} if$ + 'abnt.ldots.type := + "abnt-ldots-type" abnt-ldots-type abnt.display.options} + if$ + + abnt-missing-year empty$ + 'skip$ + {abnt-missing-year "void" = {#0} + {abnt-missing-year "sd" = {#1} {#0} if$} + if$ + 'abnt.missing.year := + "abnt-missing-year" abnt-missing-year abnt.display.options} + if$ + + + abnt-and-type empty$ + 'skip$ {abnt-and-type "e" = + {#0} {abnt-and-type "&" = + {#1} {#0} if$} if$ + 'abnt.and.type := + "abnt-and-type" abnt-and-type abnt.display.options} + if$ + + abnt-thesis-year empty$ + 'skip$ {abnt-thesis-year "final" = + {#0} {abnt-thesis-year "title" = + {#1} {abnt-thesis-year "both" = + {#2} {#0} if$} if$} if$ + 'abnt.thesis.year := + "abnt-thesis-year" abnt-thesis-year abnt.display.options} + if$ + + abnt-refinfo empty$ + 'skip$ {abnt-refinfo "yes" = 'abnt.refinfo := + "abnt-refinfo" abnt-refinfo abnt.display.options} if$ +} +FUNCTION { abnt-options3 } + { + + abnt-dont-use-etal empty$ + 'skip$ {abnt-dont-use-etal "yes" = {#0 'abnt.etal.list :=} 'skip$ if$ + "Uso da opção abnt-dont-use-etal se tornou obsoleto, usamos abnt-etal-list." warning$ + "abnt-etal-list" abnt.etal.list int.to.str$ abnt.display.options} if$ + + abnt-etal-cite empty$ + 'skip$ {abnt-etal-cite str.to.int 'abnt.etal.cite := + "abnt-etal-cite" abnt.etal.cite int.to.str$ abnt.display.options} if$ + + abnt-etal-list empty$ + 'skip$ {abnt-etal-list str.to.int 'abnt.etal.list := + "abnt-etal-list" abnt.etal.list int.to.str$ abnt.display.options} if$ + + abnt-etal-text missing$ + 'skip$ {abnt-etal-text 'abnt.etal.text := + "abnt-etal-text" abnt.etal.text abnt.display.options} if$ + + abnt-no-etal-label empty$ + 'skip$ {abnt-no-etal-label "yes" = {#0 'abnt.etal.cite :=} 'skip$ if$ + "Uso da opção abnt-no-etal-label se tornou obsoleto, usamos abnt-etal-cite." warning$ + "abnt-etal-cite" abnt.etal.cite int.to.str$ abnt.display.options} if$ + + abnt-repeated-author-omit empty$ + 'skip$ {abnt-repeated-author-omit "yes" = + {#1 'abnt.repeated.author.omit :=} + {#0 'abnt.repeated.author.omit := "" 'previous.author :=} if$ + "abnt-repeated-author-omit" abnt-repeated-author-omit abnt.display.options} if$ + + abnt-repeated-title-omit empty$ 'skip$ + {abnt-repeated-title-omit "yes" = + {#1 'abnt.repeated.title.omit :=} + {#0 'abnt.repeated.title.omit := "" 'previous.title :=} if$ + "abnt-repeated-title-omit" abnt-repeated-title-omit abnt.display.options + abnt.repeated.author.omit not abnt.repeated.title.omit and + {"Use abnt-repeated-title-omit=yes junto com abnt-repeated-author-omit=yes" + warning$} 'skip$ if$} if$ + + abnt-title-command empty$ + 'skip$ {abnt-title-command "yes" = + {#1 'abnt.title.command :=} + {#0 'abnt.title.command :=} if$ + "abnt-title-command" abnt-title-command abnt.display.options} if$ + + abnt-url-package empty$ 'skip$ + {abnt-url-package "url" = + {#1 'abnt.url.package :=} + {abnt-url-package "hyperref" = {#2 'abnt.url.package :=} 'skip$ if$} + if$ + "abnt-url-package" abnt-url-package abnt.display.options} + if$ + + abnt-verbatim-entry empty$ + 'skip$ {abnt-verbatim-entry "yes" = 'abnt.verbatim.entry := + "abnt-verbatim-entry" abnt-verbatim-entry abnt.display.options} if$ + + abnt.show.options #2 = 'fin.entry 'skip$ if$ + } + +%we had to break this function in two parts because of the following message: +%Sorry---you've exceeded BibTeX's single function space 100 +%(That was a fatal error) +FUNCTION { iso-options1 } + { + iso-abbreviation empty$ + 'skip$ {iso-abbreviation "standard" = 'iso.abbreviation := + "iso-abbreviation" iso-abbreviation abnt.display.options} if$ + iso-author-punctuation empty$ + 'skip$ {iso-author-punctuation "void" = 'iso.author.punctuation := + "iso-author-punctuation" iso-author-punctuation abnt.display.options} if$ + iso-date-place empty$ + 'skip$ {iso-date-place "ISO" = 'iso.date.place := + "iso-date-place" iso-date-place abnt.display.options} if$ + } + +FUNCTION { abnt-options } + { + abnt-options1 + abnt-options2 + abnt-options3 + iso-options1 + } + +FUNCTION { iso-options } { abnt-options } + +FUNCTION { iso.year.label } +{ iso.date.place + { abnt.alf + {year.label output new.sentence} + 'skip$ if$} + 'skip$ if$} + +FUNCTION { iso.date } +{ iso.date.place + { abnt.alf + 'skip$ + {year output new.sentence} + if$} + 'skip$ if$} + +FUNCTION { non.iso.date } + {iso.date.place 'skip$ {format.date output} if$} + +FUNCTION {article} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.block + format.journal output + iso.date.place {format.year output} 'skip$ if$ + %iso.date.place {format.date output} 'skip$ if$ + %iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + % {format.year output new.sentence} if$ + section "section" bibinfo.check output.dash + publisher "publisher" bibinfo.check output + address "address" bibinfo.check output + format.volume output + format.number output + format.pages output + non.iso.date + format.issn output new.block + format.note output new.block + format.url + fin.entry +} +FUNCTION {book} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.volume output new.sentence + format.book.pages output + format.illustrated + format.dimensions new.sentence + format.howpublished output new.sentence + format.volume.number.series output new.sentence + format.note output + format.issn output %pode parecer curioso, mas revistas inteiras são tratadas como livro + format.isbn output new.sentence + format.url + fin.entry +} +FUNCTION {booklet} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.edition output new.sentence + address "address" bibinfo.check output + format.bvolume output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.book.pages output new.sentence + format.volume.number.series output new.sentence + format.note output + format.isbn output new.sentence + format.url + fin.entry +} + +FUNCTION {hidden} +{ output.hiddenbibitem + fin.entry} + +FUNCTION {inbook} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.block + format.in.ed.booktitle + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + %format.year output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.volume.number.series output + format.chapter.pages output new.sentence + format.isbn output new.block + format.note output new.block + format.url + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.in.ed.booktitle + format.edition output new.sentence + format.publisher.address output + %format.year output + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output} if$ + format.volume.number.series output new.sentence + format.bvolume.if.no.series output + format.chapter.pages output new.sentence + format.isbn output new.block + format.note output new.block + format.url + fin.entry +} +FUNCTION {inproceedings} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.in.ed.booktitle + format.publisher.address output + %format.year output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.volume.number.series output + format.pages output + format.isbn output + format.issn output new.sentence + format.note output new.sentence + format.url + fin.entry +} +FUNCTION {journalpart} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + format.volume output + format.number output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.date output new.sentence} if$ + format.book.pages output + format.illustrated + format.dimensions new.sentence + format.note output + format.issn output %pode parecer curioso, mas revistas inteiras são tratadas como livro + format.isbn output new.sentence + format.url + fin.entry +} +FUNCTION {conference} { inproceedings } +FUNCTION {manual} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.btitle "title" output.check new.block + format.furtherresp new.sentence + format.edition output new.sentence + format.address output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.book.pages output new.sentence + format.volume.number.series output new.sentence + format.note output new.sentence + format.url + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output + format.btitle output new.sentence + format.furtherresp new.sentence + format.publisher.address.relax output + %format.date output new.block + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.book.pages output new.sentence + format.illustrated + format.dimensions new.sentence + format.howpublished output new.block + format.volume.number.series output new.sentence + format.note output new.block + format.url + fin.entry + empty.misc.check +} + +FUNCTION {patent} +{ output.bibitem + format.editor.or.organization new.sentence + iso.year.label + format.authors.plain output new.sentence + format.btitle output new.sentence + format.furtherresp new.sentence + %format.date output new.block + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.patent.number output + format.howpublished output new.block + format.note output new.block + format.url + fin.entry + empty.misc.check +} + +FUNCTION {format.thesis.type} +{ type$ "phdthesis" = + {bbl.phdthesis} + {type$ "mastersthesis" = + {bbl.mthesis} + {type$ "monography" = + {bbl.monography} + {bbl.void} + if$} + if$} + if$ + type empty$ + {type missing$ + {type$ "phdthesis" = + { " (" bbl.phd * ")" *} + {type$ "mastersthesis" = { " (" bbl.master * ")" *} {pop$ ""} if$} + if$} + {""} + if$} + {type$ "thesis" = + {type} + {" (" type * ")" * "type" bibinfo.check} + if$} + if$ + * %joins first and second part of this function +} +FUNCTION {thesis} +{ output.bibitem + format.authors "author" output.check new.block + iso.year.label + format.btitle "title" output.check new.block + abnt.thesis.year #1 = abnt.thesis.year #2 = or + {format.date "year" output.check new.sentence} 'skip$ if$ + format.year.presented output new.sentence + format.book.pages output new.sentence + format.thesis.type output.nonnull + school "school" bibinfo.warn output.dash + address "address" bibinfo.check output + abnt.thesis.year #0 = abnt.thesis.year #2 = or + {format.date "year" output.check new.sentence} 'skip$ if$ + format.note output new.block + format.url + fin.entry +} + +FUNCTION {phdthesis} { thesis } +FUNCTION {mastersthesis} { thesis } +FUNCTION {monography} { thesis } + +FUNCTION {proceedings} +{ output.bibitem + iso.year.label + format.editor.or.organization + format.conference.info + format.btitle "title" output.check + format.bvolume output + format.volume.number.series output + editor empty$ + { publisher empty$ + 'skip$ + { new.sentence format.publisher.address output format.year output} + if$ + } + { publisher empty$ + { new.sentence + format.organization.address output format.year output} + { new.sentence + organization "organization" bibinfo.check output + format.publisher.address output format.year output} + if$ } + if$ + new.sentence format.book.pages output new.sentence + format.isbn output + format.issn output new.block + format.note output new.block + format.url + fin.entry +} + +FUNCTION {techreport} {manual} + +FUNCTION {unpublished} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.note "note" output.check new.sentence + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.url + fin.entry +} + +FUNCTION {default.type} { misc } +READ +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} +INTEGERS { len } +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { format.single.name 't := + nameptr #1 > + { + nameptr #3 + #1 + = + numnames #3 + > and + { "others" 't := + #1 'namesleft := } + 'skip$ + if$ + " " * + namesleft #1 = t "others" = and + { "zzzzz" * } + { t sortify * } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} +FUNCTION {any.sort} +{ author empty$ + { organization empty$ + { editor empty$ + { title empty$ + { key empty$ + { "para ordenar, precisa dos campos author, organization, editor, title ou key in " cite$ * warning$ ""} + { key sortify } + if$} + { title sortify} + if$} + { editor sort.format.names } + if$} + { organization sortify } + if$} + { author sort.format.names } +if$ +} + +FUNCTION {presort} +{ + any.sort + " " * year field.or.null sortify * " " * title field.or.null + sort.format.title * #1 entry.max$ substring$ + %for non-alpha style we drop a void sort.key such that SORT has no effect + abnt.alf 'skip$ {pop$ ""} if$ 'sort.key$ := + year empty$ {""} {year} if$ 'year.label := + calc.extended.label +} + +FUNCTION {set.default.abnt.variables} +{ %if you change abnt-num to abnt-alf by hand you need also to change + %the name of RCSfile by hand, otherwise cvs takes care of it. + % + "$RCSfile: abnt-alf.bst,v $ " extract.cvs.key + % + "abnt-alf.bst,v " = 'abnt.alf := % #1 para abnt-alf #0 para abnt-num + "$Revision: v-1.9.7 $" extract.cvs.key 'abnt.bst.revision := + #0 'abnt.and.type := % #0 "e"; #1 "&" + "\emph" 'abnt.emphasize := + #0 'abnt.cite.style := %default norm version for NBR10520 + %#0 \cite=(AUTHOR, YEAR) + %#1 \cite=(Author, YEAR) + #0 'abnt.experimental := + abnt.doi.expand.to.url 'abnt.doi := + #3 'abnt.etal.cite := + #3 'abnt.etal.list := + "et al." 'abnt.etal.text := + #0 'abnt.full.initials := + #0 'abnt.last.names := %#0 abnt-style, #1 bibtex-style + #1 'abnt.ldots.type := %#0 use nothing, #1 use \ldots, #2 use $\ldots$, 3# use {...} + #0 'abnt.missing.year := %#0 "void"; #1 "[s.d.]" + #0 'repeated.author := + #0 'abnt.repeated.author.omit := + #0 'abnt.repeated.title.omit := + #1 'abnt.refinfo := + #0 'abnt.show.options := % #0 "no"; #1 "warn"; #2 "list" + #0 'abnt.thesis.year := % #0 "final"; #1 "title"; #2 "both" + #0 'abnt.title.command := % #0 "no"; #1 "yes" + #0 'abnt.url.package := % #0 "none"'; #2 "url"; #2 "hyperref" + #0 'abnt.verbatim.entry := +} +FUNCTION {set.default.iso.variables} +{ #0 'iso.abbreviation := % #0 ABNT-style; #1 ISO-style + #0 'iso.author.punctuation := % #0 ABNT (Smith, A. B.); #1 ISO (Smith, AB) + #0 'iso.date.place := % #0 ABNT-sty; #1 ISO-style +} +EXECUTE {set.default.abnt.variables} +EXECUTE {set.default.iso.variables} +FUNCTION {process.early.abnt.options} +{%here we intercept all entries which need priority handling + %note: we cannot use type$ at this point + abnt-and-type missing$ + abnt-experimental missing$ and + abnt-etal-cite missing$ and + abnt-etal-text missing$ and + abnt-ldots-type missing$ and + abnt-cite-style missing$ and + abnt-no-etal-label missing$ and + abnt-title-command missing$ and + 'skip$ {call.type$} if$ +} +ITERATE {process.early.abnt.options} +FUNCTION {search.reprinted} +{ reprinted-from missing$ 'skip$ + {"\nocite{" reprinted-from * "}" * write$ newline$ + } + if$ +} +ITERATE {search.reprinted} +FUNCTION {abntreprintinfo} +{"\providecommand{\abntreprintinfo}[1]{%" write$ newline$ + " \citeonline{#1}}" write$ newline$} +EXECUTE {abntreprintinfo} +ITERATE {presort} +SORT +STRINGS { last.label next.extra} +INTEGERS { last.extra.num } +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + label extra.label * 'label := + year.label extra.label * 'year.label := + extra.label 'next.extra := + label "}" * 'label := +} +ITERATE {forward.pass} +REVERSE {reverse.pass} +FUNCTION {begin.bib} +{ + abnt.alf + {"\setlength{\labelsep}{0pt}" write$} + 'skip$ + if$ + "\begin{thebibliography}{}" write$ newline$ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + abnt.refinfo #1 = + {"\providecommand{\abntrefinfo}[3]{}" write$ newline$} + 'skip$ if$ + "\providecommand{\abntbstabout}[1]{}" write$ newline$ + abnt.title.command + {"\providecommand{\bibtextitlecommand}[2]{#2}" write$ newline$} + 'skip$ if$ + "\abntbstabout{" abnt.bst.revision * "}" * write$ newline$ + %Se você não usa abntcite e precisa que a margem direita não + %seja justificada, descomente a linha seguinte + %alternativamente coloque \bibliography{abnt-nrj,... +% "\setlength{\rightskip}{0pt plus 2cm}" write$ newline$ +} +EXECUTE {begin.bib} +EXECUTE {init.state.consts} +FUNCTION {process.entry}{call.type$} +ITERATE {process.entry} +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ +} +EXECUTE {end.bib} +FUNCTION {apresentacao} +{ "+---------------------------------------------------------+" + "| http://www.abntex.net.br/ |" + "| Em caso de dúvidas ou problemas com este estilo procure |" + abnt.alf + {"| Estilo bibliográfico abntex2-alf.bst versão " abnt.bst.revision * " |" *} + {"| Estilo bibliográfico abntex2-num.bst versão " abnt.bst.revision * " |" *} + if$ + "+---------------------------------------------------------+" + stack$ +} +EXECUTE{apresentacao} diff --git a/macros/latex/contrib/abntex2/tex/abntex2-num.bst b/macros/latex/contrib/abntex2/tex/abntex2-num.bst new file mode 100644 index 0000000000..fa3a9a0324 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2-num.bst @@ -0,0 +1,2162 @@ +%% abntex2-num.bst, v-1.9.7 laurocesar +%% Copyright 2012-2018 by abnTeX2 group at http://www.abntex.net.br/ +%% +%% 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 +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the abnTeX2 team, led +%% by Lauro César Araujo. Further information are available on +%% http://www.abntex.net.br/ +%% +%% Creator and original mantainer: Gerald Weber <gweber@codigolivre.org.br> +%% Copyright 2001-2003 by the abnTeX group at http://abntex.codigolivre.org.br +%% +%% This file is an *extensive* modification from a file generated with the docstrip utility. +%% The original source files were: +%% merlin.mbs (with options: `babel,nm-revf,aunm-semi,nmlm,x3,m3,dt-end,yr-com,xmth,vnum-x,volp-com,jwdpg,jwdvol,num-xser,btit-rm,bt-rm,pg-bk,add-pub,pub-date,pub-xpar,pre-pub,isbn,issn,pp,ed,abr,ednx,nfss') +%% These sourefiles are copyrighted by Patrick W Daly + +ENTRY + { address author + booktitle booksubtitle + chapter conference-number conference-year conference-location + edition editor editortype + dimensions furtherresp + howpublished illustrated institution + isbn issn journal key month note marginnote number organization + org-short pages pagename + publisher reprinted-from reprinted-text school + series subtitle section title type url urlaccessdate + volume year year-presented + abnt-and-type + abnt-doi abnt-dont-use-etal + abnt-etal-cite abnt-etal-list abnt-etal-text abnt-emphasize abnt-experimental + abnt-full-initials + abnt-last-names abnt-ldots-type + abnt-missing-year abnt-cite-style abnt-no-etal-label abnt-note + abnt-repeated-author-omit abnt-repeated-title-omit + abnt-show-options abnt-refinfo abnt-thesis-year abnt-url-package + abnt-title-command + abnt-verbatim-entry + iso-abbreviation iso-author-punctuation iso-date-place + }{}{ label extra.label year.label} + +%revision string +STRINGS { abnt.bst.revision } + +%general purpose strings +STRINGS { r s t } + +%variables needed to implement the various abnt options +STRINGS {abnt.etal.text abnt.emphasize previous.author previous.title} +INTEGERS {abnt.alf abnt.cite.style abnt.doi + abnt.experimental abnt.etal.cite abnt.etal.list + abnt.full.initials + abnt.last.names abnt.ldots.type + abnt.missing.year + abnt.refinfo abnt.repeated.author.omit abnt.repeated.title.omit + abnt.show.options abnt.and.type + abnt.title.command + abnt.thesis.year + abnt.url.package abnt.verbatim.entry + iso.abbreviation iso.author.punctuation iso.date.place + repeated.author} + +%needed for title formatting +INTEGERS { title.lenght title.pos first.word no.bracket} +STRINGS { title.char} + +%needed for controlling the sentence position +INTEGERS {output.state before.all mid.sentence after.sentence after.block } + +%needed for url identification +INTEGERS {url.type} + +%static values for options +%values for abnt.doi +FUNCTION {abnt.doi.expand.to.url} {#0} %expands a doi address to its url correspondent +FUNCTION {abnt.doi.link} {#1} %links doi to its url correspondent +FUNCTION {abnt.doi.leave.as.is} {#2} %shows doi as is, external viewer will have + %to know what to do with a "doi:" document + +%values for url types +FUNCTION {unknown.url} {#0} +FUNCTION {http.url} {#1} +FUNCTION {file.url} {#2} +FUNCTION {ftp.url} {#3} +FUNCTION {doi.url} {#4} +FUNCTION {mailto.url} {#5} + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + +%output.nonnull decides what is written before the argument s, if a comma, period etc. +FUNCTION {output.nonnull} +{ 's := %the argument is written into s + output.state mid.sentence = + { ", " * write$ } %mid.sentence first write comma + { output.state after.block = + { add.period$ write$ newline$ } + { output.state before.all = 'write$ + { add.period$ " " * write$ } + if$} + if$ + mid.sentence 'output.state := } + if$ + s %now comes s +} +FUNCTION {output.nonnull.dash} +{ 's := %the argument is written into s + output.state mid.sentence = + { " --- " * write$ } %mid.sentence first write comma + { output.state after.block = + { add.period$ write$ newline$ write$} + { output.state before.all = 'write$ + { add.period$ " " * write$ } + if$} + if$ + mid.sentence 'output.state := } + if$ + s %now comes s +} +FUNCTION {output} %does nothing or calls output.nonull +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} +FUNCTION {output.dash} %does nothing or calls output.nonull +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.dash + if$ +} +FUNCTION {output.check} %like ouput, but complains if t empty +{ 't := + duplicate$ empty$ + { pop$ "campo " t * " vazio em " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} +FUNCTION {add.blank} { " " * before.all 'output.state :=} + +FUNCTION {date.block} {new.block} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { abnt.emphasize "{" * swap$ * "}" * } + if$ +} + + +FUNCTION {tie.or.space.prefix} %if text length less than 3 chars. uses a tie +{ duplicate$ text.length$ #5 < + { "~" } + { " " } + if$ + swap$ +} + +FUNCTION {no.space} { { "" } swap$ } + + +FUNCTION {space.word} { " " swap$ * " " * } + +FUNCTION {bbl.and} +{ abnt.and.type #0 = {" e "} 'skip$ if$ + abnt.and.type #1 = {" \& "} 'skip$ if$} +FUNCTION {bbl.chapter} { "cap." } +FUNCTION {bbl.colon} {": "} +FUNCTION {bbl.editors} { "Ed." } +FUNCTION {bbl.editor} { "Ed." } +FUNCTION {bbl.edby} { "editado por" } +FUNCTION {bbl.edition} { "ed." } +FUNCTION {bbl.empty} {""} +FUNCTION {bbl.etal}{abnt.etal.text "" = {""} {" " abnt.etal.text *} if$} +FUNCTION {bbl.doi.url} {"http://dx.doi.org/"} +FUNCTION {bbl.in}{ "In" iso.abbreviation 'skip$ { bbl.colon *} if$} +FUNCTION {bbl.ldots} %#0 use nothing, #1 use \ldots, #2 use $\ldots$, 3# use {...} +{abnt.ldots.type + {abnt.ldots.type #1 = {"\ldots"} 'skip$ if$ + abnt.ldots.type #2 = {"$\ldots$"} 'skip$ if$ + abnt.ldots.type #3 = {"{...}"} 'skip$ if$} + {""} %for #0 use nothing +if$} +FUNCTION {bbl.master} { "Mestrado" } +FUNCTION {bbl.missing.year} +{abnt.missing.year + {"[s.d.]"} %#1 + {""} %#0 + if$} +FUNCTION {bbl.monography} { "Monografia" } +FUNCTION {bbl.mthesis} { "Disserta\c{c}\~{a}o" } +FUNCTION {bbl.no.address} {"[S.l.]"} +FUNCTION {bbl.no.address.no.publisher} {"[S.l.: s.n.]"} +FUNCTION {bbl.no.publisher} {"[s.n.]"} +FUNCTION {bbl.number} { iso.abbreviation {"no."} {"n."} if$ } +FUNCTION {bbl.nr} { "n." } +FUNCTION {bbl.of} { "de" } +FUNCTION {bbl.phd} { "Doutorado" } +FUNCTION {bbl.phdthesis} { "Tese" } +FUNCTION {bbl.pages} + {pagename empty$ + { "p." } + {pagename} + if$ + } +FUNCTION {bbl.page} { bbl.pages } +FUNCTION {bbl.reprint} {"Separata de"} +FUNCTION {bbl.semicolon} { "; "} +FUNCTION {bbl.same.field} {"\underline{\ \ \ \ \ \ \ \ }"} +FUNCTION {bbl.techrep} { "Rel. Tec." } +FUNCTION {bbl.url.accessdate} + {iso.abbreviation { "Cited "} {"Acesso em: "} if$} +FUNCTION {bbl.url.available} +{ iso.abbreviation {"Available from Internet: "} {"Dispon{\'\i}vel em: "} if$} +FUNCTION {bbl.void} {""} +FUNCTION {bbl.volume} { iso.abbreviation {"vol."} {"v."} if$ } + + +MACRO {jan} {"jan."} +MACRO {feb} {"fev."} +MACRO {mar} {"mar."} +MACRO {apr} {"abr."} +MACRO {may} {"maio"} +MACRO {jun} {"jun."} +MACRO {jul} {"jul."} +MACRO {aug} {"ago."} +MACRO {sep} {"set."} +MACRO {oct} {"out."} +MACRO {nov} {"nov."} +MACRO {dec} {"dez."} + + +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} +FUNCTION {str.to.int} +{ duplicate$ is.num + {chr.to.int$ #48 -} + 'skip$ + if$ +} +FUNCTION {bibinfo.check} %usage: field "field" bibinfo.check +{ swap$ duplicate$ missing$ + {pop$ pop$ ""} + { duplicate$ empty$ + {swap$ pop$} + {swap$ pop$} + if$ + } + if$ +} +FUNCTION {bibinfo.warn} +{ swap$ + duplicate$ missing$ + {swap$ "faltando " swap$ * " em " * cite$ * warning$ pop$ ""} + { duplicate$ empty$ + {swap$ "vazio " swap$ * " em " * cite$ * warning$} + {swap$ pop$} + if$ + } + if$ +} + +FUNCTION {write.field.verbatim} +{ +duplicate$ missing$ + {pop$ pop$} + { + s text.length$ #0 > + {s "," * newline$ write$ "" 's :=} + 'skip$ + if$ + swap$ + "={" * swap$ * "}" * + s swap$ * 's := + } +if$ +} + +FUNCTION {write.entry.verbatim1} +{ + "address" address write.field.verbatim + "author" author write.field.verbatim + "booktitle" booktitle write.field.verbatim + "booksubtitle" booksubtitle write.field.verbatim + "chapter" chapter write.field.verbatim + "conference-number" conference-number write.field.verbatim + "conference-year" conference-year write.field.verbatim + "conference-location" conference-location write.field.verbatim + "edition" edition write.field.verbatim + "editor" editor write.field.verbatim + "editortype" editortype write.field.verbatim + "dimensions" dimensions write.field.verbatim + "furtherresp" furtherresp write.field.verbatim + "howpublished" howpublished write.field.verbatim + "illustrated" illustrated write.field.verbatim + "institution" institution write.field.verbatim + "isbn" isbn write.field.verbatim + "issn" issn write.field.verbatim + "journal" journal write.field.verbatim +} +FUNCTION {write.entry.verbatim2} +{ + "key" key write.field.verbatim + "month" month write.field.verbatim + "note" note write.field.verbatim + "marginnote" marginnote write.field.verbatim + "number" number write.field.verbatim + "organization" organization write.field.verbatim + "org-short" org-short write.field.verbatim + "pages" pages write.field.verbatim + "pagename" pagename write.field.verbatim + "publisher" publisher write.field.verbatim + "reprinted-from" reprinted-from write.field.verbatim + "reprinted-text" reprinted-text write.field.verbatim + "school" school write.field.verbatim + "series" series write.field.verbatim + "subtitle" subtitle write.field.verbatim + "section" section write.field.verbatim + "title" title write.field.verbatim + "type" type write.field.verbatim +} +FUNCTION {write.entry.verbatim3} +{ + "url" url write.field.verbatim + "urlaccessdate" urlaccessdate write.field.verbatim + "volume" volume write.field.verbatim + "year" year write.field.verbatim + "abnt-emphasize" abnt-emphasize write.field.verbatim + "abnt-experimental" abnt-experimental write.field.verbatim + "abnt-doi" abnt-doi write.field.verbatim + "abnt-dont-use-etal" abnt-dont-use-etal write.field.verbatim + "abnt-full-initials" abnt-full-initials write.field.verbatim + "abnt-ldots-type" abnt-ldots-type write.field.verbatim + "abnt-missing-year" abnt-missing-year write.field.verbatim + "abnt-cite-style" abnt-cite-style write.field.verbatim + "abnt-no-etal-label" abnt-no-etal-label write.field.verbatim + %abnt-note + "abnt-repeated-author-omit" abnt-repeated-author-omit write.field.verbatim + "abnt-repeated-title-omit" abnt-repeated-title-omit write.field.verbatim + "abnt-show-options" abnt-show-options write.field.verbatim + "abnt-refinfo" abnt-refinfo write.field.verbatim + "abnt-thesis-year" abnt-thesis-year write.field.verbatim + "abnt-title-command" abnt-title-command write.field.verbatim + "abnt-url-package" abnt-url-package write.field.verbatim + "abnt-verbatim-entry" abnt-verbatim-entry write.field.verbatim +} + +FUNCTION {write.entry.verbatim} +{"" 's := "" 't := + abnt.verbatim.entry + {"{\footnotesize\begin{verbatim}" newline$ write$ + "@" type$ * "{" * cite$ * 's := + write.entry.verbatim1 + write.entry.verbatim2 + write.entry.verbatim3 + s "" = {"}"} {s "}" *} if$ + newline$ write$ + "\end{verbatim}}" newline$ write$} + {newline$} +if$} + +STRINGS { bibinfo} +INTEGERS { nameptr namesleft numnames } + +FUNCTION {get.person} {"{vv }{ll}{, jj}{, ff}" format.name$} +FUNCTION {get.last.name} {#1 "{ll}" format.name$} +FUNCTION {get.first.name} {#1 "{ff}" format.name$} +FUNCTION {get.von} {#1 "{vv}" format.name$} +FUNCTION {get.jr} {#1 "{jj}" format.name$} +FUNCTION {is.composed.von} + {get.person + get.von duplicate$ empty$ {pop$ #0} + {duplicate$ + get.first.name empty$ not + swap$ get.last.name empty$ not and + } if$ + } + +FUNCTION {recompose.name} + {get.person duplicate$ duplicate$ duplicate$ + get.von #1 "{ll }" format.name$ swap$ + get.last.name * + swap$ #1 "{, ff}" format.name$ * + swap$ get.von #1 "{ ff}" format.name$ * + } + + +FUNCTION {format.single.name} +{ +s nameptr get.person 'r := +abnt.last.names + {r #1 "{ll}{ jj}" format.name$ "u" change.case$ + abnt.full.initials + {r #1 "{, ff}{ vv}" format.name$ *} + {r #1 "{, f.}{ vv}" format.name$ *} + if$} + {%r #1 is.composed.von {r #1 recompose.name 'r :=} 'skip$ if$ + r #1 "{ll}" format.name$ + #1 "{ll}" format.name$ + r #1 "{ jj}" format.name$ * "u" change.case$ + abnt.full.initials + {r #1 "{, ff}{ vv}" format.name$ * + r #1 "{ll}" format.name$ + #1 "{ ff}{ vv}" format.name$ *} + {iso.author.punctuation + {r #1 "{, f{}}{ vv}" format.name$ *} + {r #1 "{, f.}{ vv}" format.name$ *} if$ + r #1 "{ll}" format.name$ + #1 "{ f.}{ vv}" format.name$ *} + if$} + +if$ +} +FUNCTION {format.names} +{ 'bibinfo := duplicate$ empty$ 'skip$ + {'s := + "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { format.single.name + bibinfo bibinfo.check + 't := + nameptr #1 > + {nameptr #1 #1 + = numnames abnt.etal.list > and + {abnt.etal.list {"others" 't := #1 'namesleft :=} 'skip$ if$ } + 'skip$ + if$ + namesleft #1 > + { "; " * t * } + { numnames #2 > + { "" * } + 'skip$ + if$ + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { bbl.etal *} + { "; " * t *} + if$ } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ + } if$ +} + +%from plain.bst +FUNCTION {format.names.plain} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { ", " * t * } + { numnames #20 > + { "," * } + 'skip$ + if$ + t "others" = + { bbl.etal * } + { bbl.and * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} +FUNCTION {format.names.ed} {format.names} + +FUNCTION {format.authors} +{ +author "author" format.names +} + +FUNCTION {format.authors.plain} +{ +author format.names.plain +} + +FUNCTION {get.bbl.editor} { editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ } + + +FUNCTION {format.book.pages} +{ pages "pages" bibinfo.check duplicate$ empty$ + 'skip$ + { "~" * bbl.pages * } + if$ +} +FUNCTION {format.dimensions} +{ dimensions empty$ + 'skip$ + { dimensions output} + if$ +} +FUNCTION {format.furtherresp} +{ furtherresp empty$ + 'skip$ + { furtherresp output} + if$ +} +FUNCTION {format.illustrated} +{ illustrated missing$ + 'skip$ + {illustrated empty$ + {"il." output} + {illustrated output} + if$} + if$ +} +FUNCTION {format.isbn} +{ isbn "isbn" bibinfo.check duplicate$ empty$ + 'skip$ + {new.block "ISBN " swap$ *} + if$ +} + +FUNCTION {format.issn} +{ issn "issn" bibinfo.check + duplicate$ empty$ 'skip$ + {new.block "ISSN " swap$ *} + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check } + if$ +} + +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { howpublished #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ } + if$ + howpublished #2 global.max$ substring$ * "howpublished" bibinfo.check } + if$ +} + + +%ABNT styles require that the title acts as an author if +%typical author fields are absent. In this case the first +%word is uppercase. Our main problem is to establish what +%the first word actually is since portuguese uses accents. +%For example: Fun{\c c}\ão (Função) is a whole word but contains a +%space, but if we write Fun\c{c}\ão \c is converted to uppercase... +%You get the problem, don't you? +FUNCTION {format.title.as.author} +{ 's := %holds the title + #1 'title.pos := %our position in the title + #1 'first.word := %boolean, true if we already have the first word + #1 'no.bracket := %boolean, false if we are inside a {} + "" 't := %holds the first title.pos characters of the title + {first.word} + {s title.pos #1 substring$ 'title.char := + %checks if the character is a { + title.char "{" = {#0 'no.bracket :=} 'skip$ if$ + %if we are in a bracket + no.bracket 'skip$ {title.char "}" = {#1 'no.bracket :=} 'skip$ if$} if$ + type$ "journalpart" = + {title.char "." = title.char ":" = or title.char "!" = or + title.char "," = or title.char ";" = or title.char "?" = or} + {title.char " " =} + if$ s t = or no.bracket and + {#0 'first.word := + t title.char * "u" change.case$ + title.pos #1 + 'title.pos := + s title.pos global.max$ substring$ * 's :=} + {title.pos #1 + 'title.pos := t title.char * 't :=} + if$ + } + while$ +s +} + + +%compares current title with the title of the previous entry +FUNCTION {compare.title} +{abnt.repeated.title.omit + {duplicate$ "" = 'skip$ + {duplicate$ previous.title = repeated.author and + {duplicate$ 'previous.title := pop$ bbl.same.field} + {duplicate$ 'previous.title :=} + if$} + if$} + 'skip$ + if$ +} + +FUNCTION {apply.title.command} +{abnt.title.command + {duplicate$ empty$ 'skip$ + {"\bibtextitlecommand{" type$ * "}{" * swap$ * "}" *} + if$} + 'skip$ if$ +} + +FUNCTION {format.title} +{author empty$ editor empty$ and organization empty$ and + {title format.title.as.author} + {title duplicate$ empty$ {pop$ ""} {"t" change.case$} if$} + if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$ + apply.title.command + compare.title +} + +FUNCTION {n.dashify} +{ + 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {word.in} { bbl.in " " * } + +FUNCTION {format.month} +{ month empty$ 'skip$ + {month "month" bibinfo.check} + if$ +} + +FUNCTION {format.date} +{ year empty$ + { month empty$ + { bbl.missing.year } + { "existe o campo month (mês) mas não o campo year (ano) em " cite$ * warning$ month} + if$} + { month empty$ + { year n.dashify} + { month " " * year * } + if$} + if$ +} +FUNCTION {format.btitle} +{author empty$ editor empty$ and organization empty$ and + {title format.title.as.author "title" bibinfo.check duplicate$ empty$ 'skip$ {} if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$} + {title "title" bibinfo.check emphasize duplicate$ empty$ 'skip$ {} if$ + subtitle empty$ 'skip$ {subtitle ": " swap$ * "t" change.case$ *} if$} +if$ +apply.title.command +compare.title +} +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "não posso usar ambos " swap$ * " os campos em " * cite$ * warning$ } + if$ +} + +FUNCTION {format.volume} %leaves formatted or empty volume on the stack +{volume duplicate$ empty$ + 'skip$ + {volume #1 #1 substring$ is.num + {bbl.volume swap$ tie.or.space.prefix * *} + 'skip$ + if$} + if$ +} + +FUNCTION {format.number} %leaves formatted or empty number on the stack +{ number duplicate$ empty$ + 'skip$ + {bbl.number swap$ tie.or.space.prefix * *} + if$ +} + +FUNCTION {format.patent.number} +{ number +} + +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { format.volume + number empty$ 'skip$ {output format.number} if$ + series "series" bibinfo.check + duplicate$ empty$ 'pop$ + { swap$ bbl.of space.word * swap$ + emphasize * } + if$ + } + if$ +} + +FUNCTION {format.bvolume.if.no.series} +{ series empty$ + { format.bvolume } + { "" } + if$ +} + + +FUNCTION {format.number.or.volume} +{number empty$ + {format.volume} + {number} %we use the pure number here without leading "n." + if$ +} + +FUNCTION {format.volume.and.number} +{format.volume output + format.number +} + +FUNCTION {format.volume.number.series} +{ number empty$ volume empty$ and + { series empty$ + { "" } + {" (" series "series" bibinfo.check * ")" *} + if$} + { series empty$ + {""} %{ format.number.or.volume } + { " (" series "series" bibinfo.check * ", " * + format.number.or.volume * ")" * } + if$ } + if$ +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +FUNCTION {format.edition} +{ edition duplicate$ empty$ 'skip$ + {output.state mid.sentence = { "l" } { "t" } if$ change.case$ + "edition" bibinfo.check + edition #1 #1 substring$ is.num {". " * bbl.edition * } 'skip$ if$} + if$ +} +INTEGERS { multiresult } +FUNCTION {multi.page.check} +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ } + while$ + multiresult +} +FUNCTION {format.pages} +{ pages duplicate$ empty$ 'skip$ + { duplicate$ multi.page.check + { n.dashify bbl.pages swap$} + { bbl.page swap$ } + if$ + tie.or.space.prefix "pages" bibinfo.check * * } + if$ +} +FUNCTION {format.journal.pages} +{ pages empty$ {""} + { pages n.dashify bbl.pages + swap$ tie.or.space.prefix "pages" bibinfo.check * *} + if$ +} + +FUNCTION {get.url.type} +{s #1 #5 substring$ "http:" = {http.url} + {s #1 #6 substring$ "https:" = {http.url} + {s #1 #5 substring$ "file:" = {file.url} + {s #1 #4 substring$ "ftp:" = {ftp.url} + {s #1 #4 substring$ "doi:" = {doi.url} + {s #1 #7 substring$ "mailto:" = {mailto.url} {unknown.url} if$} + if$} + if$} + if$} + if$} + if$ + 'url.type := +} + +FUNCTION {expand.doi} +{s +url.type doi.url = + {#5 global.max$ substring$ bbl.doi.url swap$ *} + 'skip$ if$ +} + +INTEGERS {url.pos url.length} +FUNCTION {filter.url.tex} +{s text.length$ #1 + 'url.length := + #1 'url.pos := "" 't := + {url.pos url.length <} + {s url.pos #1 substring$ + duplicate$ "_" = {pop$ "\underline{\ }" } 'skip$ if$ + duplicate$ "%" = {pop$ "\%" } 'skip$ if$ + duplicate$ "&" = {pop$ "\&" } 'skip$ if$ + duplicate$ "~" = {pop$ "\~{}" } 'skip$ if$ + duplicate$ "/" = {pop$ "\-/" } 'skip$ if$ + duplicate$ "." = {pop$ "\-." } 'skip$ if$ + duplicate$ "\" = {pop$ "{\textbackslash}" } 'skip$ if$ + duplicate$ "#" = {pop$ "\#" } 'skip$ if$ + duplicate$ "_" = {pop$ "\_" } 'skip$ if$ + t swap$ * 't := + url.pos #1 + 'url.pos := + } + while$ +t +} +FUNCTION {filter.url.html} +{s text.length$ #1 + 'url.length := + #1 'url.pos := "" 't := + {url.pos url.length <} + {s url.pos #1 substring$ + duplicate$ "%" = {pop$ "\%" } 'skip$ if$ + duplicate$ "#" = {pop$ "\#" } 'skip$ if$ + duplicate$ "_" = {pop$ "\_" } 'skip$ if$ + t swap$ * 't := + url.pos #1 + 'url.pos := + } + while$ +t +} + +FUNCTION {compose.url} +{'s := + get.url.type + bbl.url.available + abnt.url.package #0 = + { "$<$" * + abnt.doi abnt.doi.expand.to.url = 'expand.doi {s} if$ + * "$>$" *} 'skip$ if$ + abnt.url.package #1 = + { "\url{" * filter.url.html * "}" *} 'skip$ if$ + abnt.url.package #2 = + {url.type http.url = + {"\htmladdnormallink{$<$" * filter.url.tex * "$>$}{" * filter.url.html * "}" *} + 'skip$ if$ + url.type doi.url = url.type ftp.url = or url.type mailto.url = or + {"\htmladdnormallink{$<$" * + abnt.doi abnt.doi.expand.to.url = 'expand.doi {s} if$ + * "$>$}{" * + abnt.doi abnt.doi.leave.as.is = {s} 'expand.doi if$ + * "}" * } + 'skip$ if$ + url.type unknown.url = + {"$<$" * filter.url.tex * "$>$" *} + 'skip$ if$} 'skip$ if$ +} +FUNCTION {format.url} +{ url empty$ 'skip$ + {url compose.url output new.sentence } + if$ + urlaccessdate duplicate$ empty$ 'skip$ + { bbl.url.accessdate swap$ *} + if$ + "urlaccessdate" bibinfo.check output new.sentence +} + +FUNCTION {format.conference.info} +{ conference-number empty$ + 'skip$ + {conference-number "." * output} + if$ + conference-year empty$ + 'skip$ + {conference-year output} + if$ + conference-location empty$ + 'skip$ + {conference-location output} + if$ + new.sentence +} + + +FUNCTION {format.chapter.pages} +{ chapter empty$ + 'format.pages + { type empty$ + { bbl.chapter } + { type "l" change.case$ + "type" bibinfo.check } + if$ + chapter tie.or.space.prefix "chapter" bibinfo.check * * + pages empty$ + 'skip$ + { ", " * format.pages * } + if$ } + if$ +} + +FUNCTION {format.booktitle} +{author empty$ editor empty$ and organization empty$ and + {booktitle format.title.as.author "booktitle" bibinfo.check duplicate$ empty$ 'skip$ {} if$ + booksubtitle empty$ 'skip$ {booksubtitle ": " swap$ * "t" change.case$ * + apply.title.command} if$} + {booktitle "booktitle" bibinfo.check emphasize duplicate$ empty$ 'skip$ {} if$ + booksubtitle empty$ 'skip$ {booksubtitle ": " swap$ * "t" change.case$ * + apply.title.command} if$} +if$ +} +FUNCTION {format.editors} +{ editor empty$ + {"inbook" type$ = 'bbl.same.field 'skip$ if$} + {author empty$ + {editor "editor" format.names " (" * + editortype empty$ {bbl.editor} {editortype} if$ + ")" * * } + {"inbook" type$ = + {bbl.same.field } + {editor "editor" format.names " (" * + editortype empty$ {bbl.editor} {editortype} if$ + ")" * *} + if$} + if$} + if$ +} +FUNCTION {format.in.ed.booktitle} +{ editor empty$ + {organization empty$ not author empty$ not and %if one of two not empty + {word.in organization "u" change.case$ * output + format.conference.info + booktitle empty$ {""} {new.sentence format.booktitle} if$} + {word.in + organization empty$ author empty$ and 'skip$ + {"inbook" type$ = {bbl.same.field * output new.sentence ""} + 'skip$ if$ } if$ + booktitle empty$ 'skip$ {format.booktitle *} if$} + if$} + {word.in format.editors * output + booktitle empty$ {""} {new.sentence format.booktitle} if$} + if$ + output + new.sentence +} +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "todos os campos relevantes estão vazios ou faltando em " cite$ * warning$ } + 'skip$ + if$ +} +FUNCTION {format.type} +{ type "type" bibinfo.check + duplicate$ empty$ 'skip$ + {new.block "" swap$ * } + if$ +} + + +FUNCTION {format.year} +{year empty$ + { "campo year vazio ou faltando em " cite$ * + abnt.missing.year {" (vou colocar [s.d.])" *} 'skip$ if$ warning$ + abnt.missing.year {", " } {""} if$ bbl.missing.year *} + {year n.dashify "year" bibinfo.check} +if$ +} + +FUNCTION {format.year.presented} +{year-presented empty$ + {""} + {year-presented n.dashify} +if$ +} + +FUNCTION {format.field.address} +{ 't := + address empty$ organization empty$ and url empty$ and t empty$ and + {bbl.no.address.no.publisher} + {address empty$ + %if an url is present we don't give a missing address "[s.l.]" notice + {url empty$ {bbl.no.address ": "} {"" ""} if$} + {address ": "} + if$ + t empty$ + {%if an organization is present then it is OK not to have a publisher + organization empty$ {* bbl.no.publisher * } 'pop$ if$} + {* t * } + if$} + if$ +} + +FUNCTION {format.address} +{address empty$ + { bbl.no.address} + { address} + if$ +} + +FUNCTION {format.publisher.address} +{ publisher "publisher" bibinfo.check format.field.address} + +FUNCTION {format.publisher.address.relax} +{publisher empty$ address empty$ and {""} + {publisher "publisher" bibinfo.check format.field.address} +if$} + +FUNCTION {format.organization.address} +{ organization "organization" bibinfo.check format.field.address} + +%retains current authorship for future use +FUNCTION {compare.authorship} +{abnt.repeated.author.omit + {duplicate$ "" = 'skip$ + {duplicate$ previous.author = + {duplicate$ 'previous.author := + pop$ bbl.same.field + #1 'repeated.author :=} + {duplicate$ 'previous.author := + #0 'repeated.author :=} + if$} + if$} + 'skip$ + if$ +} + +FUNCTION {format.author.or.organization} +{ author empty$ + { organization empty$ 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.authors output.nonnull } + if$ + compare.authorship +} + + +FUNCTION {format.editor.or.organization} +{ editor empty$ + { organization empty$ 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.editors output.nonnull } + if$ + compare.authorship +} + +FUNCTION {format.author.or.editor.or.organization} +{ author empty$ + { editor empty$ + { organization empty$ + 'skip$ + { organization "u" change.case$ "organization" bibinfo.check output} + if$} + { format.editors output.nonnull } + if$} + { format.authors output.nonnull } + if$ + compare.authorship +} + +FUNCTION {format.reprint} +{ reprinted-text missing$ + {""} + {reprinted-text empty$ + {bbl.reprint} {reprinted-text} if$ + bbl.colon *} + if$ +} + +FUNCTION {format.journal} +{ + format.reprint + journal emphasize * +} + + +%generates the first label in \abntrefinfo to be used with \citeonline +FUNCTION {format.names.for.label1} %abnt-alf only +{ 's := "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + {abnt.last.names + {s nameptr "{ll}{ jj}" format.name$} + {s nameptr "{ll}" format.name$ #1 "{ll}" format.name$ + s nameptr "{ jj}" format.name$ *} + if$ + 't := + nameptr #1 > + {namesleft #1 > + { numnames abnt.etal.cite > abnt.etal.cite #0 = not and + {#0 'namesleft := abnt.etal.cite {bbl.etal *} 'skip$ if$} + {", " * t * } if$ } + { t "others" = + {abnt.etal.cite {bbl.etal *} 'skip$ if$} + {numnames nameptr = + {bbl.and * t *} + 'skip$ if$} + if$ + } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ +} + +%generates the second label in \abntrefinfo to be used with \cite +FUNCTION {format.names.for.label2} %abnt-alf only +{ 's := "" 't := + #1 'nameptr := s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + {abnt.last.names + {s nameptr "{ll}{ jj}" format.name$} + {s nameptr "{ll}" format.name$ #1 "{ll}" format.name$ + s nameptr "{ jj}" format.name$ *} + if$ + abnt.cite.style #0 = {"u" change.case$} 'skip$ if$ 't := + nameptr #1 > + {namesleft #1 > + { numnames abnt.etal.cite > + {#0 'namesleft := abnt.etal.cite {bbl.etal *} 'skip$ if$} + {"; " * t * } if$ } + { t "OTHERS" = t "others" = or + {abnt.etal.cite {bbl.etal *} 'skip$ if$} + {numnames nameptr = { bbl.semicolon * t *} 'skip$ if$} + if$ + } + if$ } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := } + while$ +} + +FUNCTION {format.title.for.label} +{ 's := + #1 'title.pos := #1 'first.word := + "" 't := + {first.word} + {s title.pos #1 substring$ 'title.char := + title.char "." = title.char ":" = or title.char ";" = or + title.char "," = or title.char " " = or s t = or + {#0 'first.word := + title.pos #1 + 'title.pos :=} + {title.pos #1 + 'title.pos := t title.char * 't :=} + if$ + } + while$ +s t = %title equals first word, dont use bbl.ldots + {t "}{" * t + abnt.cite.style #0 = {"u" change.case$ * } 'skip$ if$} + {t bbl.ldots * "}{" * t + abnt.cite.style #0 = {"u" change.case$} 'skip$ if$ * bbl.ldots *} +if$ +} + +%cvs keys have the general form $key: value $ +INTEGERS {key.pos value.pos} +FUNCTION {extract.cvs.key} %we borrow the functionality of format.title.for.label +{ 's := %holds the entire cvs string + #1 'key.pos := + #0 'value.pos := %0= between first $ and :, 1=between : and second $, 2= at the end + "" 't := %holds the resulting value + {value.pos #0 = value.pos #1 = or} + { s key.pos #1 substring$ 'title.char := + value.pos #0 = + { title.char ":" = {#1 'value.pos := key.pos #1 + 'key.pos :=} 'skip$ if$} + { title.char "$" = + {#2 'value.pos :=} + {t title.char * 't :=} + if$} + if$ + key.pos #1 + 'key.pos := + } + while$ + t +} + +%generates and extended label of type {Author}{AUTHOR}{YEAR} +%for abnt.cite.style=1 they will be of type {Author}{Author}{YEAR} +%final result is placed into variable label +FUNCTION {calc.extended.label} +{ "{" + author empty$ not + {author format.names.for.label1 * "}{" * author format.names.for.label2 *} + {editor empty$ not + {editor format.names.for.label1 * "}{" * editor format.names.for.label2 *} + {org-short empty$ not + {org-short * "}{" * org-short "u" change.case$ *} + {organization empty$ not + {organization * "}{" * organization "u" change.case$ *} + {title empty$ not + {title format.title.for.label *} + {"nada}{NADA" *} + if$} + if$} + if$} + if$} + if$ + "}{" * + year empty$ 'skip$ {year *} if$ + 'label := %place the stack into label + % final } will be placed in reverse.pass +} +%generates and simple label of type "Author YEAR" +%final result is placed onto the stack +FUNCTION {calc.simple.label} +{ author empty$ not + {author format.names.for.label1} + {editor empty$ not + {editor format.names.for.label1} + {organization empty$ not + {organization} + {title empty$ not + {title} + {""} + if$} + if$} + if$} + if$ + year empty$ 'skip$ {" " * year *} if$ +} + +FUNCTION {output.bibitem} +{ newline$ + abnt.alf + {"\bibitem[" write$ + calc.simple.label + write$ "]{"} + {"\bibitem{"} + if$ + write$ cite$ write$ "}" write$ newline$ + abnt.refinfo #1 = {"\abntrefinfo" write$ label write$ newline$} 'skip$ if$ + "{" write$ + "" before.all 'output.state := +} +FUNCTION {output.hiddenbibitem} +{ newline$ + abnt.alf + {"\hiddenbibitem[" write$ + calc.simple.label + write$ "]{"} + {"\bibitem{"} + if$ + write$ cite$ write$ "}" write$ newline$ + abnt.refinfo #1 = {"\abntrefinfo" write$ label write$ newline$} 'skip$ if$ + "{" write$ + "" before.all 'output.state := +} +FUNCTION {fin.entry} +{ add.period$ write$ + reprinted-from empty$ 'skip$ + {" " reprinted-text empty$ + {bbl.reprint} {reprinted-text} if$ * bbl.colon * + "\abntreprintinfo{ " * reprinted-from * "}" * write$} + if$ + abnt-note empty$ 'skip$ + {"\footnote{" abnt-note * "}" * write$} if$ + "}" write$ + %newline$ + write.entry.verbatim +} + +FUNCTION { abnt.display.options} +{ 's := 't := + abnt.show.options #1 = % "warn" + {"opção " t * " passou para " * s * warning$ } 'skip$ if$ + + abnt.show.options #2 = % "list" + {"Op\c c\~ao selecionada {\tt " t * "=}\verb+" * s * "+" * output new.sentence } 'skip$ if$ +} + +FUNCTION { abnt-options1 } + { + abnt-show-options empty$ + 'skip$ + {abnt-show-options "no" = + {#0} {abnt-show-options "warn" = + {#1} {abnt-show-options "list" = + {#2 } {#0 } if$} if$} if$ + 'abnt.show.options :=} % #0 "no"; #1 "warn"; #2 "list" + if$ + + abnt.show.options #2 = + {output.bibitem "Mudan\c ca de estilo ap\'os este ponto com o comando \verb!\citeoption{" + cite$ * "}! " * + output new.sentence} 'skip$ if$ + + abnt-show-options empty$ + 'skip$ {"abnt-show-options" abnt-show-options abnt.display.options} if$ + + abnt-cite-style empty$ + 'skip$ + {abnt-cite-style "(AUTHOR, YEAR)" = + {#0 'abnt.cite.style :=} + {abnt-cite-style "(Author, YEAR)" = + {#1 'abnt.cite.style :=} + {"opção " abnt-cite-style * " desconhecida" * warning$} + if$} + if$ + "abnt-cite-style" abnt-cite-style abnt.display.options}if$ + + abnt-experimental empty$ + 'skip$ {abnt-experimental "yes" = 'abnt.experimental := + "abnt-experimental" abnt-experimental abnt.display.options} if$ + + abnt-emphasize duplicate$ empty$ + 'pop$ {'abnt.emphasize := + "abnt-emphasize" abnt.emphasize abnt.display.options + abnt-emphasize "\bf" = abnt-emphasize "\it" = or abnt-emphasize "\em" = or + abnt-emphasize "\bfseries" = or + {"não use " abnt-emphasize * " para abnt-emphasize em " * cite$ * + ", isto alterará TODO o texto. Use \textbf ou \emph. Veja a documentação abnt-bibtex-doc para mais detalhes." * warning$} + 'skip$ if$ + } if$ + + abnt-doi empty$ + 'skip$ + {abnt-doi "expand" = + {abnt.doi.expand.to.url 'abnt.doi :=} + {abnt-doi "link" = + {abnt.doi.link 'abnt.doi :=} + {abnt-doi "doi" = + {abnt.doi.leave.as.is 'abnt.doi :=} + {"opção " abnt-doi * " desconhecida" * warning$} + if$} + if$} + if$ + "abnt-doi" abnt-doi abnt.display.options}if$ + } +FUNCTION { abnt-options2 } + { + abnt-full-initials empty$ + 'skip$ {abnt-full-initials "yes" = 'abnt.full.initials := + "abnt-full-initials" abnt-full-initials abnt.display.options} if$ + + abnt-last-names empty$ + 'skip$ + {abnt-last-names "abnt" = {#0} + {abnt-last-names "bibtex" = {#1} {#0} if$} if$ + 'abnt.last.names := + "abnt-last-names" abnt-last-names abnt.display.options} + if$ + + + abnt-ldots-type empty$ + 'skip$ + {abnt-ldots-type "none" = {#0} + {abnt-ldots-type "normal" = {#1} + {abnt-ldots-type "math" = {#2} + {abnt-ldots-type "text" = {#1} {#0} + if$} if$} if$} if$ + 'abnt.ldots.type := + "abnt-ldots-type" abnt-ldots-type abnt.display.options} + if$ + + abnt-missing-year empty$ + 'skip$ + {abnt-missing-year "void" = {#0} + {abnt-missing-year "sd" = {#1} {#0} if$} + if$ + 'abnt.missing.year := + "abnt-missing-year" abnt-missing-year abnt.display.options} + if$ + + + abnt-and-type empty$ + 'skip$ {abnt-and-type "e" = + {#0} {abnt-and-type "&" = + {#1} {#0} if$} if$ + 'abnt.and.type := + "abnt-and-type" abnt-and-type abnt.display.options} + if$ + + abnt-thesis-year empty$ + 'skip$ {abnt-thesis-year "final" = + {#0} {abnt-thesis-year "title" = + {#1} {abnt-thesis-year "both" = + {#2} {#0} if$} if$} if$ + 'abnt.thesis.year := + "abnt-thesis-year" abnt-thesis-year abnt.display.options} + if$ + + abnt-refinfo empty$ + 'skip$ {abnt-refinfo "yes" = 'abnt.refinfo := + "abnt-refinfo" abnt-refinfo abnt.display.options} if$ +} +FUNCTION { abnt-options3 } + { + + abnt-dont-use-etal empty$ + 'skip$ {abnt-dont-use-etal "yes" = {#0 'abnt.etal.list :=} 'skip$ if$ + "Uso da opção abnt-dont-use-etal se tornou obsoleto, usamos abnt-etal-list." warning$ + "abnt-etal-list" abnt.etal.list int.to.str$ abnt.display.options} if$ + + abnt-etal-cite empty$ + 'skip$ {abnt-etal-cite str.to.int 'abnt.etal.cite := + "abnt-etal-cite" abnt.etal.cite int.to.str$ abnt.display.options} if$ + + abnt-etal-list empty$ + 'skip$ {abnt-etal-list str.to.int 'abnt.etal.list := + "abnt-etal-list" abnt.etal.list int.to.str$ abnt.display.options} if$ + + abnt-etal-text missing$ + 'skip$ {abnt-etal-text 'abnt.etal.text := + "abnt-etal-text" abnt.etal.text abnt.display.options} if$ + + abnt-no-etal-label empty$ + 'skip$ {abnt-no-etal-label "yes" = {#0 'abnt.etal.cite :=} 'skip$ if$ + "Uso da opção abnt-no-etal-label se tornou obsoleto, usamos abnt-etal-cite." warning$ + "abnt-etal-cite" abnt.etal.cite int.to.str$ abnt.display.options} if$ + + abnt-repeated-author-omit empty$ + 'skip$ {abnt-repeated-author-omit "yes" = + {#1 'abnt.repeated.author.omit :=} + {#0 'abnt.repeated.author.omit := "" 'previous.author :=} if$ + "abnt-repeated-author-omit" abnt-repeated-author-omit abnt.display.options} if$ + + abnt-repeated-title-omit empty$ 'skip$ + {abnt-repeated-title-omit "yes" = + {#1 'abnt.repeated.title.omit :=} + {#0 'abnt.repeated.title.omit := "" 'previous.title :=} if$ + "abnt-repeated-title-omit" abnt-repeated-title-omit abnt.display.options + abnt.repeated.author.omit not abnt.repeated.title.omit and + {"Use abnt-repeated-title-omit=yes junto com abnt-repeated-author-omit=yes" + warning$} 'skip$ if$} if$ + + abnt-title-command empty$ + 'skip$ {abnt-title-command "yes" = + {#1 'abnt.title.command :=} + {#0 'abnt.title.command :=} if$ + "abnt-title-command" abnt-title-command abnt.display.options} if$ + + abnt-url-package empty$ 'skip$ + {abnt-url-package "url" = + {#1 'abnt.url.package :=} + {abnt-url-package "hyperref" = {#2 'abnt.url.package :=} 'skip$ if$} + if$ + "abnt-url-package" abnt-url-package abnt.display.options} + if$ + + abnt-verbatim-entry empty$ + 'skip$ {abnt-verbatim-entry "yes" = 'abnt.verbatim.entry := + "abnt-verbatim-entry" abnt-verbatim-entry abnt.display.options} if$ + + abnt.show.options #2 = 'fin.entry 'skip$ if$ + } + +%we had to break this function in two parts because of the following message: +%Sorry---you've exceeded BibTeX's single function space 100 +%(That was a fatal error) +FUNCTION { iso-options1 } + { + iso-abbreviation empty$ + 'skip$ {iso-abbreviation "standard" = 'iso.abbreviation := + "iso-abbreviation" iso-abbreviation abnt.display.options} if$ + iso-author-punctuation empty$ + 'skip$ {iso-author-punctuation "void" = 'iso.author.punctuation := + "iso-author-punctuation" iso-author-punctuation abnt.display.options} if$ + iso-date-place empty$ + 'skip$ {iso-date-place "ISO" = 'iso.date.place := + "iso-date-place" iso-date-place abnt.display.options} if$ + } + +FUNCTION { abnt-options } + { + abnt-options1 + abnt-options2 + abnt-options3 + iso-options1 + } + +FUNCTION { iso-options } { abnt-options } + +FUNCTION { iso.year.label } +{ iso.date.place + { abnt.alf + {year.label output new.sentence} + 'skip$ if$} + 'skip$ if$} + +FUNCTION { iso.date } +{ iso.date.place + { abnt.alf + 'skip$ + {year output new.sentence} + if$} + 'skip$ if$} + +FUNCTION { non.iso.date } + {iso.date.place 'skip$ {format.date output} if$} + +FUNCTION {article} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.block + format.journal output + iso.date.place {format.year output} 'skip$ if$ + %iso.date.place {format.date output} 'skip$ if$ + %iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + % {format.year output new.sentence} if$ + section "section" bibinfo.check output.dash + publisher "publisher" bibinfo.check output + address "address" bibinfo.check output + format.volume output + format.number output + format.pages output + non.iso.date + format.issn output new.block + format.note output new.block + format.url + fin.entry +} +FUNCTION {book} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.volume output new.sentence + format.book.pages output + format.illustrated + format.dimensions new.sentence + format.howpublished output new.sentence + format.volume.number.series output new.sentence + format.note output + format.issn output %pode parecer curioso, mas revistas inteiras são tratadas como livro + format.isbn output new.sentence + format.url + fin.entry +} +FUNCTION {booklet} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.edition output new.sentence + address "address" bibinfo.check output + format.bvolume output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.book.pages output new.sentence + format.volume.number.series output new.sentence + format.note output + format.isbn output new.sentence + format.url + fin.entry +} + +FUNCTION {hidden} +{ output.hiddenbibitem + fin.entry} + +FUNCTION {inbook} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.block + format.in.ed.booktitle + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + %format.year output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.volume.number.series output + format.chapter.pages output new.sentence + format.isbn output new.block + format.note output new.block + format.url + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.in.ed.booktitle + format.edition output new.sentence + format.publisher.address output + %format.year output + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output} if$ + format.volume.number.series output new.sentence + format.bvolume.if.no.series output + format.chapter.pages output new.sentence + format.isbn output new.block + format.note output new.block + format.url + fin.entry +} +FUNCTION {inproceedings} +{ output.bibitem + format.author.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.in.ed.booktitle + format.publisher.address output + %format.year output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.volume.number.series output + format.pages output + format.isbn output + format.issn output new.sentence + format.note output new.sentence + format.url + fin.entry +} +FUNCTION {journalpart} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output new.sentence + format.btitle "title" output.check new.sentence + format.furtherresp new.sentence + format.edition output new.sentence + format.publisher.address output + format.volume output + format.number output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.date output new.sentence} if$ + format.book.pages output + format.illustrated + format.dimensions new.sentence + format.note output + format.issn output %pode parecer curioso, mas revistas inteiras são tratadas como livro + format.isbn output new.sentence + format.url + fin.entry +} +FUNCTION {conference} { inproceedings } +FUNCTION {manual} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.btitle "title" output.check new.block + format.furtherresp new.sentence + format.edition output new.sentence + format.address output + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.bvolume.if.no.series output + format.book.pages output new.sentence + format.volume.number.series output new.sentence + format.note output new.sentence + format.url + fin.entry +} + +FUNCTION {misc} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.type output + format.btitle output new.sentence + format.furtherresp new.sentence + format.publisher.address.relax output + %format.date output new.block + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.book.pages output new.sentence + format.illustrated + format.dimensions new.sentence + format.howpublished output new.block + format.volume.number.series output new.sentence + format.note output new.block + format.url + fin.entry + empty.misc.check +} + +FUNCTION {patent} +{ output.bibitem + format.editor.or.organization new.sentence + iso.year.label + format.authors.plain output new.sentence + format.btitle output new.sentence + format.furtherresp new.sentence + %format.date output new.block + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.patent.number output + format.howpublished output new.block + format.note output new.block + format.url + fin.entry + empty.misc.check +} + +FUNCTION {format.thesis.type} +{ type$ "phdthesis" = + {bbl.phdthesis} + {type$ "mastersthesis" = + {bbl.mthesis} + {type$ "monography" = + {bbl.monography} + {bbl.void} + if$} + if$} + if$ + type empty$ + {type missing$ + {type$ "phdthesis" = + { " (" bbl.phd * ")" *} + {type$ "mastersthesis" = { " (" bbl.master * ")" *} {pop$ ""} if$} + if$} + {""} + if$} + {type$ "thesis" = + {type} + {" (" type * ")" * "type" bibinfo.check} + if$} + if$ + * %joins first and second part of this function +} +FUNCTION {thesis} +{ output.bibitem + format.authors "author" output.check new.block + iso.year.label + format.btitle "title" output.check new.block + abnt.thesis.year #1 = abnt.thesis.year #2 = or + {format.date "year" output.check new.sentence} 'skip$ if$ + format.year.presented output new.sentence + format.book.pages output new.sentence + format.thesis.type output.nonnull + school "school" bibinfo.warn output.dash + address "address" bibinfo.check output + abnt.thesis.year #0 = abnt.thesis.year #2 = or + {format.date "year" output.check new.sentence} 'skip$ if$ + format.note output new.block + format.url + fin.entry +} + +FUNCTION {phdthesis} { thesis } +FUNCTION {mastersthesis} { thesis } +FUNCTION {monography} { thesis } + +FUNCTION {proceedings} +{ output.bibitem + iso.year.label + format.editor.or.organization + format.conference.info + format.btitle "title" output.check + format.bvolume output + format.volume.number.series output + editor empty$ + { publisher empty$ + 'skip$ + { new.sentence format.publisher.address output format.year output} + if$ + } + { publisher empty$ + { new.sentence + format.organization.address output format.year output} + { new.sentence + organization "organization" bibinfo.check output + format.publisher.address output format.year output} + if$ } + if$ + new.sentence format.book.pages output new.sentence + format.isbn output + format.issn output new.block + format.note output new.block + format.url + fin.entry +} + +FUNCTION {techreport} {manual} + +FUNCTION {unpublished} +{ output.bibitem + format.author.or.editor.or.organization new.sentence + iso.year.label + format.title "title" output.check new.sentence + format.note "note" output.check new.sentence + %format.date output new.sentence + iso.date.place {abnt.alf 'skip$ {format.year output new.sentence} if$} + {format.year output new.sentence} if$ + format.url + fin.entry +} + +FUNCTION {default.type} { misc } +READ +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} +INTEGERS { len } +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { format.single.name 't := + nameptr #1 > + { + nameptr #3 + #1 + = + numnames #3 + > and + { "others" 't := + #1 'namesleft := } + 'skip$ + if$ + " " * + namesleft #1 = t "others" = and + { "zzzzz" * } + { t sortify * } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} +FUNCTION {any.sort} +{ author empty$ + { organization empty$ + { editor empty$ + { title empty$ + { key empty$ + { "para ordenar, precisa dos campos author, organization, editor, title ou key in " cite$ * warning$ ""} + { key sortify } + if$} + { title sortify} + if$} + { editor sort.format.names } + if$} + { organization sortify } + if$} + { author sort.format.names } +if$ +} + +FUNCTION {presort} +{ + any.sort + " " * year field.or.null sortify * " " * title field.or.null + sort.format.title * #1 entry.max$ substring$ + %for non-alpha style we drop a void sort.key such that SORT has no effect + abnt.alf 'skip$ {pop$ ""} if$ 'sort.key$ := + year empty$ {""} {year} if$ 'year.label := + calc.extended.label +} + +FUNCTION {set.default.abnt.variables} +{ %if you change abnt-num to abnt-alf by hand you need also to change + %the name of RCSfile by hand, otherwise cvs takes care of it. + % + "$RCSfile: abnt-num.bst,v $ " extract.cvs.key + % + "abnt-alf.bst,v " = 'abnt.alf := % #1 para abnt-alf #0 para abnt-num + "$Revision: v-1.9.7 $" extract.cvs.key 'abnt.bst.revision := + #0 'abnt.and.type := % #0 "e"; #1 "&" + "\emph" 'abnt.emphasize := + #0 'abnt.cite.style := %default norm version for NBR10520 + %#0 \cite=(AUTHOR, YEAR) + %#1 \cite=(Author, YEAR) + #0 'abnt.experimental := + abnt.doi.expand.to.url 'abnt.doi := + #3 'abnt.etal.cite := + #3 'abnt.etal.list := + "et al." 'abnt.etal.text := + #0 'abnt.full.initials := + #0 'abnt.last.names := %#0 abnt-style, #1 bibtex-style + #1 'abnt.ldots.type := %#0 use nothing, #1 use \ldots, #2 use $\ldots$, 3# use {...} + #0 'abnt.missing.year := %#0 "void"; #1 "[s.d.]" + #0 'repeated.author := + #0 'abnt.repeated.author.omit := + #0 'abnt.repeated.title.omit := + #1 'abnt.refinfo := + #0 'abnt.show.options := % #0 "no"; #1 "warn"; #2 "list" + #0 'abnt.thesis.year := % #0 "final"; #1 "title"; #2 "both" + #0 'abnt.title.command := % #0 "no"; #1 "yes" + #0 'abnt.url.package := % #0 "none"'; #2 "url"; #2 "hyperref" + #0 'abnt.verbatim.entry := +} +FUNCTION {set.default.iso.variables} +{ #0 'iso.abbreviation := % #0 ABNT-style; #1 ISO-style + #0 'iso.author.punctuation := % #0 ABNT (Smith, A. B.); #1 ISO (Smith, AB) + #0 'iso.date.place := % #0 ABNT-sty; #1 ISO-style +} +EXECUTE {set.default.abnt.variables} +EXECUTE {set.default.iso.variables} +FUNCTION {process.early.abnt.options} +{%here we intercept all entries which need priority handling + %note: we cannot use type$ at this point + abnt-and-type missing$ + abnt-experimental missing$ and + abnt-etal-cite missing$ and + abnt-etal-text missing$ and + abnt-ldots-type missing$ and + abnt-cite-style missing$ and + abnt-no-etal-label missing$ and + abnt-title-command missing$ and + 'skip$ {call.type$} if$ +} +ITERATE {process.early.abnt.options} +FUNCTION {search.reprinted} +{ reprinted-from missing$ 'skip$ + {"\nocite{" reprinted-from * "}" * write$ newline$ + } + if$ +} +ITERATE {search.reprinted} +FUNCTION {abntreprintinfo} +{"\providecommand{\abntreprintinfo}[1]{%" write$ newline$ + " \citeonline{#1}}" write$ newline$} +EXECUTE {abntreprintinfo} +ITERATE {presort} +SORT +STRINGS { last.label next.extra} +INTEGERS { last.extra.num } +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + label extra.label * 'label := + year.label extra.label * 'year.label := + extra.label 'next.extra := + label "}" * 'label := +} +ITERATE {forward.pass} +REVERSE {reverse.pass} +FUNCTION {begin.bib} +{ + abnt.alf + {"\setlength{\labelsep}{0pt}" write$} + 'skip$ + if$ + "\begin{thebibliography}{}" write$ newline$ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + abnt.refinfo #1 = + {"\providecommand{\abntrefinfo}[3]{}" write$ newline$} + 'skip$ if$ + "\providecommand{\abntbstabout}[1]{}" write$ newline$ + abnt.title.command + {"\providecommand{\bibtextitlecommand}[2]{#2}" write$ newline$} + 'skip$ if$ + "\abntbstabout{" abnt.bst.revision * "}" * write$ newline$ + %Se você não usa abntcite e precisa que a margem direita não + %seja justificada, descomente a linha seguinte + %alternativamente coloque \bibliography{abnt-nrj,... +% "\setlength{\rightskip}{0pt plus 2cm}" write$ newline$ +} +EXECUTE {begin.bib} +EXECUTE {init.state.consts} +FUNCTION {process.entry}{call.type$} +ITERATE {process.entry} +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ +} +EXECUTE {end.bib} +FUNCTION {apresentacao} +{ "+---------------------------------------------------------+" + "| http://www.abntex.net.br/ |" + "| Em caso de dúvidas ou problemas com este estilo procure |" + abnt.alf + {"| Estilo bibliográfico abntex2-alf.bst versão " abnt.bst.revision * " |" *} + {"| Estilo bibliográfico abntex2-num.bst versão " abnt.bst.revision * " |" *} + if$ + "+---------------------------------------------------------+" + stack$ +} +EXECUTE{apresentacao} diff --git a/macros/latex/contrib/abntex2/tex/abntex2-options.bib b/macros/latex/contrib/abntex2/tex/abntex2-options.bib new file mode 100644 index 0000000000..b68d051cd9 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2-options.bib @@ -0,0 +1,216 @@ +@comment{ "$Header: /home/cvsroot/abntex/texmf/bibtex/bib/abntex/abnt-options.bib,v 1.18 2003/07/22 16:41:27 gweber Exp $"} +@ABNT-options{abnt-and-type=e, + abnt-and-type="e", + key="aaaa"} +@ABNT-options{abnt-and-type=&, + abnt-and-type="&", + key="aaaa"} +@ABNT-options{abnt-cite-style=AUTHORYEAR, + abnt-cite-style="(AUTHOR, YEAR)", + key="aaaa"} +@ABNT-options{abnt-cite-style=AuthorYEAR, + abnt-cite-style="(Author, YEAR)", + key="aaaa"} +@ABNT-options{abnt-doi=expand, + abnt-doi="expand", + key="aaaa"} +@ABNT-options{abnt-doi=link, + abnt-doi="link", + key="aaaa"} +@ABNT-options{abnt-doi=doi, + abnt-doi="doi", + key="aaaa"} +@ABNT-options{abnt-dont-use-etal=yes, + abnt-etal-list=0, + key="aaaa"} +@ABNT-options{abnt-dont-use-etal=no, + abnt-etal-list=3, + key="aaaa"} +@ABNT-options{abnt-emphasize=bf, + abnt-emphasize="\textbf", + key="aaaa"} +@ABNT-options{abnt-emphasize=em, + abnt-emphasize="\emph", + key="aaaa"} +@ABNT-options{abnt-etal-cite=0, + abnt-etal-cite=0, + key="aaaa"} +@ABNT-options{abnt-etal-cite=1, + abnt-etal-cite=1, + key="aaaa"} +@ABNT-options{abnt-etal-cite=2, + abnt-etal-cite=2, + key="aaaa"} +@ABNT-options{abnt-etal-cite=3, + abnt-etal-cite=3, + key="aaaa"} +@ABNT-options{abnt-etal-cite=4, + abnt-etal-cite=4, + key="aaaa"} +@ABNT-options{abnt-etal-cite=5, + abnt-etal-cite=5, + key="aaaa"} +@ABNT-options{abnt-etal-list=0, + abnt-etal-list=0, + key="aaaa"} +@ABNT-options{abnt-etal-list=1, + abnt-etal-list=1, + key="aaaa"} +@ABNT-options{abnt-etal-list=2, + abnt-etal-list=2, + key="aaaa"} +@ABNT-options{abnt-etal-list=3, + abnt-etal-list=3, + key="aaaa"} +@ABNT-options{abnt-etal-list=4, + abnt-etal-list=4, + key="aaaa"} +@ABNT-options{abnt-etal-list=5, + abnt-etal-list=5, + key="aaaa"} +@ABNT-options{abnt-etal-text=none, + abnt-etal-text="", + key="aaaa"} +@ABNT-options{abnt-etal-text=default, + abnt-etal-text="et al.", + key="aaaa"} +@ABNT-options{abnt-etal-text=emph, + abnt-etal-text="\emph{et al.}", + key="aaaa"} +@ABNT-options{abnt-etal-text=it, + abnt-etal-text="\textit{et al.}", + key="aaaa"} +@ABNT-options{abnt-experimental=yes, + abnt-experimental="yes", + key="aaaa"} +@ABNT-options{abnt-experimental=no, + abnt-experimental="no", + key="aaaa"} +@ABNT-options{abnt-full-initials=no, + abnt-full-initials="no", + key="aaaa"} +@ABNT-options{abnt-full-initials=yes, + abnt-full-initials="yes", + key="aaaa"} +@ABNT-options{abnt-last-names=abnt, + abnt-last-names="abnt", + key="aaaa"} +@ABNT-options{abnt-last-names=bibtex, + abnt-last-names="bibtex", + key="aaaa"} +@ABNT-options{abnt-ldots-type=normal, + abnt-ldots-type="normal", + key="aaaa"} +@ABNT-options{abnt-ldots-type=none, + abnt-ldots-type="none", + key="aaaa"} +@ABNT-options{abnt-ldots-type=math, + abnt-ldots-type="math", + key="aaaa"} +@ABNT-options{abnt-ldots-type=text, + abnt-ldots-type="text", + key="aaaa"} +@ABNT-options{abnt-missing-year=void, + abnt-missing-year="void", + key="aaaa"} +@ABNT-options{abnt-missing-year=sd, + abnt-missing-year="sd", + key="aaaa"} +@ABNT-options{abnt-nbr6023=2002, + key="aaaa"} +@ABNT-options{abnt-nbr6023=2000, + key="aaaa"} +@ABNT-options{abnt-nbr10520=2002, + abnt-cite-style="(AUTHOR, YEAR)", + abnt-and-type="e", + key="aaaa"} +@ABNT-options{abnt-nbr10520=2001, + abnt-cite-style="(AUTHOR, YEAR)", + abnt-and-type="e", + key="aaaa"} +@ABNT-options{abnt-nbr10520=1988, + abnt-cite-style="(Author, YEAR)", + abnt-and-type="&", + key="aaaa"} +@ABNT-options{abnt-no-etal-label=yes, + abnt-etal-text="et al.", + key="aaaa"} +@ABNT-options{abnt-no-etal-label=no, + abnt-etal-text="", + key="aaaa"} +@ABNT-options{abnt-refinfo=yes, + abnt-refinfo="yes", + key="aaaa"} +@ABNT-options{abnt-refinfo=no, + abnt-refinfo="no", + key="aaaa"} +@ABNT-options{abnt-repeated-author-omit=no, + abnt-repeated-author-omit="no", + abnt-repeated-title-omit="no", + key="aaaa"} +@ABNT-options{abnt-repeated-author-omit=yes, + abnt-repeated-author-omit="yes", + key="aaaa"} +@ABNT-options{abnt-repeated-title-omit=no, + abnt-repeated-title-omit="no", + key="aaaa"} +@ABNT-options{abnt-repeated-title-omit=yes, + abnt-repeated-author-omit="yes", + abnt-repeated-title-omit="yes", + key="aaaa"} +@ABNT-options{abnt-show-options=no, + abnt-show-options="no", + key="aaaa"} +@ABNT-options{abnt-show-options=warn, + abnt-show-options="warn", + key="aaaa"} +@ABNT-options{abnt-show-options=list, + abnt-show-options="list", + key="aaaa"} +@ABNT-options{abnt-substyle=none, + abnt-substyle="none", + key="aaaa"} +@ABNT-options{abnt-substyle=UFLA, + abnt-etal-cite=2, + abnt-etal-list=0, + abnt-and-type="&", + key="aaaa"} +@ABNT-options{abnt-substyle=COPPE, + abnt-title-command="yes", + key="aaaa"} +@ABNT-options{abnt-thesis-year=final, + abnt-thesis-year="final", + key="aaaa"} +@ABNT-options{abnt-thesis-year=title, + abnt-thesis-year="title", + key="aaaa"} +@ABNT-options{abnt-thesis-year=both, + abnt-thesis-year="both", + key="aaaa"} +@ABNT-options{abnt-title-command=no, + abnt-title-command="no", + key="aaaa"} +@ABNT-options{abnt-title-command=yes, + abnt-title-command="yes", + key="aaaa"} +@ABNT-options{abnt-url-package=none, + abnt-url-package="none", + key="aaaa"} +@ABNT-options{abnt-url-package=url, + abnt-url-package="url", + key="aaaa"} +@ABNT-options{abnt-url-package=hyperref, + abnt-url-package="hyperref", + key="aaaa"} +@ABNT-options{abnt-verbatim-entry=no, + abnt-verbatim-entry="no", + key="aaaa"} +@ABNT-options{abnt-verbatim-entry=yes, + abnt-verbatim-entry="yes", + key="."} +@ISO-options{iso-690-1987, + abnt-cite-style="(Author, YEAR)", + iso-abbreviation="standard", + iso-author-punctuation="void", + iso-date-place="ISO", + key="aaaa"} diff --git a/macros/latex/contrib/abntex2/tex/abntex2.cls b/macros/latex/contrib/abntex2/tex/abntex2.cls new file mode 100644 index 0000000000..6be8cd7947 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2.cls @@ -0,0 +1,1125 @@ +%% abntex2.cls, v-1.9.7 laurocesar +%% Copyright 2012-2018 by abnTeX2 group at https://www.abntex.net.br/ +%% +%% 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 +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the abnTeX2 team, led +%% by Lauro César Araujo. Further information are available on +%% https://www.abntex.net.br/ +%% +%% This work consists of the file abntex2.cls. + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Declaracao da classe abntex2 como uma extensao da classe memoir +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{abntex2}[2018/11/24 v-1.9.7 abnTeX2] +\RequirePackage{ifthen} +% +% Captura as options article e twocolumn +% +\providecommand{\ABNTEXisarticle}{false} +\DeclareOption{article}{ + \renewcommand{\ABNTEXisarticle}{true} + \PassOptionsToClass{article}{memoir}%} +} +\providecommand{\ABNTEXistwocolumn}{false} +\DeclareOption{twocolumn}{ + \renewcommand{\ABNTEXistwocolumn}{true} + \PassOptionsToClass{twocolumn}{memoir}%} +} +% +% Opcoes chapter=TITLE, section=TITLE, subsection=TITLE e +% subsubsection=TITLE: titulos em letras maiusculas +% +\newboolean{ABNTEXupperchapter} %true=titles of chapter/appendix in uppercase +\newboolean{ABNTEXuppersection} %true=titles of sections in uppercase +\newboolean{ABNTEXuppersubsection} %true=titles of subsections in uppercase +\newboolean{ABNTEXuppersubsubsection} %true=titles of subsubsections in uppercase +\newboolean{ABNTEXuppersubsubsubsection} %true=titles of subsubsubsections in uppercase +\setboolean{ABNTEXupperchapter}{false} +\setboolean{ABNTEXuppersection}{false} +\setboolean{ABNTEXuppersubsection}{false} +\setboolean{ABNTEXuppersubsubsection}{false} +\setboolean{ABNTEXuppersubsubsubsection}{false} +\DeclareOption{chapter=TITLE}{\setboolean{ABNTEXupperchapter}{true}} +\DeclareOption{section=TITLE}{\setboolean{ABNTEXuppersection}{true}} +\DeclareOption{subsection=TITLE}{\setboolean{ABNTEXuppersubsection}{true}} +\DeclareOption{subsubsection=TITLE}{\setboolean{ABNTEXuppersubsubsection}{true}} +\DeclareOption{subsubsubsection=TITLE}{\setboolean{ABNTEXuppersubsubsubsection}{true}} +% +% Opções de diagramação de sumários +% sumario=tradicional : Sumário tradicional do LaTeX/Memoir +% sumario=abnt-6027-2012 : Sumário conforme recomendação da ABNT NBR 6027:2012 +\newboolean{ABNTEXsumario-tradicional} %true=titles of chapter/appendix in uppercase +\newboolean{ABNTEXsumario-abnt-6027-2012} +\setboolean{ABNTEXsumario-tradicional}{false} +\setboolean{ABNTEXsumario-abnt-6027-2012}{true} +\DeclareOption{sumario=tradicional}{% + \setboolean{ABNTEXsumario-tradicional}{true}% + \setboolean{ABNTEXsumario-abnt-6027-2012}{false}} +\DeclareOption{sumario=abnt-6027-2012}{% + \setboolean{ABNTEXsumario-abnt-6027-2012}{true} + \setboolean{ABNTEXsumario-tradicional}{false}} +% +% Repassa demais opcoes a memoir +% +\DeclareOption*{% + \PassOptionsToClass{\CurrentOption}{memoir}% +} +\ProcessOptions\relax +\LoadClass{memoir} + +% sumario=abnt-6027-2012 : Sumário conforme recomendação da ABNT NBR 6027:2012, que +% soh pode ser usado com memoir v3.6k ou superior +% \settocpreprocessor \changes{v3.6k}{2012/09/18}{Added} +\ifdefined\settocpreprocessor +\else + \setboolean{ABNTEXsumario-tradicional}{true} + \setboolean{ABNTEXsumario-abnt-6027-2012}{false} +\fi + + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos para tratamento de opcoes proprias +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Comandos para controlar as opcoes de titulos com letras maiusculas +% --- + +% pacote que prove \MakeTextUppercase +\RequirePackage{textcase} + +\newcommand{\ABNTEXchapterupperifneeded}[1]{\ifthenelse{\boolean{ABNTEXupperchapter}}{\MakeTextUppercase{#1}}{#1}} +\newcommand{\ABNTEXsectionupperifneeded}{\ifthenelse{\boolean{ABNTEXuppersection}}{\MakeTextUppercase}{}} +\newcommand{\ABNTEXsubsectionupperifneeded}{\ifthenelse{\boolean{ABNTEXuppersubsection}}{\MakeTextUppercase}{}} +\newcommand{\ABNTEXsubsubsectionupperifneeded}{\ifthenelse{\boolean{ABNTEXuppersubsubsection}}{\MakeTextUppercase}{}} +\newcommand{\ABNTEXsubsubsubsectionupperifneeded}{\ifthenelse{\boolean{ABNTEXuppersubsubsubsection}}{\MakeTextUppercase}{}} +% --- + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Pacotes adicionais e customizacoes gerais do memoir +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Do pacote de if/them/else +\newcommand{\abntex@ifnotempty}[2]{\ifthenelse{\not\equal{#1}{}}{#2}{}} +% --- + +% --- +% Controla as referencias internas do PDF +\RequirePackage{hyperref} +\pdfstringdefDisableCommands{\def\\{, }\def\and{; }} +% --- + +% --- +% Controla os bookmarks do PDF +\RequirePackage{bookmark} +% --- + +% --- +% Hifenizacao e caracteres especiais portugues-brasil por padrao +% --- +\RequirePackage[brazil]{babel} +% +% Nomes constantes do abnTeX2 em portugues (definicoes padroes) +\newcommand{\folhaderostoname}{Folha de rosto} +\newcommand{\epigraphname}{Ep\'igrafe} +\newcommand{\dedicatorianame}{Dedicat\'oria} +\newcommand{\errataname}{Errata} +\newcommand{\agradecimentosname}{Agradecimentos} +\newcommand{\anexoname}{ANEXO} +\newcommand{\anexosname}{Anexos} +\newcommand{\apendicename}{AP\^ENDICE} +\newcommand{\apendicesname}{Ap\^endices} +\newcommand{\orientadorname}{Orientador:} +\newcommand{\coorientadorname}{Coorientador:} +\newcommand{\folhadeaprovacaoname}{Folha de aprova\c{c}\~ao} +\newcommand{\resumoname}{Resumo} +\newcommand{\listadesiglasname}{Lista de abreviaturas e siglas} +\newcommand{\listadesimbolosname}{Lista de s\'imbolos} +\newcommand{\fontename}{Fonte} +\newcommand{\notaname}{Nota} +% +\addto\captionsbrazil{% portugues-brasil + %% ajusta nomes padroes do babel + \renewcommand{\bibname}{Refer\^encias} + \renewcommand{\indexname}{\'Indice} + \renewcommand{\listfigurename}{Lista de ilustra\c{c}\~{o}es} + \renewcommand{\listtablename}{Lista de tabelas} + %% ajusta nomes usados com a macro \autoref + \renewcommand{\pageautorefname}{p\'agina} + \renewcommand{\sectionautorefname}{se{\c c}\~ao} + \renewcommand{\subsectionautorefname}{subse{\c c}\~ao} + \renewcommand{\subsubsectionautorefname}{subse{\c c}\~ao} + \renewcommand{\paragraphautorefname}{subse{\c c}\~ao} +} +\addto\captionsenglish{% ingles + %% adjusts names from abnTeX2 + \renewcommand{\folhaderostoname}{Title page} + \renewcommand{\epigraphname}{Epigraph} + \renewcommand{\dedicatorianame}{Dedication} + \renewcommand{\errataname}{Errata sheet} + \renewcommand{\agradecimentosname}{Acknowledgements} + \renewcommand{\anexoname}{ANNEX} + \renewcommand{\anexosname}{Annex} + \renewcommand{\apendicename}{APPENDIX} + \renewcommand{\apendicesname}{Appendix} + \renewcommand{\orientadorname}{Supervisor:} + \renewcommand{\coorientadorname}{Co-supervisor:} + \renewcommand{\folhadeaprovacaoname}{Approval} + \renewcommand{\resumoname}{Abstract} + \renewcommand{\listadesiglasname}{List of abbreviations and acronyms} + \renewcommand{\listadesimbolosname}{List of symbols} + \renewcommand{\fontename}{Source} + \renewcommand{\notaname}{Note} + %% adjusts names used by \autoref + \renewcommand{\pageautorefname}{page} + \renewcommand{\sectionautorefname}{section} + \renewcommand{\subsectionautorefname}{subsection} + \renewcommand{\subsubsectionautorefname}{subsubsection} + \renewcommand{\paragraphautorefname}{subsubsubsection} +} +% --- + +% --- +% Customiza listas +\RequirePackage{enumitem} +% --- + +% --- +% Pacote que permite realizar operacoes matematicas no codigo TeX +\RequirePackage{calc} +% --- + +% --- +% Margens - NBR 14724/2011 - 5.1 Formato +% --- +\setlrmarginsandblock{3cm}{2cm}{*} +\setulmarginsandblock{3cm}{2cm}{*} +\checkandfixthelayout +% --- + +% --- +% Espacamento entre linhas - NBR 14724/2011 - 5.2 Espacamento +% --- +\OnehalfSpacing +% --- + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos publicos +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% ``Tamanho menor e uniforme'' ditada pela NBR 14724/2011 - 5.1 +% --- +\newcommand{\ABNTEXfontereduzida}{\footnotesize} +% --- + +% --- +% abnTeX2 name +\newcommand{\abnTeX}{abn\TeX2} +% --- + +% --- +% Fontes padroes de part, chapter, section, subsection e subsubsection +\newcommand{\ABNTEXchapterfont}{\sffamily} +\newcommand{\ABNTEXchapterfontsize}{\Huge} + +\newcommand{\ABNTEXpartfont}{\ABNTEXchapterfont} +\newcommand{\ABNTEXpartfontsize}{\ABNTEXchapterfontsize} + +\newcommand{\ABNTEXsectionfont}{\ABNTEXchapterfont} +\newcommand{\ABNTEXsectionfontsize}{\Large} + +\newcommand{\ABNTEXsubsectionfont}{\ABNTEXsectionfont} +\newcommand{\ABNTEXsubsectionfontsize}{\large} + +\newcommand{\ABNTEXsubsubsectionfont}{\ABNTEXsubsectionfont} +\newcommand{\ABNTEXsubsubsectionfontsize}{\normalsize} + +\newcommand{\ABNTEXsubsubsubsectionfont}{\ABNTEXsubsectionfont} +\newcommand{\ABNTEXsubsubsubsectionfontsize}{\normalsize} +% --- + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos e variaveis privados +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Comando para registro do bookmark interno +% --- +\newcounter{abntex@bookmarkcounter} +\setcounter{abntex@bookmarkcounter}{0} +\newcommand{\PRIVATEbookmarkthis}[1]{% + \addtocounter{abntex@bookmarkcounter}{1}% + \phantomsection\pdfbookmark[0]{#1}{chapterb\arabic{abntex@bookmarkcounter}} +} +% --- + +% --- +% Comando que cria capitulos nao numerados ja com bookmark anotado +% --- +\newcommand{\pretextualchapter}[1]{% + \addtocounter{abntex@bookmarkcounter}{1}% + \PRIVATEbookmarkthis{#1}% + \chapter*[#1]{#1}% + } +\provideboolean{abntex@apendiceousecao} +\setboolean{abntex@apendiceousecao}{false} +% --- + +% --- +% cleardoublepage se este documento nao for article +% --- +\newcommand{\PRIVATEclearpageifneeded}{% + \ifthenelse{\equal{\ABNTEXisarticle}{true}}{% + % + }{ % else + \cleardoublepage% + } +} + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Configuracoes de layout +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Notas de rodape - footnotes - NBR 14724/2011 - 5.2.1 +\setlength{\footmarkwidth}{1.2em} % largura do footnotemark +\setlength{\footmarksep}{0em} +\footmarkstyle{\footnotesize{\textsuperscript{#1}}\hfill} + +% tamanho da fonte do footnote +\renewcommand{\foottextfont}{\ABNTEXfontereduzida} +% --- + +% --- +% Numeracao continua das figuras +\ifthenelse{\equal{\ABNTEXisarticle}{true}}{% + \counterwithout{section}{chapter} + \counterwithout{figure}{section} + \counterwithout{table}{section} +}{%else + \counterwithout{figure}{chapter} + \counterwithout{table}{chapter} +} +% --- + +% --- +% Estilos de caption +% --- +\hangcaption +\newcommand{\ABNTEXcaptiondelim}{~\textendash~} +\newcommand{\ABNTEXcaptionfontedelim}{:~} +%\captionnamefont{\ABNTEXfontereduzida} +%\captiontitlefont{\ABNTEXfontereduzida} + +% Para uso com pacotes subfig e caption dentro do memoir se estes forem carregados ou não. +% É necessário para que os comandos \IBGEtab e \fonte funcionem +% independente do carregamento de pacotes externos ao memoir que tratam captions. +\newcommand{\IBGEtabfontsize}{\ABNTEXfontereduzida} +\AtBeginDocument{% + % comandos auxiliares para manipular os captions dentro do comando \IBGEtab. + \newcommand{\configurecaptions}{\captionstyle[\raggedright]{}} + \newcommand{\configureseparator}{\captiondelim{\ABNTEXcaptiondelim}} + % Define o comando \IBGEtab{}{}{} com caption e legenda da largura do conteúdo tabular, tabular*, etc + % Parece funcionar com qualque pacote + \newsavebox{\myptabbox} + \newlength{\myptabboxwidth} + \newcommand{\IBGEtab}[3]{% + \savebox{\myptabbox}{{\IBGEtabfontsize #2}}% + \settowidth{\myptabboxwidth}{\usebox{\myptabbox}}% + \centering% + \parbox{\myptabboxwidth}{% + \configurecaptions + #1% + \par% + {\IBGEtabfontsize% + #2% + }% + \par% + #3}% + } + \let\ibgetab\IBGEtab +} + +% Define o comando \fonte que respeita as configurações de caption do memoir ou do caption +\newcommand{\fonte}[2][\fontename]{% + \M@gettitle{#2}% + \memlegendinfo{#2}% + \par + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \ABNTEXfontereduzida + %\configureseparator + \captiondelim{\ABNTEXcaptionfontedelim} + \@makecaption{\ABNTEXfontereduzida #1}{\ignorespaces\ABNTEXfontereduzida #2}\par + \endgroup} + +% Define o comando \notas que respeita as configurações de caption do memoir ou do caption +\newcommand{\nota}[2][\notaname]{\fonte[#1]{#2}} + + +% Altera os comandos \configurecaptions e \configureseparator para trabalhar com +% o pacote caption e amigos. +\AtEndPackage{caption}{ + \AtBeginDocument{% + \DeclareCaptionLabelSeparator{barr}{\ABNTEXcaptiondelim} + \DeclareCaptionFont{ABNTEXfontereduzida}{\ABNTEXfontereduzida} + \captionsetup{format=hang, + labelseparator=barr, + %labelfont=ABNTEXfontereduzida, + %font=ABNTEXfontereduzida + } + \renewcommand{\configurecaptions}{% + \captionsetup{justification=justified,% + singlelinecheck=false}} + \renewcommand{\configureseparator}{\captionsetup{labelsep=colon}} + } +} + +\AtBeginDocument{ + \captiondelim{\ABNTEXcaptiondelim} +} +% --- + +% ----- +% Configuracoes do TOC +% ----- +% nivel de profundidade (implementa o quinto nivel - subsubsubsection) +\setsecnumdepth{paragraph} +\settocdepth{paragraph} +\setcounter{tocdepth}{5} +\setcounter{secnumdepth}{5} +\maxsecnumdepth{paragraph} + +% redefine os comandos *paragraph* para *subsubsubsection* **** +\newcommand{\subsubsubsection}{\paragraph} +\newcommand{\cftbeforesubsubsubsectionskip}{\cftbeforeparagraphskip} +\newcommand{\cftsubsubsubsectionfont}{\cftparagraphfont} +\newcommand{\setsubsubsubsecheadstyle}{\setparaheadstyle} + +\setafterparaskip{1.0\onelineskip plus 0.5\onelineskip minus 0.2\onelineskip} +\setparaheadstyle{\normalfont\sffamily\raggedright}% + +% lista de ilustracoes +\renewcommand{\cftfigurename}{\figurename\space} +\renewcommand*{\cftfigureaftersnum}{\hfill\textendash\hfill} + +% lista de tabelas +\renewcommand{\cfttablename}{\tablename\space} +\renewcommand*{\cfttableaftersnum}{\hfill\textendash\hfill} + +% fonte das partes e do capitulo do TOC +\renewcommand{\tocheadstart}{\ABNTEXchapterfont} + +% leaders para os capitulos +\renewcommand*{\cftchapterdotsep}{\cftdotsep} + +% suprime espaço entre os itens de listings de diferentes capítulos +\setlength{\cftbeforechapterskip}{0pt plus 0pt} +\renewcommand*{\insertchapterspace}{} + +% macros para configurar o Sumário conforme 6027-2012 ou tradicional cft +\cftinsertcode{A}{} + +\newlength{\cftlastnumwidth} +\setlength{\cftlastnumwidth}{\cftsubsubsectionnumwidth} +\addtolength{\cftlastnumwidth}{1em} + +\newcommand{\tocprintchapter}{} +\newcommand{\tocinnonumchapter}{} +\newcommand{\tocprintchapternonum}{} +\newcommand{\tocpartapendices}{} +\newcommand{\tocpartanexos}{} + +% insere o hifen no anexo/apendice do toc +\cftinsertcode{A}{\renewcommand{\cftchapteraftersnum}{\hfill\textendash\hfill}} + +% No caso de Sumario (TOC) tradicional +\ifthenelse{\boolean{ABNTEXsumario-tradicional}}{}{} % essa linha não faz nada, + % mas se houver necessidade de alterar o comportamento + % do sumário tradicional altere aqui. + +% No caso de Sumario (TOC) especifico da ABNT-6027-2012 + +\makeatletter +\ifthenelse{\boolean{ABNTEXsumario-abnt-6027-2012}}{ + \settocpreprocessor{chapter}{% + \let\tempf@rtoc\f@rtoc% + \def\f@rtoc{% + \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}% + } + \settocpreprocessor{part}{% + \let\tempf@rtoc\f@rtoc% + \def\f@rtoc{% + \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}% + } +}{} +\makeatother +% +\ifthenelse{\boolean{ABNTEXsumario-abnt-6027-2012}}{% + + \cftsetindents{part}{0em}{\cftlastnumwidth} + \cftsetindents{chapter}{0em}{\cftlastnumwidth} + \cftsetindents{section}{0em}{\cftlastnumwidth} + \cftsetindents{subsection}{0em}{\cftlastnumwidth} + \cftsetindents{subsubsection}{0em}{\cftlastnumwidth} + \cftsetindents{paragraph}{0em}{\cftlastnumwidth} + \cftsetindents{subparagraph}{0em}{\cftlastnumwidth} + % + \renewcommand{\tocprintchapter}{% + \addtocontents{toc}{\cftsetindents{chapter}{0em}{\cftlastnumwidth}}} + % + \renewcommand{\tocinnonumchapter}{% + \addtocontents{toc}{\cftsetindents{chapter}{\cftlastnumwidth}{2em}}% + \cftinserthook{toc}{A}} + % + \renewcommand{\tocprintchapternonum}{% + \addtocontents{toc}{\cftsetindents{chapter}{\cftlastnumwidth}{2em}}} + % + \renewcommand{\tocpartapendices}{% + \addtocontents{toc}{\cftsetindents{part}{\cftlastnumwidth}{2em}} + \cftinserthook{toc}{A}} + % + \renewcommand{\tocpartanexos}{% + \addtocontents{toc}{\cftsetindents{part}{\cftlastnumwidth}{2em}} + \cftinserthook{toc}{A}} + % + \setlength{\cftbeforechapterskip}{1em} + % + % Fontes das entradas do sumario + % + \renewcommand{\cftpartfont}{\bfseries\large} + % + \renewcommand{\cftchapterfont}{\bfseries} + \renewcommand{\cftchapterpagefont}{\normalsize\cftchapterfont} + % + \renewcommand{\cftsectionfont}{\bfseries} + \renewcommand{\cftsectionpagefont}{\cftsectionfont} + % + \renewcommand{\cftsubsectionfont}{\normalsize} + \renewcommand{\cftsubsectionpagefont}{\cftsubsectionfont} + % + \renewcommand{\cftsubsubsectionfont}{\small} + \renewcommand{\cftsubsubsectionpagefont}{\cftsubsubsectionfont} + % + \renewcommand{\cftparagraphfont}{\footnotesize} + \renewcommand{\cftparagraphpagefont}{\cftparagraphfont} + % + % Ajusta entrada Referencias + % + \renewcommand{\bibsection}{% + \chapter*{\bibname} + \bibmark + \ifnobibintoc\else + \phantomsection + \addcontentsline{toc}{chapter}{\texorpdfstring{\MakeTextUppercase{\bibname}}{\bibname}} + \fi + \prebibhook +} + +}{} + +% Comando que simula a finalizacao de uma parte no bookmark e +% adiciona espaco de \part no sumario +\newcommand{\phantompart}{% + \bookmarksetup{startatroot}% + \phantomsection% + \ifthenelse{\boolean{ABNTEXsumario-abnt-6027-2012}}{% + \addtocontents{toc}{\vspace{\cftbeforechapterskip}}}{% + \addtocontents{toc}{\vspace{\cftbeforepartskip}}}% +} +% ----- + +% --- +% Configuracao dos titulos dos capitulos +% Novo estido do memoir +% ABNT NBR 14724-2011 - 5.2.2-5.2.4; ABNT NBR 6024-2003 - 3.1-3.8 +\provideboolean{abntex@innonumchapter} +\setboolean{abntex@innonumchapter}{true} +\makechapterstyle{abnt}{% + \renewcommand{\chapterheadstart}{} + + \ifx \chapternamenumlength \undefined + \newlength{\chapternamenumlength} + \fi + + % tamanhos de fontes de chapter e part + \ifthenelse{\equal{\ABNTEXisarticle}{true}}{% + \setlength\beforechapskip{\baselineskip} + \renewcommand{\chaptitlefont}{\ABNTEXsectionfont\ABNTEXsectionfontsize} + }{%else + \setlength{\beforechapskip}{0pt} + \renewcommand{\chaptitlefont}{\ABNTEXchapterfont\ABNTEXchapterfontsize} + } + + \renewcommand{\chapnumfont}{\chaptitlefont} + \renewcommand{\parttitlefont}{\ABNTEXpartfont\ABNTEXpartfontsize} + \renewcommand{\partnumfont}{\ABNTEXpartfont\ABNTEXpartfontsize} + \renewcommand{\partnamefont}{\ABNTEXpartfont\ABNTEXpartfontsize} + + % tamanhos de fontes de section, subsection, subsubsection e subsubsubsection + \setsecheadstyle{\ABNTEXsectionfont\ABNTEXsectionfontsize\ABNTEXsectionupperifneeded} + \setsubsecheadstyle{\ABNTEXsubsectionfont\ABNTEXsubsectionfontsize\ABNTEXsubsectionupperifneeded} + \setsubsubsecheadstyle{\ABNTEXsubsubsectionfont\ABNTEXsubsubsectionfontsize\ABNTEXsubsubsectionupperifneeded} + \setsubsubsubsecheadstyle{\ABNTEXsubsubsubsectionfont\ABNTEXsubsubsubsectionfontsize\ABNTEXsubsubsubsectionupperifneeded} + + % impressao do numero do capitulo + \renewcommand{\chapternamenum}{} + + % impressao do nome do capitulo + \renewcommand{\printchaptername}{% + \chaptitlefont + \ifthenelse{\boolean{abntex@apendiceousecao}}{\appendixname}{}% + } + + % impressao do titulo do capitulo + \def\printchaptertitle##1{% + \chaptitlefont% + \ifthenelse{\boolean{abntex@innonumchapter}}{\centering\ABNTEXchapterupperifneeded{##1}}{% + \ifthenelse{\boolean{abntex@apendiceousecao}}{% + \centering% + \settowidth{\chapternamenumlength}{\printchaptername\printchapternum\afterchapternum}% + \ABNTEXchapterupperifneeded{##1}% + }{% + \settowidth{\chapternamenumlength}{\printchaptername\printchapternum\afterchapternum}% + \parbox[t]{\columnwidth-\chapternamenumlength}{\ABNTEXchapterupperifneeded{##1}}}% + } + } + + % impressao do numero do capitulo + \renewcommand{\printchapternum}{% + \tocprintchapter + \setboolean{abntex@innonumchapter}{false} + \chapnumfont% + \space\thechapter\space% + \ifthenelse{\boolean{abntex@apendiceousecao}}{% + \tocinnonumchapter + \ABNTEXcaptiondelim% + }{} % else + } + \renewcommand{\afterchapternum}{} + + % impressao do capitulo nao numerado + \renewcommand\printchapternonum{% + \tocprintchapternonum + \setboolean{abntex@innonumchapter}{true}% + } +} +\chapterstyle{abnt} +% --- + +% ----- +% Declaracoes de cabecalhos +% ----- +% Cabecalho padrao +\makepagestyle{abntheadings} +\makeevenhead{abntheadings}{\ABNTEXfontereduzida\thepage}{}{\ABNTEXfontereduzida\textit\leftmark} +\makeoddhead{abntheadings}{\ABNTEXfontereduzida\textit\rightmark}{}{\ABNTEXfontereduzida\thepage} +\makeheadrule{abntheadings}{\textwidth}{\normalrulethickness} + +% Cabecalho do inicio do capitulo +\makepagestyle{abntchapfirst} +\makeoddhead{abntchapfirst}{}{}{\ABNTEXfontereduzida\thepage} +% --- + +% --- +% Configura layout para elementos pre-textuais +\newcommand{\pretextual}{% + \aliaspagestyle{chapter}{empty}% customizing chapter pagestyle + \pagestyle{empty} + \aliaspagestyle{cleared}{empty} + \aliaspagestyle{part}{empty} +} +\renewcommand{\frontmatter}{\pretextual} + +% por default, inicializa o documento com elementos \pretextuais +\AtBeginDocument{\pretextual} +% --- + +% --- +% Configura layout para elementos textuais +\newcommand{\textual}{% + \ifthenelse{\equal{\ABNTEXisarticle}{true}}{% + \pagestyle{plain}% + }{%else + \pagestyle{abntheadings}% + \aliaspagestyle{chapter}{abntchapfirst}% customizing chapter pagestyle + } + \nouppercaseheads% + \bookmarksetup{startatroot}% +} +\renewcommand{\mainmatter}{\textual} +% --- + +% --- +% Configura layout para elementos pos-textuais +\newcommand{\postextual}{\phantompart} +\renewcommand{\backmatter}{\postextual} +% ----- + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos de dados para CAPA e FOLHA DE ROSTO +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% Comandos de dados - titulo do documento +\newcommand{\titulo}[1]{\title{#1}} +\newcommand{\imprimirtitulo}{\thetitle} + +% Comandos de dados - titulo do documento +\newcommand{\tituloestrangeiro}[1]{\providecommand{\theforeigntitle}{#1}} +\newcommand{\imprimirtituloestrangeiro}{\theforeigntitle} + + +% Comandos de dados - autor (use \and para multiplos autores) +\newcommand{\autor}[1]{\author{#1}} +\newcommand{\imprimirautor}{\theauthor} + +% Comandos de dados - data +\let\olddate\date +\renewcommand{\date}[1]{\AtBeginDocument{\olddate{#1}}} +\newcommand{\data}[1]{\date{#1}} +\newcommand{\imprimirdata}{\thedate} + +% Comandos de dados - instituicao +\providecommand{\imprimirinstituicao}{} +\newcommand{\instituicao}[1]{\renewcommand{\imprimirinstituicao}{#1}} + +% Comandos de dados - local +\providecommand{\imprimirlocal}{} +\newcommand{\local}[1]{\renewcommand{\imprimirlocal}{#1}} + +% Comandos de dados - preambulo +\providecommand{\imprimirpreambulo}{} +\newcommand{\preambulo}[1]{\renewcommand{\imprimirpreambulo}{#1}} + +% Comandos de dados - orientador +\providecommand{\imprimirorientadorRotulo}{} +\providecommand{\imprimirorientador}{} +\newcommand{\orientador}[2][\orientadorname]% + {\renewcommand{\imprimirorientadorRotulo}{#1}% + \renewcommand{\imprimirorientador}{#2}} + +% Comandos de dados - coorientador +\providecommand{\imprimircoorientadorRotulo}{} +\providecommand{\imprimircoorientador}{} +\newcommand{\coorientador}[2][\coorientadorname]% + {\renewcommand{\imprimircoorientadorRotulo}{#1}% + \renewcommand{\imprimircoorientador}{#2}} + +% Comandos de dados - tipo de trabalho +\providecommand{\imprimirtipotrabalho}{} +\newcommand{\tipotrabalho}[1]{\renewcommand{\imprimirtipotrabalho}{#1}} + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos e ambientes de editoracao PRE-TEXTUAIS +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Ambiente para definicao da Capa +\newenvironment{capa}{\begin{titlingpage}}{\end{titlingpage}\cleardoublepage} +% --- + +% --- +% Titulos em lingua estrangeira para artigos: ABNT NBR 6022:2018 +\ifthenelse{\equal{\ABNTEXisarticle}{true}}{% +\renewcommand{\maketitlehookb}{\LARGE\center\textit{\theforeigntitle}} +}{} +% --- + +% --- +% Ficha catalografica (Dados internacionais de +% catalogação-na-publicacao) +\newenvironment{fichacatalografica}{% + \thispagestyle{empty} + \begin{SingleSpacing} + \ABNTEXfontereduzida +}{% + \end{SingleSpacing}% +}% +% --- + +% --- +% Errata +\newenvironment{errata}[1][\errataname]{% + \pretextualchapter{#1} + }{\PRIVATEclearpageifneeded} +% --- + +% --- +% Folha de aprovacao - NBR 14724/2011 - 4.2.1.3 +\newenvironment{folhadeaprovacao}[1][\folhadeaprovacaoname]{% + \clearpage% + \PRIVATEbookmarkthis{#1}% + \begin{Spacing}{1.0} +}{\end{Spacing}\PRIVATEclearpageifneeded} +% --- + +% --- +% Dedicatoria +\newenvironment{dedicatoria}[1][]{% + \ifthenelse{\equal{#1}{}}{% + \PRIVATEbookmarkthis{\dedicatorianame} + }{\pretextualchapter{#1}} + }{\PRIVATEclearpageifneeded} +% --- + +% --- +% Agradecimentos +\newenvironment{agradecimentos}[1][\agradecimentosname]{% + \pretextualchapter{#1} + }{\PRIVATEclearpageifneeded} +% --- + +% --- +% Epigrafe +\newenvironment{epigrafe}[1][]{% + \ifthenelse{\equal{#1}{}}{% + \PRIVATEbookmarkthis{\epigraphname} + }{\pretextualchapter{#1}} + }{\PRIVATEclearpageifneeded} +% --- + +% --- +% Resumo e abstracts em diferentes idiomas - NBR 14724/2011 + +% altera as margens padrões do memoir para abstract caso nao seja article +\ifthenelse{\equal{\ABNTEXisarticle}{true}}{% + % em artigos, margens e fontes são as mesmas de memoir + }{ % else + % Ajusta as margens para serem a mesma do documento + \setlength\absleftindent{0cm} + \setlength\absrightindent{0cm} + % Garante que a fonte do texto do abstract será a mesma do documento, pois + % na classe memoir está \small + \renewcommand{\abstracttextfont}{\normalfont\normalsize} + } + +% A norma não diz nada sobre identação e separação entre parágrafos no abstract, +% porém o uso mostra que muitos abstracts são montados sem identação. +\AtBeginDocument{% + \setlength{\absparindent}{0pt} +} + +\newenvironment{resumo}[1][\resumoname]{% + \PRIVATEbookmarkthis{#1} + \renewcommand{\abstractnamefont}{\chaptitlefont} + \renewcommand{\abstractname}{\ABNTEXchapterupperifneeded{#1}} + \begin{abstract} + }{\end{abstract}\PRIVATEclearpageifneeded} + +\newenvironment{resumoumacoluna}[1][\resumoname]{% + \PRIVATEbookmarkthis{#1} + \renewcommand{\abstractnamefont}{\chaptitlefont} + \renewcommand{\abstractname}{\ABNTEXchapterupperifneeded{#1}} + \begin{onecolabstract} +}{\end{onecolabstract}\PRIVATEclearpageifneeded} +% --- + +% --- +% Lista de abreviaturas e siglas +\newenvironment{siglas}{% + \pretextualchapter{\listadesiglasname} + \begin{symbols} +}{% + \end{symbols} + \cleardoublepage +} +% --- + +% --- +% Lista de simbolos +\newenvironment{simbolos}{% + \pretextualchapter{\listadesimbolosname} + \begin{symbols} +}{% + \end{symbols} + \cleardoublepage +} +% --- + + + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos e ambientes de editoracao APENDICES e ANEXOS +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Definicoes compartilhadas entre Apendices e Anexos +% --- +\makeatletter +\newcommand\@switch[1]{ \@writefile{toc}{\renewcommand*{\cftappendixname}{#1 \space}} } +\newcommand{\switchchapname}[1]{ \protected@write \@auxout {}{\string\@switch{#1} }} +\makeatother + +\newcommand{\PRIVATEapendiceconfig}[2]{% + \setboolean{abntex@apendiceousecao}{true}% + \renewcommand{\appendixname}{#1} + \ifthenelse{\boolean{ABNTEXsumario-abnt-6027-2012}}{ + \renewcommand{\appendixtocname}{\uppercase{#2}} + }{% + \renewcommand{\appendixtocname}{#2}} + \renewcommand{\appendixpagename}{#2} + \switchchapname{#1}% Corrected from \switchapname -> \switchchapname + \renewcommand*{\cftappendixname}{#1 \space} +} +% --- + +% --- +% Apendices - comando +\newcommand{\apendices}{% + \PRIVATEapendiceconfig{\apendicename}{\apendicesname} + \appendix +} +% Apendices - ambiente +\newenvironment{apendicesenv}{% + \PRIVATEapendiceconfig{\apendicename}{\apendicesname} + \begin{appendix} +}{ + \end{appendix} + \setboolean{abntex@apendiceousecao}{false} + \bookmarksetup{startatroot} +} +% --- + +% --- +% Anexos - comando +\newcommand{\anexos}{% + \cftinserthook{toc}{AAA} + + \PRIVATEapendiceconfig{\anexoname}{\anexosname} + \appendix + \renewcommand\theHchapter{anexochapback.\arabic{chapter}} +} +% Anexos - ambiente +\newenvironment{anexosenv}{% + \cftinserthook{toc}{AAA} + + \PRIVATEapendiceconfig{\anexoname}{\anexosname} + \begin{appendix} + \renewcommand\theHchapter{anexochapback.\arabic{chapter}} +}{ + \end{appendix} + \setboolean{abntex@apendiceousecao}{false} + \bookmarksetup{startatroot} +} +% --- + +% --- +% Imprime uma pagina de divisao no estilo parte +\newcommand{\partpage}{% + \cleardoublepage + \phantomsection + \addcontentsline{toc}{part}{\appendixtocname}% + \appendixpage* +} + +% atalhos para \partpage ou \appendixpage* +\makeatletter +\newcommand{\partapendices}{% +\tocpartapendices% +\@ifstar{\appendixpage*}{\partpage}} + +\newcommand{\partanexos}{% +\tocpartanexos% +\@ifstar{\appendixpage*}{\partpage}} +\makeatother +% --- + + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% Comandos e ambientes de editoracao CITACAO, ALINEA, INCISO, ASSINATURA +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Citacao direta com mais de 3 linhas - ABNT NBR 10520/2002 - 5.3 +\newlength{\ABNTEXcitacaorecuo}% recuo de 4 cm da margem esquerda +\ifthenelse{\equal{\ABNTEXistwocolumn}{true}}{% + \setlength{\ABNTEXcitacaorecuo}{1.8cm} +}{% else + \setlength{\ABNTEXcitacaorecuo}{4cm} +} +\newenvironment*{citacao}[1][default]{% + \list{}% + \ABNTEXfontereduzida% + \addtolength{\leftskip}{\ABNTEXcitacaorecuo}% + \item[]% + \begin{SingleSpace}% + \ifthenelse{\not\equal{#1}{default}}{\itshape\selectlanguage{#1}}{}% + }{% + \end{SingleSpace}% + \endlist}% +% --- + +% --- +% Ambiente para alineas e e subalineas (incisos) +% ABNT NBR 6024/2012 - 4.2 e 4.3 +\newlist{alineas}{enumerate}{2} +\setlist[alineas,1]{label={\alph*)},topsep=0pt,itemsep=0pt,leftmargin=\parindent+\labelwidth-\labelsep}% +\setlist[alineas,2]{label={--},topsep=0pt,itemsep=0pt,leftmargin=*} +\newlist{subalineas}{enumerate}{1} +\setlist[subalineas,1]{label={--},topsep=0pt,itemsep=0pt,leftmargin=*}% +\newlist{incisos}{enumerate}{1} +\setlist[incisos,1]{label={--},topsep=0pt,itemsep=0pt,leftmargin=*}% +% --- + +% --- +% Comando \assinatura for signature + % width of the line and text under the line +\newlength{\ABNTEXsignwidth} +\setlength{\ABNTEXsignwidth}{8cm} + % thickness of the line +\newlength{\ABNTEXsignthickness} +\setlength{\ABNTEXsignthickness}{1pt} + % ammount of space left between previous text and th signature line +\newlength{\ABNTEXsignskip} +\setlength{\ABNTEXsignskip}{0.7cm} + % \assinatura{name} -> types a line with name under the line, centralized + % \assinatura*{name} -> Creates the box with the line and name under + % it, but the box has no position assigned. However the line and the + % name are centralized with respect to each other. +\makeatletter +\newcommand{\assinatura}{\@ifstar{\ABNTEXsign}{\ABNTEXcsign}} +\makeatother + % assinatura com estrela +\newcommand{\ABNTEXsign}[1]{% + \parbox[t]{\ABNTEXsignwidth}{\SingleSpacing\vspace*{\ABNTEXsignskip}\centering% + \rule{\ABNTEXsignwidth}{\ABNTEXsignthickness}\\% + \nopagebreak #1\par}% +} + % assinatura sem estrela +\newcommand{\ABNTEXcsign}[1]% + {\begingroup\par\centering\ABNTEXsign{#1}\par\endgroup} +% --- + +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ +% IMPRESSOES PADROES DE CAPA E FOLHA DE ROSTO +% ------------------------------------------------------------------------ +% ------------------------------------------------------------------------ + +% --- +% Impressão da Capa +\newcommand{\imprimircapa}{% + \begin{capa}% + \center + \ABNTEXchapterfont\large\imprimirautor + + \vfill + \begin{center} + \ABNTEXchapterfont\bfseries\LARGE\imprimirtitulo + \end{center} + \vfill + + \large\imprimirlocal + + \large\imprimirdata + + \vspace*{1cm} + \end{capa} +} +% --- + + +% --- +% Folha de rosto +% usar \imprimirfolhaderosto* casodeseje imprimir algo no verso da +% página no caso de estar no modo twoside. Util para imprimir a Ficha +% Bibliografica. Porem, se estiver no modo oneside, a versao sem estrela +% é identica. +\newenvironment{folhaderosto}[1][\folhaderostoname]{\clearpage\PRIVATEbookmarkthis{#1}}{\cleardoublepage} +\newenvironment{folhaderosto*}[1][\folhaderostoname]{\clearpage\PRIVATEbookmarkthis{#1}}{\newpage}% + +% --- +% Conteudo padrao da Folha de Rosto +\makeatletter +\newcommand{\folhaderostocontent}{ + \begin{center} + + %\vspace*{1cm} + {\ABNTEXchapterfont\large\imprimirautor} + + \vspace*{\fill}\vspace*{\fill} + \begin{center} + \ABNTEXchapterfont\bfseries\Large\imprimirtitulo + \end{center} + \vspace*{\fill} + + \abntex@ifnotempty{\imprimirpreambulo}{% + \hspace{.45\textwidth} + \begin{minipage}{.5\textwidth} + \SingleSpacing + \imprimirpreambulo + \end{minipage}% + \vspace*{\fill} + }% + + {\abntex@ifnotempty{\imprimirinstituicao}{\imprimirinstituicao\vspace*{\fill}}} + + {\large\imprimirorientadorRotulo~\imprimirorientador\par} + \abntex@ifnotempty{\imprimircoorientador}{% + {\large\imprimircoorientadorRotulo~\imprimircoorientador}% + }% + \vspace*{\fill} + + {\large\imprimirlocal} + \par + {\large\imprimirdata} + \vspace*{1cm} + + \end{center} +} +\makeatother + +\newcommand{\imprimirfolhaderostostar}[1]{% + \begin{folhaderosto*}{#1} + \folhaderostocontent + \end{folhaderosto*}} + +\newcommand{\imprimirfolhaderostonostar}[1]{% + \begin{folhaderosto}{#1} + \folhaderostocontent + \end{folhaderosto}} + +\makeatletter +\newcommand{\imprimirfolhaderosto}[1][\folhaderostoname]{% + \@ifstar + \imprimirfolhaderostostar + \imprimirfolhaderostonostar +} +\makeatother +% --- diff --git a/macros/latex/contrib/abntex2/tex/abntex2abrev.sty b/macros/latex/contrib/abntex2/tex/abntex2abrev.sty new file mode 100644 index 0000000000..d19404d993 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2abrev.sty @@ -0,0 +1,124 @@ +%% abntex2abrev.sty, v-1.9.7 laurocesar +%% Copyright 2012-2018 by abnTeX2 group at https://www.abntex.net.br/ +%% +%% 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 +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the abnTeX2 team, led +%% by Lauro César Araujo. Further information are available on +%% https://www.abntex.net.br/ +%% +%% Creator and original mantainer: Gerald Weber <gweber@codigolivre.org.br> +%% Copyright 2003 by the abnTeX group at http://abntex.codigolivre.org.br + +\NeedsTeXFormat{LaTeX2e} + +\RequirePackage{ifthen} + +\newcommand{\NoAbrevending}{\let\Abrevending\@empty} + +% Incorporating file nbr10522-1988.def from abntex1 +\newcommand{\@NBR@A@abril}{abr} +\newcommand{\@NBR@A@acompanhamento}{acomp} +\newcommand{\@NBR@A@adaptacao}{adapt} +\newcommand{\@NBR@A@adaptado}{adapt} +\newcommand{\@NBR@A@adaptada}{adapt} +\newcommand{\@NBR@A@adaptador}{adapt} +\newcommand{\@NBR@A@adaptadora}{adapt} +\newcommand{\@NBR@A@agosto}{ago} +\newcommand{\@NBR@A@ampliado}{ampl} +\newcommand{\@NBR@A@ampliada}{ampl} +\newcommand{\@NBR@A@capitulo}{cap} +\newcommand{\@NBR@A@capitulos}{cap} +\newcommand{\@NBR@A@citacao}{cit} +\newcommand{\@NBR@A@edicao}{ed} +\newcommand{\@NBR@A@editado}{ed} +\newcommand{\@NBR@A@editada}{ed} +\newcommand{\@NBR@A@editor}{ed} +\newcommand{\@NBR@A@editora}{ed} +\newcommand{\@NBR@A@fevereiro}{fev} +\newcommand{\@NBR@A@dezembro}{dez} +\newcommand{\@NBR@A@ilustracao}{il} +\newcommand{\@NBR@A@ilustrado}{il} +\newcommand{\@NBR@A@ilustrada}{il} +\newcommand{\@NBR@A@ilustrador}{il} +\newcommand{\@NBR@A@ilustradora}{il} +\newcommand{\@NBR@A@janeiro}{jan} +\newcommand{\@NBR@A@junho}{jun} +\newcommand{\@NBR@A@julho}{jul} +\newcommand{\@NBR@A@marco}{mar} +\newcommand{\@NBR@A@maio}{maio\NoAbrevending} +\newcommand{\@NBR@A@novembro}{nov} +\newcommand{\@NBR@A@outubro}{out} +\newcommand{\@NBR@A@oeste}{O\NoAbrevending} +\newcommand{\@NBR@A@setembro}{set} +\newcommand{\@NBR@A@pagina}{p} +% end of nbr10522-1988.def + +\newcommand{\@NBR}{@NBR@A@} +\newcommand{\@PREF@}[1]{\csname \@NBR#1\endcsname} + +% Incorporating file abntex-abrev-pt_BR.def from abntex1 +\providecommand{\@PREF@}{} +\newcommand{\@TR@adaptation}{\@PREF@{adaptacao}} +\newcommand{\@TR@adapted}{\@PREF@{adaptado}} +\newcommand{\@TR@adapter}{\@PREF@{adaptador}} +\newcommand{\@TR@april}{\@PREF@{abril}} +\newcommand{\@TR@august}{\@PREF@{agosto}} +\newcommand{\@TR@chapter}{\@PREF@{capitulo}} +\newcommand{\@TR@chapters}{\@PREF@{capitulos}} +\newcommand{\@TR@citation}{\@PREF@{citacao}} +\newcommand{\@TR@extended}{\@PREF@{ampliado}} +\newcommand{\@TR@edited}{\@PREF@{editado}} +\newcommand{\@TR@edition}{\@PREF@{edicao}} +\newcommand{\@TR@editor}{\@PREF@{editor}} +\newcommand{\@TR@february}{\@PREF@{fevereiro}} +\newcommand{\@TR@december}{\@PREF@{dezembro}} +\newcommand{\@TR@illustrated}{\@PREF@{ilustrado}} +\newcommand{\@TR@illustration}{\@PREF@{ilustracao}} +\newcommand{\@TR@illustrator}{\@PREF@{ilustrador}} +\newcommand{\@TR@january}{\@PREF@{janeiro}} +\newcommand{\@TR@june}{\@PREF@{junho}} +\newcommand{\@TR@jule}{\@PREF@{julho}} +\newcommand{\@TR@march}{\@PREF@{marco}} +\newcommand{\@TR@may}{\@PREF@{maio}} +\newcommand{\@TR@november}{\@PREF@{novembro}} +\newcommand{\@TR@october}{\@PREF@{outubro}} +\newcommand{\@TR@september}{\@PREF@{setembro}} +\newcommand{\@TR@west}{\@PREF@{oeste}} +\newcommand{\@TR@page}{\@PREF@{pagina}} +% end of abntex-abrev-pt_BR.def + + +\ProcessOptions + +\newcommand{\@TR@}{@TR@} +\newcommand{\Capitalize}[1]{\uppercase{#1}} + +%para testar, coloca os resultados em forma mais explícita +\newcommand{\TESTabrev}[1]{% +\@ifundefined{@TR@#1}{pt(#1):\csname \@NBR#1\endcsname}{en(#1):\csname \@TR@#1\endcsname}} + +%controla como termina a abreviação +\newcommand{\abrevending}{.} +\newcommand{\Abrevending}{} +%comando para usuários, pode ser portugês ou inglês +\newcommand{\abrev}[1]{\let\Abrevending\abrevending% +\@ifundefined{@TR@#1}{\csname \@NBR#1\endcsname\Abrevending}{\csname \@TR@#1\endcsname\Abrevending}} + +%comando para usuários, pode ser portugês ou inglês +\newcommand{\Abrev}[1]{\expandafter\Capitalize\abrev{#1}} + +%comando para desenvolvedores, só inglês sem finalização, ou seja sem ponto +\newcommand{\ABNTEXabrev}[1]{\@ifundefined{@TR@#1}{#1}{\csname \@TR@#1\endcsname}} + +%comando para desenvolvedores, só inglês com finalização, ou seja com ponto +\newcommand{\ABNTEXabrevp}[1]{\let\Abrevending\abrevending +\ABNTEXabrev{#1}\Abrevending} diff --git a/macros/latex/contrib/abntex2/tex/abntex2cite.sty b/macros/latex/contrib/abntex2/tex/abntex2cite.sty new file mode 100644 index 0000000000..931d312083 --- /dev/null +++ b/macros/latex/contrib/abntex2/tex/abntex2cite.sty @@ -0,0 +1,1349 @@ +%% abntex2cite.sty, v-1.9.7 laurocesar +%% Copyright 2012-2018 by abnTeX2 group at https://www.abntex.net.br/ +%% +%% 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 +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the abnTeX2 team, led +%% by Lauro César Araujo. Further information are available on +%% https://www.abntex.net.br/ +%% +%% Creator and original mantainer: Gerald Weber <gweber@codigolivre.org.br> +%% Copyright 2001-2002 by the abnTeX group at http://abntex.codigolivre.org.br + +% How this package is organized: +% ------------------------------ +% - Implementing `search for substring' +% - \AfterTheBibliography{} hook +% - Options declaration (search for substring needed here) +% alf, num (default) +% alfantigo, experimental (default) +% biblabel-on-margin +% sem-bibtex (apply settings without count with code in .bbl) +% no-abnt-option-file (in case one defines its own options file) +% recuo (then makes bibitem indent 1.8em) (default: NO indentation) +% recuo=<length> (sets custom indentation) +% indent is an alias for recuo (indent or indent=<length>) +% versalete author in alf mode as with smallcaps +% other options are considered "\citeoption's" (mechanism includes a +% list that stores non defined options, and in \AtBeginDocument, +% \citeoption acts over this list) +% - allocing auxiliar variables +% - \citeoption +% Similar to \nocite, but does not complain about obviously not defined +% citations. Intented to access options of abnTeX's bibtex styles. +% - \bibliography +% extra care to auto include abnt-options as bibliography database (if +% needed) +% - \bibliographystyle +% if none is given, the style correspondent to the package style in +% use (alf or num) is given. +% - Style customization +% \authorcapstyle, \authorstyle, \yearstyle, \optionaltextstyle +% (detail: \authorcapstyle's default setting uses \smaller from relsize +% package, but only if package is present.) +% - \bibitem +% defines action of \bibitem by its subcommands. Comatibility with old +% abnt-alf is present. +% - \hiddenbibitem +% creates an empty bibliography entry buts creates all labels. +% - \abntrefinfo +% From the creation of abntcite, options are present as a separated +% command. This enables compatibility with any bibtex style. +% +% - \cite +% This command depends on if the style is alf or num +% If alf, then \cite produces (<explicit (capital)>, <year>) +% If num, then \cite produces a superscript with [<implicit (lowercase)>] +% - \citeonline +% This command depends on if the style is alf or num +% If alf, \citeonline produces <implicit (lowercase)>, (<year>) +% If num, \citeonline then produces <implicit (lowercase)> +% - \citeyear +% Produces <year> +% - \citeauthor +% Produces <explicit (capital) author> +% - \citeauthoronline +% Produces <implicit (lowercase) author> +% - \apud[comments]{First}{Second} +% Produces a double citation: (FIRST, YEAR apud SECOND, YEAR<, comments>) +% - \apudonline[comments]{First]{Second] +% Produces a double citation: First (apud SECOND, YEAR<, comments>) +% - \Idem[comments]{Author} +% Produces: Id., YEAR<, comments> +% - \Ibidem[comments]{Author} +% Produces: Ibid.<, comments> +% - \opcit[comments]{Author} +% Produces: AUTHOR, op. cit.<, comments> +% - \cfcite[comments]{Author} +% Produces: Cf. AUTHOR, YEAR<, comments> +% +% - implementing `recuo' (bibindent style) +% - Macros for output sorted and compressed numerical citations +% [9,2,3,1,4,11,7,10] becames [1--4,7,9--11] + +\NeedsTeXFormat{LaTeX2e} +%\input{cvs-id.def} +%\CVSExtract$Id: abntcite.sty,v 1.26 2003/10/13 09:40:41 gweber Exp $ +%\CVSPackage{abntcite}{\space Chamadas de referencias no texto (NBR10520)} %substitui \ProvidesPackage (replaces \ProvidesPackage) +\ProvidesPackage{abntex2cite}[2018/11/24 v-1.9.7 abnTeX2] +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{abntex2abrev} +\RequirePackage{setspace} +\RequirePackage{url} %***** + +%%%%%% Options Declaration %%%%%% + + +%---------------------------------------------------------------- +% Extracted from substr.sty (2000-06-15) +%---------------------------------------------------------------- +% Copyright 2000 Harald Harders <h.harders@tu-bs.de> +% Look at www.ctan.org for original package +% +% Commands: +% +% \IfSubStringInString{substring}{string}{true part}{false part} +% This command searches <substring> in <string> and executes the +% <true part> if it is and else the <else part> + +% expands the first and second argument with +% \protected@edef and calls #3 with them: +\ifx \su@ExpandTwoArgs\undefined + \newcommand{\su@ExpandTwoArgs}[3]{% + \protected@edef\su@SubString{#1}% + \protected@edef\su@String{#2}% + \expandafter\expandafter\expandafter#3% + \expandafter\expandafter\expandafter{% + \expandafter\su@SubString\expandafter + }\expandafter{\su@String}% + } +\fi +%% +%% tests if #1 in #2. If yes execute #3, else #4 +\ifx \IfSubStringInString\undefined + \newcommand*{\IfSubStringInString}[2]{% + \su@ExpandTwoArgs{#1}{#2}\su@IfSubStringInString + } +\fi +%% +\ifx \su@IfSubStringInString\undefined + \newcommand*{\su@IfSubStringInString}[2]{% + \def\su@compare##1#1##2\@nil{% + \def\su@param{##2}% + \ifx\su@param\@empty + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + }% + \su@compare#2#1\@nil + } +\fi + +%---------------------------------------------------------------- + + +% alf, num: main options +\newboolean{ABCItextondemand} + +\DeclareOption{alf}{\def\AbntCitetype{alf}\setboolean{ABCItextondemand}{true}} +\DeclareOption{num}{\def\AbntCitetype{num}} +\ExecuteOptions{num} + +% references on page foot +\newboolean{ABCIfoot} +\DeclareOption{foot}{\setboolean{ABCIfoot}{true}% + \setboolean{ABCItextondemand}{false}} +\DeclareOption{not-foot}{\setboolean{ABCIfoot}{false}% + \setboolean{ABCItextondemand}{true}} +\ExecuteOptions{not-foot} + +% cite text on demand (defaults depends on foot or not-foot) +% (also recall that options are executed in order of definition at +% \ProcessOptions) +\DeclareOption{load-text-on-demand}{\setboolean{ABCItextondemand}{true}} +\DeclareOption{load-text}{\setboolean{ABCItextondemand}{false}} + +% compatibility with old abnt-alf.bst +\newboolean{ABCIcompoldalf} +\DeclareOption{alfantigo}{\setboolean{ABCIcompoldalf}{true}} +\DeclareOption{experimental}{\setboolean{ABCIcompoldalf}{false}} +\ExecuteOptions{experimental} + +% biblabel-on-margin +\newboolean{ABCIbibjustif} +\DeclareOption{bibjustif}{\setboolean{ABCIbibjustif}{true}} +\DeclareOption{bibleftalign}{\setboolean{ABCIbibjustif}{false}} +\ExecuteOptions{bibleftalign} + +% biblabel-on-margin +\newboolean{ABCIbiblabelonmargin} +\DeclareOption{biblabel-on-margin} + {\setboolean{ABCIbiblabelonmargin}{true}} +\DeclareOption{biblabel-not-on-margin} + {\setboolean{ABCIbiblabelonmargin}{false}} +\ExecuteOptions{biblabel-not-on-margin} + +% \bibliography includes abnt-options automatically unless next option is used +\newboolean{ABCIauto-abntoptions} +\DeclareOption{abnt-option-file}{\setboolean{ABCIauto-abntoptions}{true}} +\DeclareOption{no-abnt-option-file}{\setboolean{ABCIauto-abntoptions}{false}} +\ExecuteOptions{abnt-option-file} + +% recuo : compatibility with old norms +\ifx \bibindent\undefined + \newlength{\bibindent} +\fi +\setlength{\bibindent}{0em} +\DeclareOption{recuo}{\setlength{\bibindent}{1.8em}} + +% indent : an alias to recuo +\DeclareOption{indent}{\setlength{\bibindent}{1.8em}} + +\newcommand{\citebrackets}[2]{\def\citeopen{#1}\def\citeclose{#2}} +\newcommand{\setcitebrackets}{\citebrackets()} +% 10520:2002 now defines only two numerical styles +\newboolean{ABNTovercite} +\DeclareOption{overcite}{\setboolean{ABNTovercite}{true}} +\DeclareOption{inlinecite}{\setboolean{ABNTovercite}{false}} + +% \authorcapstyle em versalete (smallcaps) como opcional +\newboolean{ABNTversalete} +\setboolean{ABNTversalete}{false} +\DeclareOption{versalete}{\setboolean{ABNTversalete}{true}} + +% 10520:2002 does not allow (XX) or [XX] for superscript cites +\newboolean{ABNTstrictnumformat} + +% Incorpora o arquivo nbr10520-2002.def do abntex1 +% A norma NBR 10520:2002 removeu as opções [] e () para citações +% em superscrito +\ifx\AbntCitetype\AbntCitetypeALF +\else +\renewcommand{\setcitebrackets}{ +\ifthenelse{\boolean{ABNTovercite}}{\citebrackets{}{}}{\citebrackets()}} +\fi + +% +% Allocing variables +% + +% used for \@biblabel in num +\newlength{\minimumbiblabelwidth} +\newlength{\ABCIauxlen} + +% auxiliar counters used in `sort and group' mechanism +\newcounter{ABCIaux} +\newcounter{ABCImax} + +% Here I define a LaTeX list that will contain all options not defined +% before. +% +% A LaTeX list is a command containing a comma separated list of +% itens. The list is processed by command \@for, as in \citeoption. +\def\citeoptionlist{} +% This command adds a string to the list. +\newcommand{\addtociteoptionlist}[1]{ + \ifthenelse{\equal{\citeoptionlist}{}} + {\edef\citeoptionlist{#1}} + {\edef\citeoptionlist{\citeoptionlist,#1}} +} + + +% suporting options in a keyval style +% recuo=<length> gives indentation of \bibitem +% other options: passed thought \citeoption (stored now in \citeoptionlist +% and after (in \AtBeginDocument hook) \citeoption will act on it) + +% To grab 6 letters. (recuo=) +\newcommand{\grabsix}[6]{} + +% To grab 7 letters. (indent=) +\newcommand{\grabseven}[7]{} + +\DeclareOption{abnt-substyle=COPPE} + {\newcommand{\bibtextitlecommand}[2]{``#2''}% + \addtociteoptionlist{abnt-substyle=COPPE}} + +\DeclareOption*{ + \IfSubStringInString{recuo=}{\CurrentOption} + {\setlength{\bibindent}{\expandafter\grabsix\CurrentOption}} + {\IfSubStringInString{indent=}{\CurrentOption} + {\setlength{\bibindent}{\expandafter\grabseven\CurrentOption}} + {\addtociteoptionlist{\CurrentOption}}} +} + +\provideboolean{ABNThyperref} + +\@ifpackageloaded{hyperref}{% +%\addtociteoptionlist{abnt-url-package=hyperref} +\setboolean{ABNThyperref}{true} +}{\setboolean{ABNThyperref}{false}} + +\@ifpackageloaded{url}{% +\addtociteoptionlist{abnt-url-package=url} +\def\UrlLeft{<} +\def\UrlRight{>} +\urlstyle{same}} + +\provideboolean{ABNTbackref} %By AWSS + +\@ifpackageloaded{backref}{% %By AWSS +\setboolean{ABNTbackref}{true} %By AWSS +}{\setboolean{ABNTbackref}{false}} %By AWSS + +\ProcessOptions + +% Check if not running pdf/xe/lua/htlatex, then load breakurl +% From http://tex.stackexchange.com/a/53943 +\RequirePackage{ifpdf,ifxetex} +\edef\texforht{TT\noexpand\fi + \@ifpackageloaded{tex4ht} + {\noexpand\iftrue} + {\noexpand\iffalse}} +\ifpdf +\else + \ifxetex + \else + \if\texforht + \else + \@ifpackageloaded{hyperref} + {\RequirePackage{breakurl}}{} + \fi% texforht + \fi% xetex +\fi% pdftex + +% really foot? +\ifthenelse{\boolean{ABCIfoot}\and\equal{\AbntCitetype}{num}} + {\setboolean{ABCIfoot}{true}} + {\setboolean{ABCIfoot}{false}} + +% Now, after all options are processed, \citeoption process the list of +% options given as package options. +% +\ifthenelse{\equal{\citeoptionlist}{}} + {} + {\AtBeginDocument{\citeoption{\citeoptionlist}}} + + +% \citeoption - equal to \nocite (I copied source from \nocite) +% but not complains about this option be obviously undefined +\newboolean{ABCIciteoptionwasused} +\setboolean{ABCIciteoptionwasused}{false} +\def\citeoption#1{\@bsphack + \@for\@citekey:=#1\do{% + % next line eliminates white space before citation name + \edef\@citekey{\expandafter\@firstofone\@citekey}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi + }% + \@esphack% + \setboolean{ABCIciteoptionwasused}{true}% +} + + +% +% \bibliography{list of files .bib to be processed by bibTeX} +% +% I had to redefine this command such that abnt-options.bib is +% automatically used in case that some \citeoption was given as package +% option. An entry +% \bibliography{abnt-options,abnt-options,..} +% produces an error in bibTeX. So I had to check if user already +% includes abnt-options by (him/her)self. +% +% implementation: +% +% \citeoption was used? +% If YES, (abnt-options must be given to bibtex!) +% checks for abnt-options into parameter given to \bibliography +% if present +% user have included, so I don't add it once more +% not present +% I add necessary abnt-options +% If NO +% no changes to \bibliography + +\def\bibliography#1{% **** + { + \ifx \SingleSpacing\undefined + \singlespacing + \else + \SingleSpacing + \fi + % + \ifthenelse{\boolean{ABCIciteoptionwasused} + \and\boolean{ABCIauto-abntoptions}} + { + % this system of checking is not good... + \IfSubStringInString{abntex2-options}{#1} + {\if@filesw\immediate\write\@auxout{\string\bibdata{#1}}\fi} + {\if@filesw\immediate\write\@auxout{\string\bibdata{abntex2-options,#1}}\fi} + } + { + \if@filesw + \immediate\write\@auxout{\string\bibdata{#1}}% + \fi + } + \@input@{\jobname.bbl} + } + } + + +% +% The next piece of code looks if bibtexstyle is used or not, and if not, +% includes the respective style from the abntcite mode (alf or num) + +\newboolean{ABCIbibtexstyleused} +\setboolean{ABCIbibtexstyleused}{false} + +% +\def\bibliographystyle#1{% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\@auxout{\string\bibstyle{#1}}% + \fi} + \setboolean{ABCIbibtexstyleused}{true} + } + +% \AtEndDocument is the last chace for include bibliography style.. +\AtEndDocument{ + \ifthenelse{\not\boolean{ABCIbibtexstyleused}} + {\bibliographystyle{abntex2-\AbntCitetype}} + {} +} + + +% relsize used in \authorcapstyle. If package not present, \smaller=\relax +\IfFileExists{relsize.sty} + {\RequirePackage{relsize}} + {\let\smaller\relax} + +%%%%%%%%%%%%%% Style %%%%%%%%%%%%%%%%% + + + +\newcommand{\authorcapstyle}{\ifthenelse{\boolean{ABNTversalete}}{\smaller}{}} +\newcommand{\authorstyle}{\relax} +\newcommand{\yearstyle}{\relax} +\newcommand{\optionaltextstyle}{\relax} +\newcommand{\citenumstyle}{\relax} + +\newlength{\biblabelsep} +\setlength{\biblabelsep}{1ex} + +%%%%%%%%%%%%%%%%%%%%% Implementation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% automatic care for commas inside references +\providecommand{\ABCIccomma}{} +\newcommand{\ABCIcitecommadefault}{,\penalty\@m\ } +\newcommand{\ABCIcitecomma}{\ABCIccomma\let\ABCIccomma\ABCIcitecommadefault} +\newcommand{\ABCIinitcitecomma}{\def\ABCIccomma{}} +\newcommand{\ABCIcitecolondefault}{; }%{;\penalty\@m\ } + + +% How \bibitem works? +% definition of \bibitem +% \def\bibitem{\@ifnextchar\@lbibitem\@bibitem} + +\ifthenelse{\boolean{ABCIcompoldalf}\and\equal{\AbntCitetype}{alf}} +{ + +% In the old mplementation on abnt-alf, the command \bibitem should be +% \bibitem[{explicit}{implicit}{year}]{key} + + % if \bibitem has optional parameter, uses it (three pieces of data + % stored into .aux file) + + \def\@lbibitem[#1#2#3]#4{ + \gdef\abntnextkey{#4} + \item[\@biblabel{#1}\hfill]% + \if@filesw + { + \let\protect\noexpand + \immediate\write\@auxout{\string\bibcite{#4++EXPL}{#1}} + \immediate\write\@auxout{\string\bibcite{#4++IMPL}{#2}} + \immediate\write\@auxout{\string\bibcite{#4++YEAR}{#3}} + } + \fi% + \ignorespaces + } + + % if no optional is used, uses a list counter (stores its value into .aux) + \def\@bibitem#1{ + \gdef\abntnextkey{#1} + \item% + \if@filesw + {\immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}} + \fi% + \ignorespaces + } + +} +{ %if normal mode (non-compatible with old alf) + + \ifthenelse{\boolean{ABCIfoot}} + { + % foot-num mode + + \def\@lbibitem[#1]#2{\gdef\abntnextkey{#2}} + + \def\@bibitem#1{\gdef\abntnextkey{#1}} + + } + { + \def\@lbibitem[#1]#2{ + \gdef\abntnextkey{#2} + \item[\@biblabel{#1}\hfill]% + \ifthenelse{\boolean{ABNThyperref}}{% + \hyper@anchorstart{cite.#2}\relax\hyper@anchorend}{}% + \if@filesw + { + \let\protect\noexpand + \immediate\write\@auxout{\string\bibcite{#2}{#1}} + } + \fi% + \ignorespaces + } + + \def\@bibitem#1{ + \gdef\abntnextkey{#1} + % \ifthenelse{}{\item}{\item} + \item% + \ifthenelse{\boolean{ABNThyperref}}{% + \hyper@anchorstart{cite.#1}\relax\hyper@anchorend}{}% + \if@filesw + {\immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}} + \fi% + \ignorespaces + } + } +} + +\newcommand{\hiddenbibitem}[2][]{\gdef\abntnextkey{#2}} + +\newcommand{\ABCIgetcitetext}[1]{ + \if@filesw + {\let\protect\noexpand + \immediate\write\@auxout{\string\bibcite{\abntnextkey++TEXT}{#1}}}% + \fi} + +\newcommand{\ABCIgetcitetextecho}[1]{\ABCIgetcitetext{#1}#1} + +%we are repeating \bibcite command as defined in hyperref.sty +%so that we have it all together at one place. +\ifthenelse{\boolean{ABNThyperref}}{% +%\renewcommand{\bibcite}[2]{% +% \@newl@bel{b}{#1}{\hyper@@link[cite]{}{cite.#1}{#2}}}% +\newcommand{\bibciteEXPL}[2]{% + \@newl@bel{b}{#1++EXPL}{\hyper@@link[cite]{}{cite.#1}{#2}}}% +\newcommand{\bibciteIMPL}[2]{% + \@newl@bel{b}{#1++IMPL}{\hyper@@link[cite]{}{cite.#1}{#2}}}% +\newcommand{\bibciteYEAR}[2]{% + \@newl@bel{b}{#1++YEAR}{\hyper@@link[cite]{}{cite.#1}{#2}}}% +}{} + +\newcommand{\abntrefinfo}[3]{% + \if@filesw + {% + \let\protect\noexpand + \ifthenelse{\boolean{ABNThyperref}}{% + \immediate\write\@auxout{\string\bibciteEXPL{\abntnextkey}{#1}}% + \immediate\write\@auxout{\string\bibciteIMPL{\abntnextkey}{#2}}% + \immediate\write\@auxout{\string\bibciteYEAR{\abntnextkey}{#3}}}{% + \immediate\write\@auxout{\string\bibcite{\abntnextkey++EXPL}{#1}}% + \immediate\write\@auxout{\string\bibcite{\abntnextkey++IMPL}{#2}}% + \immediate\write\@auxout{\string\bibcite{\abntnextkey++YEAR}{#3}}}% + }% + \fi + \ifthenelse{\boolean{ABCIfoot}} + {\ifthenelse{\boolean{ABCItextondemand}} + {\@ifundefined{ABCIdemand@\abntnextkey} + {\let\ABCIprocesscitetext\@gobble} + {\let\ABCIprocesscitetext\ABCIgetcitetext}} + {\let\ABCIprocesscitetext\ABCIgetcitetext}} + {\ifthenelse{\boolean{ABCItextondemand}} + {\@ifundefined{ABCIdemand@\abntnextkey} + {\let\ABCIprocesscitetext\relax} + {\let\ABCIprocesscitetext\ABCIgetcitetextecho}} + {\let\ABCIprocesscitetext\ABCIgetcitetextecho}}% + \ABCIprocesscitetext +} + + +\newcommand{\ABCIdemand}[1]{\expandafter\gdef\csname ABCIdemand@#1\endcsname{}} + + +\def\AbntCitetypeALF{alf} + +\let\ABCInewblock\newblock +\DeclareRobustCommand{\newblock}{\ABCInewblock} + + +%%%%%%%%%%%%%%%%%%%% abnt-alf %%%%%%%%%%%%%%%%%%%%%%% + +% the next line was before \ifthenelse{\equal{\AbntCitetype}{alf}} + +\setcitebrackets + +\ifx\AbntCitetype\AbntCitetypeALF % if alf + + \renewcommand{\@biblabel}[1]{} + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % \cite[optional]{list of keys} + % + % Implicit citation - author in capital letters and year; + % mechanism to deal with repeated names; + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \renewcommand{\@cite}[2]% + {\citeopen{#1\ifthenelse{\equal{#2}{}}{}{, + {\optionaltextstyle#2}}}\citeclose} + + \DeclareRobustCommand{\cite}[2][]{% + % + \leavevmode + \let\@citeprevious\@empty% + \@cite{% + \@for\@citekey:=#2\do% \@citekey contains the key + {% + \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + % + % here, a tricky \let\@citename\"b@\@citekey++IMPL" + \expandafter\let\expandafter\@citename% + \csname b@\@citekey++IMPL\endcsname% + \expandafter\let\expandafter\@citeyear% + \csname b@\@citekey++YEAR\endcsname% + \ifx\@citeprevious\@empty% + \else% + \ifx\@citename\@citeprevious% + \ABCIcitecommadefault% echoing ", " + \else% + \ABCIcitecolondefault% echoing "; " + \fi% + \fi% + % writing on aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + % if undefined bibitem + \@ifundefined{b@\@citekey++IMPL}% + {% if undefined + {\bfseries??}% echoing ? + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if already defined + \ifx\@citename\@citeprevious% + {\yearstyle\@citeyear\@}\@% + \else% + {\authorcapstyle\@citename}, % + {\yearstyle\@citeyear\@}% + \fi% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#2}}{}% By AWSS: put backref + }% end for + }{#1}% + } + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % \citeonline[optional]{list of keys} + % + % Inline (explicit) citation - author in "inline style" and year; + % mechanism to deal with repeated names; + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \newcommand{\@citeonline}[2]% + {{#1\ifthenelse{\equal{#2}{}}{}{, {\optionaltextstyle#2}}}\citeclose} + + \DeclareRobustCommand{\citeonline}[2][]{% + % + \leavevmode + \let\@citeprevious\@empty% + \@citeonline{% + \@for\@citekey:=#2\do%\@citekey contains the key + {% + \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + % + % here, a tricky \let\@citename\"b@\@citekey++UP" :-) + \expandafter\let\expandafter\@citename% + \csname b@\@citekey++EXPL\endcsname% + \expandafter\let\expandafter\@citeyear% + \csname b@\@citekey++YEAR\endcsname% + \ifx\@citeprevious\@empty% + \else% + \ifx\@citename\@citeprevious% + \ABCIcitecommadefault% echoing ", " + \else% + \citeclose, % echoing "), " + \fi% + \fi% + % writing in aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + \@ifundefined{b@\@citekey++EXPL}% + {% if undefined + {\bfseries??}% echoing ? + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if really defined + \ifx\@citename\@citeprevious% + \else% + {\authorstyle\@citename\@{}} \citeopen% + \fi% + {\yearstyle\@citeyear\@}% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#2}}{}% By AWSS: put backref + }% end for + }{#1}% + } + + % "overcite" compatibility + \let\citen\citeonline + \let\citenum\citeonline + +% end alf +% +% +%%%%%%%%%%%%%%%%%%%%%%%%% abnt-num %%%%%%%%%%%%%%%%%%%%%%%%%% +% +% + +\else % if not alf, + + \ifABCIfoot + + \renewenvironment{thebibliography}[1]{}{} + + \citebrackets{}{} + + \let\ABCIscriptfont\scriptsize + \renewcommand{\newblock}{} + + \def\ABCI@cite#1#2{\raisebox{.8ex}% + {\ABCIscriptfont\citeopen{#1\if@tempswa, #2\fi}\citeclose}} + + \def\ABCI@citeonline#1#2{{#1\if@tempswa, #2\fi}} + + \DeclareRobustCommand\cite{% + \let\@cite\ABCI@cite% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + + \DeclareRobustCommand\citeonline{% + \leavevmode\let\@cite\ABCI@citeonline% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + + \def\@citex[#1]#2{% + \def\@safe@activesfalse{}% + \ABCIinitcitecomma% + \def\ABCIcitelist{}% + \def\ABCIaftercitex{}% to put the footnotes + \@cite{% + \@for\@citeb:=#2\do% + {% + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi% + \@ifundefined{b@\@citeb++IMPL}% + {% + {\bfseries??}% + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citeb' on page \thepage \space undefined}% + }% + {% + \@ifundefined{b@\@citeb} + {% + \stepcounter{footnote}% + \expandafter\xdef\csname b@\@citeb\endcsname{\thefootnote}% + \ABCItoken=\expandafter{\ABCIaftercitex}% + \xdef\ABCIaftercitex% + {\the\ABCItoken\noexpand\footnotetext% + {\noexpand\citetext{\@citeb}}}% + } + {}% + \expandafter\let\expandafter\ABCIcitation% + \csname b@\@citeb\endcsname% + % test for positive number + \ifcat _\ifnum\z@<0\ABCIcitation _\else A\fi + \ABCIaddtocitelist{\ABCIcitation}% + \else% else \ifcat + \ABCIcitecomma\hbox{\ABCIcitation}% + \fi% end \ifcat + }% + }% + \ABCIoutputgroupedcitelist% + }{#1}% + \ABCIaftercitex% + } + + \newcommand{\citeifnotcited}[1]{% + \def\ABCIcitelist{}% + \@for\@citeb:=#1\do% + {% + \@ifundefined{b@\@citeb} + {\ABCIaddtocitelist{\@citeb}} + {}% + }% + \expandafter\cite\expandafter{\ABCIcitelist}% + } + + \newcommand{\citeonlineifnotcited}[1]{% + \def\ABCIcitelist{}% + \@for\@citeb:=#1\do% + {% + \@ifundefined{b@\@citeb} + {\ABCIaddtocitelist{\@citeb}} + {}% + }% + \expandafter\citeonline\expandafter{\ABCIcitelist}% + } + + \newcommand{\ABCIaddtocitelist}[1]{% + \ifthenelse{\equal{\ABCIcitelist}{}}% + {\edef\ABCIcitelist{#1}} + {\edef\ABCIcitelist{\ABCIcitelist,#1}}% + }% + + \newcommand{\ifcited}[3]{\@ifundefined{b@#1}{#3}{#2}} + + \else % if num and NOT foot + + % this only works with proper settings in \ABCIthebibliformat + \ifthenelse{\boolean{ABCIbiblabelonmargin}} + { + \renewcommand{\@biblabel}[1]% + {\ifthenelse{\equal{#1}{}}{}{{\citenumstyle #1\hspace{\biblabelsep}}}} + } + { + \renewcommand{\@biblabel}[1]% + {% + \ifthenelse{\equal{#1}{}} + {} + {% + \def\biblabeltext{{\citenumstyle #1\hspace{\biblabelsep}}}% + \settowidth{\ABCIauxlen}{\biblabeltext}% + \ifthenelse{\lengthtest{\ABCIauxlen<\minimumbiblabelwidth}} + {\setlength{\ABCIauxlen}{\minimumbiblabelwidth-\ABCIauxlen}} + {\setlength{\ABCIauxlen}{0cm}}% + {\biblabeltext\hspace{\ABCIauxlen}}% + }% + }% + } + + \let\ABCIscriptfont\scriptsize + + \ifthenelse{\boolean{ABNTovercite}}{% + \def\ABCI@cite#1#2{\raisebox{1ex}% + {\ABCIscriptfont\citeopen{#1\if@tempswa, #2\fi}\citeclose}}}{% + \def\ABCI@cite#1#2{\citeopen{#1\if@tempswa, #2\fi}\citeclose}} + + \def\ABCI@citeonline#1#2{{#1\if@tempswa, #2\fi}} + + \DeclareRobustCommand\cite{% + \let\@cite\ABCI@cite% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + + \DeclareRobustCommand\citeonline{% + \leavevmode\let\@cite\ABCI@citeonline% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + +% \renewcommand{\@openbib@code}% +% {\setlength{\leftmargin}{0pt}\addtolength{\itemindent}{\labelsep}} + + + \def\@citex[#1]#2{% + \def\@safe@activesfalse{}% + \ABCIinitcitecomma% + \def\ABCIcitelist{}% + \@cite{% + \@for\@citeb:=#2\do% + {% + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi% + \@ifundefined{b@\@citeb}% + {% + {\bfseries??}% + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citeb' on page \thepage \space undefined}% + }% + {% + \expandafter\let\expandafter\ABCIcitation% + \csname b@\@citeb\endcsname% + % test for positive number + \ifcat _\ifnum\z@<0\ABCIcitation _\else A\fi + \ABCIaddtocitelist{\ABCIcitation}% + \else% else \ifcat + \ABCIcitecomma\hbox{\ABCIcitation}% + \fi% end \ifcat + }% + }% + \ABCIoutputgroupedcitelist% + }{#1}% + } + + \newcommand{\ABCIaddtocitelist}[1]{% + \ifthenelse{\equal{\ABCIcitelist}{}}% + {\edef\ABCIcitelist{#1}} + {\edef\ABCIcitelist{\ABCIcitelist,#1}}% + }% + + + \fi +\fi % end if alf + +\providecommand{\citeifnotcited}[1]{} +\providecommand{\citeonlineifnotcited}[1]{} +\providecommand{\ifcited}[3]{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \citeyear{list of keys} +% +% Citation by year +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DeclareRobustCommand{\citeyear}[1]{% +% +% \let\@safe@activesfalse\@empty% + \leavevmode + \let\@citeprevious\@empty% + \@for\@citekey:=#1\do %\@citekey contains the key + {% +% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + \expandafter\let\expandafter\@citename% + \csname b@\@citekey++YEAR\endcsname% + %compare previous name with current name and decide the punctuation marks + %if first use do nothing + \ifx\@citeprevious\@empty% + \else% + , % echoing ", + \fi% + % writing on aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + % if undefined bibitem + \@ifundefined{b@\@citekey++YEAR}% + {% if undefined + {\bfseries??}% echoing ? + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if already defined + \ifx\@citename\@citeprevious% + \else% + {\@citename\@}% + \fi% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#1}}{}% By AWSS: put backref + }% end for +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \citeauthor{list of keys} +% +% Implicit citation (capital letters) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +\DeclareRobustCommand{\citeauthor}[1]{% +% +% \let\@safe@activesfalse\@empty% + \leavevmode + \let\@citeprevious\@empty% + \@for\@citekey:=#1\do %\@citekey contains the key + {% +% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + \expandafter\let\expandafter\@citename\csname b@\@citekey++IMPL\endcsname% + % writing on aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + % if undefined bibitem + \@ifundefined{b@\@citekey++IMPL}% + {% if undefined + {\bfseries??}% + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if already defined + \ifx\@citename\@citeprevious% + \else% + \ifx\@citeprevious\@empty% + \else% + ; % echoing "; " + \fi% + {\authorcapstyle\@citename\@}% + \fi% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#1}}{}% By AWSS: put backref + }% end for +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \citeauthoronline{list of keys} +% +% Explicit citation (non capital letter) +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\DeclareRobustCommand{\citeauthoronline}[1]{% +% +% \let\@safe@activesfalse\@empty% + \leavevmode + \let\@citeprevious\@empty% + \@for\@citekey:=#1\do %\@citekey contains the key + {% +% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + \expandafter\let\expandafter\@citename\csname b@\@citekey++EXPL\endcsname% + % writing on aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + % if undefined bibitem + \@ifundefined{b@\@citekey++EXPL}% + {% if undefined + {\bfseries??}% + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if already defined + \ifx\@citename\@citeprevious% + \else% + \ifx\@citeprevious\@empty% + \else% + ; % echoing "; " + \fi% + {\authorstyle\@citename\@}% + \fi% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#1}}{}% By AWSS: put backref + }% end for +} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \citetext{list of keys} +% +% Text of the reference +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\DeclareRobustCommand{\citetext}[1]{% +% +% \let\@safe@activesfalse\@empty% + \leavevmode + \let\@citeprevious\@empty% + \@for\@citekey:=#1\do %\@citekey contains the key + {% +% \edef\@citekey{\expandafter\@firstofone\@citekey\@empty}% + \expandafter\let\expandafter\@citename\csname b@\@citekey++TEXT\endcsname% + % writing on aux file + \if@filesw\immediate\write\@auxout{\string\citation{\@citekey}}\fi% + \if@filesw\immediate\write\@auxout{\string\ABCIdemand{\@citekey}}\fi% + % if undefined bibitem + \@ifundefined{b@\@citekey++TEXT}% + {% if undefined + {\bfseries??}% + \G@refundefinedtrue% + \@latex@warning% + {Citation `\@citekey' on page \thepage \space undefined}% + }% + {% if already defined + \ifx\@citename\@citeprevious% + \else% + \relax + \ifx\@citeprevious\@empty% + \else% + ; % echoing "; " + \fi% + {\@citename}% + \fi% + \let\@citeprevious\@citename% + }% + \ifthenelse{\boolean{ABNTbackref}}{\Hy@backout{#1}}{}% By AWSS: put backref + }% end for +} + + +% +% Setting up `recuo' (=indent in Portuguese) +% + +% To ensure that the margin settings of this package works, \leftmargin +% (inside thebibliography) must be 0cm. \@openbib@code is a hook inside +% thebibliography. +\let\@openbib@codeBACKUP\@openbib@code +\def\@openbib@code{\@openbib@codeBACKUP\setlength{\leftmargin}{0cm}} + + +% adding things after \begin{thebibliography}{} + +\let\thebibliographyBkUp\thebibliography +\def\thebibliography#1{\thebibliographyBkUp{#1}\ABCIthebibliformat} + +% +% \AfterTheBibliography{} hook +% + +\newtoks\ABCItoken + +\newcommand{\ABCIthebiblihook}{} + +\newcommand{\AfterTheBibliography}[1]{ + \ABCItoken=\expandafter{\ABCIthebiblihook} + \expandafter\def\expandafter\ABCIthebiblihook\expandafter{\the\ABCItoken#1} +} + + +\ifthenelse{\boolean{ABCIbibjustif}} + {} + {\AfterTheBibliography{\setlength{\rightskip}{0pt plus 2cm}}} + +\ifthenelse{\equal{\AbntCitetype}{alf}} + {% mode alf + \newcommand{\ABCIthebibliformat}{ + \setlength{\leftskip}{\bibindent} + \setlength{\labelwidth}{0cm} + \setlength{\labelsep}{0cm} + \setlength{\itemindent}{-\bibindent} + \setlength{\listparindent}{0cm} + \ABCIthebiblihook + } + } + {% mode num + \ifthenelse{\boolean{ABCIbiblabelonmargin}} + { + \newcommand{\ABCIthebibliformat}{ + \setlength{\leftskip}{\bibindent} + \setlength{\labelwidth}{10cm} + \setlength{\labelsep}{0cm} + \setlength{\itemindent}{-\bibindent} + \setlength{\listparindent}{0cm} + \setlength{\biblabelsep}{1.5ex} + \ABCIthebiblihook + } + } + { + \newcommand{\ABCIthebibliformat}{ + \setlength{\leftskip}{\bibindent} + \setlength{\labelwidth}{0cm} + \setlength{\labelsep}{0cm} + \setlength{\itemindent}{-\bibindent} + \setlength{\listparindent}{0cm} + \setlength{\minimumbiblabelwidth}{\leftskip} + \ABCIthebiblihook + } + \AfterTheBibliography{ + \ifthenelse{\lengthtest{\minimumbiblabelwidth=0pt}} + {\setlength{\biblabelsep}{1.8ex}} + {\setlength{\biblabelsep}{1ex}} + } + } + } + + + + +%---------------------------------------------------------------% +% Macros for output sorted and compressed numerical citations % +%---------------------------------------------------------------% + + +% Store to maximum of a given list to the counter "ABCImax" +\newcommand{\maximuminlist}[1]{% + \setcounter{ABCImax}{0}% + \@for\ABCIaux:=#1\do% + {% + \setcounter{ABCIaux}{\ABCIaux}% + \ifnum \value{ABCIaux}>\value{ABCImax}% + \setcounter{ABCImax}{\value{ABCIaux}}% + \fi% + }% +} + +% It takes a command containing a comma separeted list of +% positive numbers and redefines the original command with +% the list without its maximum element. +\newcommand{\ABCIlistwithoutmaximum}[1]{% + \maximuminlist{#1}% + \let\ABCItemplist#1% + \def#1{}% + \def\ABCIcomma{}% + \@for\ABCIaux:=\ABCItemplist\do% + {% + \ifnum\ABCIaux<\value{ABCImax}% + \edef#1{#1\ABCIcomma\ABCIaux}% + \def\ABCIcomma{,}% + \fi% + }% +} + +% It requires a command containing a comma separeted list of +% positive numbers. It redefines that command with the same +% list, but sorted. +\newcommand{\ABCIsortlist}[1]{% + \edef\ABCItempslist{#1}% + \def#1{}% + \def\ABCIcomma{}% + \whiledo{\not\equal{\ABCItempslist}{}}% + {% + \maximuminlist{\ABCItempslist}% + \edef#1{\arabic{ABCImax}\ABCIcomma#1}% + \def\ABCIcomma{,}% + \ABCIlistwithoutmaximum{\ABCItempslist}% + }% +} + +% \ifconsecutive{num1}{num2}{block1}{block2} +% executes block1 if num1 = num2+1 and block2 otherwise. +\newcommand{\ifconsecutive}[4]{% + \@tempcnta#1% + \@tempcntb#2% + \advance\@tempcntb 1 % + \ifnum\@tempcnta=\@tempcntb#3\else#4\fi% +} + +% +% It sorts and outputs in grouped way the list \ABCIcitelist generated in +% \cite when in `num' mode. +% +\newcommand{\ABCIoutputgroupedcitelist}{% + \ifthenelse{\equal{\ABCIcitelist}{}}% + {}% + {% + \ABCIsortlist{\ABCIcitelist}% + \setcounter{ABCIaux}{0}% + \@for \ABCIaux:=\ABCIcitelist\do% + {% + \ifthenelse{\value{ABCIaux}=0}% + {% + \let\ABCIfirst\ABCIaux% + \let\ABCIlast\ABCIaux% + \setcounter{ABCIaux}{1}% + }% + {% + \ifconsecutive{\ABCIaux}{\ABCIlast}% + {% + \let\ABCIlast\ABCIaux% + \addtocounter{ABCIaux}{1}% + }% + {% + \ifthenelse{\value{ABCIaux}=1}% + {% + \ABCIcitecomma\ABCIfirst% + }% + {% + \ifthenelse{\value{ABCIaux}=2}% + {% + \ABCIcitecomma\ABCIfirst% + \ABCIcitecomma\ABCIlast% + }% + {% + \ABCIcitecomma\ABCIfirst--\ABCIlast% + }% + }% + \let\ABCIfirst\ABCIaux% + \let\ABCIlast\ABCIaux% + \setcounter{ABCIaux}{1}% + }% + }% + }% + \ifthenelse{\value{ABCIaux}=1}% + {% + \ABCIcitecomma\ABCIfirst% + }% + {% + \ifthenelse{\value{ABCIaux}=2}% + {% + \ABCIcitecomma\ABCIfirst% + \ABCIcitecomma\ABCIlast% + }% + {% + \ABCIcitecomma\ABCIfirst--\ABCIlast% + }% + }% + }% +} + +\newcommand{\apudname}{apud} +\newcommand{\Idemname}{Id.} +\newcommand{\Ibidemname}{Ibid.} +\newcommand{\opcitname}{op.\ cit.} +\newcommand{\passimname}{passim} +\newcommand{\loccitname}{loc.\ cit.} +\newcommand{\cfcitename}{Cf.} +\newcommand{\etseqname}{et seq.} + +\DeclareRobustCommand{\footciteref}[1]{% +\footnote{\citetext{#1}} +} + +\newcommand{\apud}[3][]{(\citeauthor{#2}, \citeyear{#2} \apudname\ % +\citeauthor{#3}, \citeyear{#3}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1})} + +\newcommand{\apudonline}[3][]{\citeauthoronline{#2} (\citeyear{#2} \apudname\ % +\citeauthor{#3}, \citeyear{#3}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1})} + +\newcommand{\Idem}[2][]{\Idemname, \citeyear{#2}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}} + +\newcommand{\Ibidem}[2][]{\Ibidemname% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}} + +\newcommand{\opcit}[2][]{\citeauthor{#2}, \opcitname% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}} + +\newcommand{\passim}[2][]{\citeauthor{#2}, \citeyear{#2}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}, \passimname} + +\newcommand{\loccit}[2][]{\citeauthor{#2}, \citeyear{#2}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}, \loccitname} + +\newcommand{\cfcite}[2][]{\cfcitename\ \citeauthor{#2}, \citeyear{#2}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}} + +\newcommand{\etseq}[2][]{\citeauthor{#2}, \citeyear{#2}% +\ifthenelse{\equal{#1}{\empty}}{}{, #1}, \etseqname} + +\ifthenelse{\equal{\AbntCitetype}{num}}% +{\renewcommand{\citeauthor}[1]{\citeauthoronline{#1}\cite{#1}}}{} + + +\endinput + + |