%% Copyright 2016 Daniel B. Marques %% %% 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 Daniel B. Marques. \ProvidesFile{abnt.cbx}% [2016/10/03\space v3.0\space ABNT BibLaTeX citation style]% % Init >>>1 \RequireBiber[3]% \RequireCitationStyle{authoryear}% \RequireCitationStyle{abnt-ibid}% \RequirePackage{xparse}% \renewcommand*{\iffinalcitedelim}{\iflastcitekey} \DeclareLabeldate{% \field{date} \field{year} \field{eventdate} \field{eventyear} \field{origdate} \field{urldate} \literal{nodate} } % <<<1 % Format >>>1 % Name format >>>2 \DeclareNameFormat{LAST}{%% >>>3 \ifcase\value{uniquename}% \usebibmacro{name:family}% {\iftoggle{sccite}% {\textsc{\MakeLowercase{\namepartfamily}}}% {\MakeUppercase{\namepartfamily}}}% {\namepartgiven}% {\namepartprefix}% {\namepartsuffix}% \or% \ifuseprefix% {\usebibmacro{name:given-family}% {\iftoggle{sccite}% {\textsc{\MakeLowercase{\namepartfamily}}}% {\MakeUppercase{\namepartfamily}}}% {\namepartgiveni}% {\namepartprefix}% {\namepartsuffixi}}% {\usebibmacro{name:given-family}% {\iftoggle{sccite}% {\textsc{\MakeLowercase{\namepartfamily}}}% {\MakeUppercase{\namepartfamily}}}% {\namepartgiveni}% {\namepartprefixi}% {\namepartsuffixi}}% \or% \usebibmacro{name:given-family}% {\iftoggle{sccite}% {\textsc{\MakeLowercase{\namepartfamily}}}% {\MakeUppercase{\namepartfamily}}}% {\namepartgiven}% {\namepartprefix}% {\namepartsuffix}% \fi% \usebibmacro{name:andothers}% }% <<<3 \DeclareNameFormat{fullcite}{%% >>>3 \ifcase\value{uniquename}% \usebibmacro{name:given-family}% {\namepartfamily}% {\namepartgiven}% {\namepartprefix}% {\namepartsuffix}% \or% \ifuseprefix% {\usebibmacro{name:given-family}% {\namepartfamily}% {\namepartgiveni}% {\namepartprefix}% {\namepartsuffixi}}% {\usebibmacro{name:given-family}% {\namepartfamily}% {\namepartgiveni}% {\namepartprefixi}% {\namepartsuffixi}}% \or% \usebibmacro{name:given-family}% {\namepartfamily}% {\namepartgiven}% {\namepartprefix}% {\namepartsuffix}% \fi% \usebibmacro{name:andothers}% }% <<<3 % <<<2 % Field format >>>2 \DeclareFieldFormat{emphtitle}{\emph{#1}}% % Get first word >>>3 \newcommand\FirstWord[1]{\@firstword#1 \@nil}% \def\@firstword#1 #2\@nil{\@removecomma#1,\@nil}% \def\@removecomma#1,#2\@nil{\@removeperiod#1.\@nil}% \def\@removeperiod#1.#2\@nil{\@removesemicolon#1;\@nil}% \def\@removesemicolon#1;#2\@nil{#1}% % <<<3 \DeclareFieldFormat{citetitle}{%% >>>3 \iftoggle{sccite}{% \normalfont\textsc{\MakeLowercase{\FirstWord{#1}}}% }{% \normalfont\MakeUppercase{\FirstWord{#1}}% }% }%% <<<3 \DeclareFieldFormat{uppercasecite}{%% >>>3 \iftoggle{sccite}{% \textsc{\smartlowercase{#1}}% }{% \smartuppercase{#1}% }% }% <<<3 % <<<2 % <<<1 % Cite commands >>>1 \DeclareCiteCommand{\cite}[\mkbibparens]% >>>2 {\usebibmacro{cite:init}% \usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {}% {\usebibmacro{postnote}}% \DeclareCiteCommand*{\cite}% {\usebibmacro{cite:init}% \usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {}% {\usebibmacro{postnote}}% \DeclareMultiCiteCommand{\cites}[\mkbibparens]% {\cite}% {\setunit{\multicitedelim}}% <<<2 \DeclareCiteCommand{\textcite}% >>>2 {\usebibmacro{cite:init}% \boolfalse{cbx:parens}% \renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\addspace}% \renewcommand*{\multinamedelim}{\addcomma\addspace}}% {\usebibmacro{citeindex}% \iffirstcitekey% {\setcounter{textcitetotal}{1}}% {\stepcounter{textcitetotal}% \textcitedelim}% \usebibmacro{textcite}}% {\ifbool{cbx:parens}% {\bibcloseparen\global\boolfalse{cbx:parens}}% {}}% {\usebibmacro{textcite:postnote}}% \DeclareCiteCommand*{\textcite}% {\usebibmacro{cite:init}% \boolfalse{cbx:parens}% \renewcommand*{\finalnamedelim}{\addspace\bibstring{and}\addspace}% \renewcommand*{\multinamedelim}{\addcomma\addspace}}% {\usebibmacro{citeindex}% \iffirstcitekey% {\setcounter{textcitetotal}{1}}% {\stepcounter{textcitetotal}% \textcitedelim}% \usebibmacro{textcitefull}}% {\ifbool{cbx:parens}% {\bibcloseparen\global\boolfalse{cbx:parens}}% {}}% {\usebibmacro{textcite:postnote}} \DeclareMultiCiteCommand{\textcites}{\textcite}{}% <<<2 \DeclareCiteCommand{\parencite}[\mkbibparens]% >>>2 {\usebibmacro{cite:init}% \usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {}% {\usebibmacro{postnote}}% <<<2 \DeclareCiteCommand{\citeauthor}[\mkbibparens]% >>>2 {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\ifciteindex% {\indexnames{labelname}}% {}% \printtext[bibhyperref]{\printnames[LAST]{labelname}}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand*{\citeauthor}% {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\ifciteindex% {\indexnames{labelname}}% {}% \printtext[bibhyperref]{\printnames{labelname}}}% {\multicitedelim}% {\usebibmacro{postnote}}% <<<2 \DeclareCiteCommand{\citetitle}[\mkbibparens]% >>>2 {\usebibmacro{cite:init}% \boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\ifciteindex% {\indexfield{indextitle}}% {}% \printtext[bibhyperref]{\printfield[emphtitle]{labeltitle}}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand*{\citetitle}% {\usebibmacro{cite:init}% \boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\ifciteindex% {\indexfield{indextitle}}% {}% \printtext[bibhyperref]{\printfield[emphtitle]{labeltitle}}}% {\multicitedelim}% {\usebibmacro{postnote}}% <<<2 \DeclareCiteCommand{\citeyear}[\mkbibparens]% >>>2 {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\printfield[bibhyperref]{year}}% {\multicitedelim}% {\usebibmacro{postnote}}% \DeclareCiteCommand*{\citeyear}% {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\printfield[bibhyperref]{year}}% {\multicitedelim}% {\usebibmacro{postnote}}% <<<2 % apud >>>2 \DeclareCiteCommand{\@apud}% >>>3 {\usebibmacro{cite:init}% \iffieldundef{prenote}% {}% {\printfield[uppercasecite]{prenote}% \addspace\bibstring{apud}\addspace}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\setunit{\multicitedelim}}% {\usebibmacro{postnote}}% <<<3 \DeclareMultiCiteCommand{\apud}[\addapud\mkbibparens]% >>>3 {\@apud}% {\setunit{\multicitedelim}% }% <<<3 \DeclareCiteCommand{\plaincite}% >>>3 {\usebibmacro{cite:init}% \usebibmacro{prenote}}% {\usebibmacro{citeindex}% \usebibmacro{cite}}% {\multicitedelim}% {\usebibmacro{postnote}}% <<<3 \DeclareCiteCommand{\citelastname}% >>>3 {\usebibmacro{cite:init}% \boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}}% {\ifciteindex% {\indexnames{labelname}}% {}% \printtext[bibhyperref]{\printnames{labelname}}}% {\multicitedelim}% {\usebibmacro{postnote}}% <<<3 \NewDocumentCommand{\textapud}{o o m o o m}{%% >>>3 \citelastname{#3} \mkbibparens{% \IfNoValueTF{#2} {% \IfNoValueTF{#1} {\citeyear*{#3}} {\citeyear*[#1]{#3}}% } {% \citeyear*[#1][#2]{#3}% } \IfNoValueTF{#5} {% \IfNoValueTF{#4} {\plaincite[\blx@imc@bibxstring{apud}][]{#6}} {\plaincite[\blx@imc@bibxstring{apud}][#4]{#6}}% } {% \cite[\blx@imc@bibxstring{apud} #4][#5]{#6}% }% }% }%% <<<3 % <<<2 % <<<1 % Macros >>>1 \renewbibmacro*{cite}{%% >>>2 \iffieldequals{fullhash}{\cbx@lasthash}% {\usebibmacro{cite:plabelyear+extrayear}}% {\iffieldundef{shorthand}{% \ifnameundef{shortauthor}{% \ifnameundef{holder}{% \ifnameundef{labelname}{% \iflistundef{organization}{% \usebibmacro{cite:noname}% }{% \printlist[uppercase]{organization}% }% }{% \printtext[bibhyperref]{\printnames[LAST]{labelname}}% }% }{% \printnames[LAST]{holder}% }% }{% \printnames[LAST]{shortauthor}% }% }{% \usebibmacro{cite:shorthand}% }% \setunit{\nameyeardelim}% \usebibmacro{cite:plabelyear+extrayear}% \savefield{fullhash}{\cbx@lasthash}}% \setunit{\multicitedelim}% }% <<<2 \renewbibmacro*{textcite}{%% >>>2 \ifnameundef{labelname}% {\iffieldundef{shorthand}% {\usebibmacro{cite:label}% \setunit{% \global\booltrue{cbx:parens}% \nonameyeardelim\bibopenparen}% \ifnumequal{\value{citecount}}{1}% {\usebibmacro{prenote}}% {}% \usebibmacro{cite:labelyear+extrayear}}% {\usebibmacro{cite:shorthand}}}% {\printtext[bibhyperref]{\printnames{labelname}}% \setunit{% \global\booltrue{cbx:parens}% \addspace\bibopenparen}% \ifnumequal{\value{citecount}}{1}% {\usebibmacro{prenote}}% {}% \usebibmacro{citeyear}}% }% <<<2 \newbibmacro*{textcitefull}{%% >>>2 \ifnameundef{labelname}% {\iffieldundef{shorthand}% {\usebibmacro{cite:label}% \setunit{% \global\booltrue{cbx:parens}% \nonameyeardelim\bibopenparen}% \ifnumequal{\value{citecount}}{1}% {\usebibmacro{prenote}}% {}% \usebibmacro{cite:labelyear+extrayear}}% {\usebibmacro{cite:shorthand}}}% {\printtext[bibhyperref]{\printnames[fullcite]{labelname}}% \setunit{% \global\booltrue{cbx:parens}% \addspace\bibopenparen}% \ifnumequal{\value{citecount}}{1}% {\usebibmacro{prenote}}% {}% \usebibmacro{citeyear}}% }% <<<2 \newbibmacro*{cite:init}{%% >>>2 \global\undef\cbx@lasthash% }% <<<2 \newbibmacro*{cite:author}{%% >>>2 \printtext[bibhyperref]{\printfield{author}}% }% <<<2 \newbibmacro*{cite:noname}{%% >>>2 \printfield[citetitle]{title}% }% <<<2 \def\citeresetabnt{\global\let\cbx@abnt@names\@empty}% \citeresetabnt% \def\cbx@abnt@ifnamesaved{% \xifinlist{\thefield{fullhash}}{\cbx@abnt@names}% {\@firstoftwo}% {\@secondoftwo}}% \renewbibmacro*{cite:label}{%% >>>2 \iffieldundef{label}{% \printtext[bibhyperref]{% \printfield[uppercasecite]{labeltitle}% }% }{% \printtext[bibhyperref]{% \printfield{label}% }% }% }% <<<2 \newbibmacro*{cite:plabelyear+extrayear}{%% >>>2 \iffieldundef{labelyear}{}{% \printtext[bibhyperref]{% \printfield[noformat]{origyear}% \setunit*{\addslash}% \printfield{labelyear}% \printfield{extrayear}% }% }% \iffieldundef{issue}{}{% \addcomma\addspace\printfield{issue}% }% }% <<<2 \renewbibmacro*{cite:shorthand}{%% >>>2 \printtext[bibhyperref]{% \emph{\printfield{shorthand}}% }% }% <<<2 \newbibmacro*{citeyearpunct}{%% >>>2 \iffieldundef{labelyear}{% \usebibmacro{cite:init}% }{% else \iffieldequals{fullhash}{\cbx@lasthash}{% \setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extrayear}% }{% else \usebibmacro{cite:plabelyear+extrayear}% \savefield{fullhash}{\cbx@lasthash}% }% }% \setunit{\multicitedelim}% }% <<<2 % <<<1 % bibhyperref >>>1 \DeclareFieldFormat{citehyperref}{%% >>>2 \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links \bibhyperref{#1}% }% <<<2 \DeclareFieldFormat{textcitehyperref}{%% >>>2 \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links \bibhyperref{% #1% \ifbool{cbx:parens}% {\bibcloseparen\global\boolfalse{cbx:parens}}% {}}% }% <<<2 \savebibmacro{cite}% \savebibmacro{textcite}% \savebibmacro{textcitefull}% \renewbibmacro*{cite}{%% >>>2 \printtext[citehyperref]{% \restorebibmacro{cite}% \usebibmacro{cite}}% }% <<<2 \renewbibmacro*{textcite}{%% >>>2 \ifboolexpr{% (% not test {\iffieldundef{prenote}}% and% test {\ifnumequal{\value{citecount}}{1}}% )% or% (% not test {\iffieldundef{postnote}}% and% test {\ifnumequal{\value{citecount}}{\value{citetotal}}}% )% }% {\DeclareFieldAlias{textcitehyperref}{noformat}}% {}% \printtext[textcitehyperref]{% \restorebibmacro{textcite}% \usebibmacro{textcite}}% }% <<<2 \renewbibmacro*{textcitefull}{%% >>>2 \ifboolexpr{% ( not test {\iffieldundef{prenote}} and% test {\ifnumequal{\value{citecount}}{1}} )% or% ( not test {\iffieldundef{postnote}} and% test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )% }% {\DeclareFieldAlias{textcitehyperref}{noformat}}% {}% \printtext[textcitehyperref]{% \restorebibmacro{textcitefull}% \usebibmacro{textcitefull}}% }% <<<2 % <<<1 \endinput% % vim: set foldmarker=\ >>>,\ <<< :