diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/biblatex-abnt/latex/cbx/abnt.cbx')
-rw-r--r-- | Master/texmf-dist/doc/latex/biblatex-abnt/latex/cbx/abnt.cbx | 514 |
1 files changed, 514 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/biblatex-abnt/latex/cbx/abnt.cbx b/Master/texmf-dist/doc/latex/biblatex-abnt/latex/cbx/abnt.cbx new file mode 100644 index 00000000000..856e75a2b0d --- /dev/null +++ b/Master/texmf-dist/doc/latex/biblatex-abnt/latex/cbx/abnt.cbx @@ -0,0 +1,514 @@ +%% 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/07/06\space v2.0.1\space ABNT biblatex citation style]% + +\RequireBiber[3] +\RequireCitationStyle{authoryear} + +\RequirePackage{xparse} + +\newcommand{\addapud}{% + \renewcommand*{\multicitedelim}{% + \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}% + {\space\bibstring{apud}}% + {\addsemicolon}% + \space}% + \renewcommand*{\textcitedelim}{% + \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}% + {\addspace\bibstring{apud}}% + {\addsemicolon}% + \space}% +} + +\newcommand{\addand}{% + \renewcommand*{\multicitedelim}{% + \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}% + {\space\bibstring{and}}% + {\addsemicolon}% + \space}% + \renewcommand*{\textcitedelim}{% + \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}% + {\addspace\bibstring{and}}% + {\addsemicolon}% + \space}% +} + +\DeclareFieldFormat{uppercasecite}{% + \iftoggle{sccite}{% + \textsc{\smartlowercase{#1}}% + }{% + \smartuppercase{#1}% + }% +} + +% ---------- +% Options +% ---------- + +% Option to use small caps in the citations. +\newtoggle{sccite} +\DeclareBibliographyOption{sccite}[true]{% + \settoggle{sccite}{#1}} + + +% ---------- +% DeclareNameFormat +% ---------- + +\DeclareNameFormat{LAST}{% + \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}} + +\DeclareNameFormat{fullcite}{% + \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}} + + +% ---------- +% DeclareFieldFormat +% ---------- + +\DeclareFieldFormat{emphtitle}{\emph{#1}} + +\DeclareFieldFormat{citetitle}{% + \iftoggle{sccite}{% + \normalfont\textsc{\MakeLowercase{\FirstWord{#1}}}% + }{% + \normalfont\MakeUppercase{\FirstWord{#1}}% + }% +}% + + +% ---------- +% DeclareCiteCommand +% ---------- + +\NewDocumentCommand{\textapud}{o o m o o m}{% + \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}% + }% + }} + +\DeclareMultiCiteCommand{\apud}[\addapud\mkbibparens] + {\@apud} + {\setunit{\multicitedelim}} + +\DeclareCiteCommand{\@apud} + {\usebibmacro{cite:init}% + \iffieldundef{prenote}% + {}% + {\printfield[uppercasecite]{prenote}% + \addspace\bibstring{apud}\addspace}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite}}% + {\setunit{\multicitedelim}}% + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\parencite}[\mkbibparens] + {\usebibmacro{cite:init}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite}}% + {}% + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\cite}[\mkbibparens] + {\usebibmacro{cite:init}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite}}% + {}% + {\usebibmacro{postnote}} + +\DeclareMultiCiteCommand{\cites}[\mkbibparens] + {\cite}% + {\setunit{\multicitedelim}} + +\DeclareCiteCommand*{\cite} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite}}% + {}% + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\plaincite} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite}}% + {\multicitedelim}% + {\usebibmacro{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{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}} + +\DeclareCiteCommand{\citetitle}[\mkbibparens] + {\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}} + +\DeclareCiteCommand{\citelastname} + {\usebibmacro{cite:init}% + \boolfalse{citetracker}% + \boolfalse{pagetracker}% + \usebibmacro{prenote}}% + {\ifciteindex% + {\indexnames{labelname}}% + {}% + \printtext[bibhyperref]{\printnames{labelname}}}% + {\multicitedelim}% + {\usebibmacro{postnote}} + +\DeclareCiteCommand{\citeauthor}[\mkbibparens] + {\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}} + +\DeclareCiteCommand{\citeyear}[\mkbibparens] + {\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}} + + +% ---------- +% newbibmacro +% ---------- + +\newbibmacro*{cite:noname}{% + \printfield[citetitle]{title}} + +\newbibmacro*{cite:init}{% + \global\undef\cbx@lasthash} + +\newbibmacro*{cite:author}{% + \printtext[bibhyperref]{\printfield{author}}} + +\renewbibmacro*{textcite}{% + \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}}}% + {\printnames{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \addspace\bibopenparen}% + \ifnumequal{\value{citecount}}{1}% + {\usebibmacro{prenote}}% + {}% + \usebibmacro{citeyear}}} + +\newbibmacro*{textcitefull}{% + \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}}}% + {\printnames[fullcite]{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \addspace\bibopenparen}% + \ifnumequal{\value{citecount}}{1}% + {\usebibmacro{prenote}}% + {}% + \usebibmacro{citeyear}}} + +\renewbibmacro*{cite}{% + \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}} + +\def\citeresetabnt{\global\let\cbx@abnt@names\@empty} +\citeresetabnt +\def\cbx@abnt@ifnamesaved{% + \xifinlist{\thefield{fullhash}}{\cbx@abnt@names} + {\@firstoftwo} + {\@secondoftwo}} + +\renewbibmacro*{cite:label}{% + \iffieldundef{label} + {\printtext[bibhyperref]{\printfield[uppercasecite]{labeltitle}}}% + {\printtext[bibhyperref]{\printfield{label}}}} + +\newbibmacro*{cite:plabelyear+extrayear}{% + \iffieldundef{labelyear}% + {}% + {\printtext[bibhyperref]{% + \printfield[noformat]{origyear}\setunit*{\addslash}% + \printfield{labelyear}\printfield{extrayear}}}% + \iffieldundef{issue}% + {}% + {\addcomma\addspace\printfield{issue}}} + +\renewbibmacro*{cite:shorthand}{% + \printtext[bibhyperref]{\emph{\printfield{shorthand}}}} + +\newbibmacro*{citeyearpunct}{% + \iffieldundef{labelyear}% + {\usebibmacro{cite:init}}% + {\iffieldequals{fullhash}{\cbx@lasthash}% + {\setunit{\compcitedelim}% + \usebibmacro{cite:plabelyear+extrayear}}% + {\usebibmacro{cite:plabelyear+extrayear}% + \savefield{fullhash}{\cbx@lasthash}}}% + \setunit{\multicitedelim}} + + +% Get the whole thing inside bibhyperref (including punctuation) + +\DeclareFieldFormat{citehyperref}{% + \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links + \bibhyperref{#1}} + +\DeclareFieldFormat{textcitehyperref}{% + \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links + \bibhyperref{% + #1% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}}} + +\savebibmacro{cite} +\savebibmacro{textcite} +\savebibmacro{textcitefull} + +\renewbibmacro*{cite}{% + \printtext[citehyperref]{% + \restorebibmacro{cite}% + \usebibmacro{cite}}} + +\renewbibmacro*{textcite}{% + \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}}} + +\renewbibmacro*{textcitefull}{% + \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}}} + + +\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} + +\endinput |