0

I am having some problems to customize the abnt-numeric style in biblatex. I have almost everything I need set, but I want to use square brackets around citations and around the numbers in the bibliography.

\documentclass[12pt,
    article,
    english,
    a4paper,
    oneside,
    ]{abntex2}
\usepackage[backend=biber,style=abnt-numeric,isbn=false,doi=false,url=false,maxnames=100,sorting=none]{biblatex}
\addbibresource{library.bib}
\begin{document}
I want this citation to show with square brackets instead of parenthesis \cite{Vergnano2015}, as well as this one \textcite{Ericson2005}.

I also want the bibliography numbers, in the "REFERENCES" section, around square brackets.
\printbibliography[title=REFERENCES]
\end{document}

Where "library.bib" contains:

@book{Ericson2005,
address = {Hoboken, NJ, USA},
author = {Ericson, Clifton A.},
doi = {10.1002/0471739421},
file = {:C$\backslash$:/Users/Andre/Google Drive/UFABC/IC2/Artigos e livros leitura/Selecionados para SIMEA 2018/Ericson, 2005 - Hazard Analysis Techniques for System Safety.pdf:pdf},
isbn = {9780471739425},
month = {jul},
publisher = {John Wiley {\&} Sons, Inc.},
title = {{Hazard Analysis Techniques for System Safety}},
url = {http://doi.wiley.com/10.1002/0471739421},
year = {2005}
}
@article{Vergnano2015,
author = {Vergnano, Alberto and Berselli, Giovanni and Pellicciari, Marcello},
doi = {10.1007/s12008-015-0295-y},
file = {:C$\backslash$:/Users/Andre/Google Drive/UFABC/IC2/Artigos e livros/Vergnano, 2015 - Parametric virtual concepts in the early design of mechanical systems{\_} a case study application.pdf:pdf},
issn = {19552505 19552513},
journal = {International Journal on Interactive Design and Manufacturing},
keywords = {CAD based simulation,Design process,Vibrating screen,Virtual concepts,Virtual prototyping,virtual prototype},
mendeley-tags = {virtual prototype},
pages = {1--10},
title = {{Parametric virtual concepts in the early design of mechanical systems: a case study application}},
year = {2015}
}

Can anyone give me a hand? Thanks in advance!!

2

Since the implementation of \textcite is a bit ... verbose in the numeric styles (especially numeric-comp) the amount of code to change this is larger than one should expect.

\documentclass[12pt,
    article,
    english,
    a4paper,
    oneside,
    ]{abntex2}
\usepackage[
  backend=biber,
  style=abnt-numeric,
  isbn=false,
  doi=false,
  url=false,
  maxnames=100,
  sorting=none,
]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\cite}[\mkbibbrackets]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}%
  {\iftoggle{comp}{}{\multicitedelim}}%
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}%

\DeclareCiteCommand{\parencite}[\mkbibbrackets]%
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}%
  {\iftoggle{comp}{}{\multicitedelim}}%
  {\usebibmacro{cite:dump}%
\usebibmacro{postnote}}%

\makeatletter
  \renewbibmacro*{textcite}{% >>>3
    \iftoggle{comp}{%
      \iffieldequals{namehash}{\cbx@lasthash}%
        {\usebibmacro{cite:comp}}%
        {\usebibmacro{cite:dump}%
        \ifbool{cbx:parens}%
          {\printtext{\bibclosebracket}\global\boolfalse{cbx:parens}}%
          {}%
        \iffirstcitekey%
          {}%
          {\textcitedelim}%
        \usebibmacro{cite:init}%
        \printtext[bibhyperref]{%
          \ifnameundef{labelname}%
            {\printfield[citetitle]{labeltitle}}%
            {\printnames{labelname}}%
        }
        \setunit*{\printdelim{namelabeldelim}}%
        \printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
        \ifnumequal{\value{citecount}}{1}%
          {\usebibmacro{prenote}}%
          {}%
        \usebibmacro{cite:comp}%
        \stepcounter{textcitecount}%
        \savefield{namehash}{\cbx@lasthash}}%
    }{%
      \iffieldequals{namehash}{\cbx@lasthash}%
            {\setunit{\multicitedelim}}%
            {\printtext[bibhyperref]{%
              \ifnameundef{labelname}%
                {\printfield[citetitle]{labeltitle}}%
                {\printnames{labelname}
             }}%
            \setunit*{\printdelim{namelabeldelim}}%
            \printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
            \stepcounter{textcitecount}%
            \savefield{namehash}{\cbx@lasthash}}%
          \ifnumequal{\value{citecount}}{1}%
            {\usebibmacro{prenote}}%
            {}%
          \usebibmacro{cite}%
          \setunit{%
            \ifbool{cbx:parens}%
              {\bibclosebracket\global\boolfalse{cbx:parens}}%
              {}%
            \textcitedelim}%
    }%
}%

  \renewbibmacro*{textcite:postnote}{%
    \usebibmacro{postnote}%
    \ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
      {\setunit{}%
      \printtext{%
        \ifbool{cbx:parens}%
          {\bibclosebracket\global\boolfalse{cbx:parens}}%
          {}}}%
      {\setunit{%
        \ifbool{cbx:parens}%
          {\bibclosebracket\global\boolfalse{cbx:parens}}%
          {}%
        \textcitedelim}}}%

  \DeclareCiteCommand{\cbx@textcite}%
    {\iftoggle{comp}{\usebibmacro{cite:init}}{\usebibmacro{textcite:init}}}%
    {\usebibmacro{citeindex}%
    \usebibmacro{textcite}}%
    {}%
    {\iftoggle{comp}{%
      \usebibmacro{cite:dump}%
          \usebibmacro{postnote}%
          \ifbool{cbx:parens}%
            {\bibclosebracket\global\boolfalse{cbx:parens}}%
            {}%
    }{%
      \usebibmacro{textcite:postnote}%
}}%
\makeatother

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\begin{document}
I want this citation to show with square brackets instead of parenthesis \cite{sigfridsson},
as well as this one \textcite{worman}.

\printbibliography
\end{document}

This is code from abnt-numeric.cbx where \mkbibparens was replaced with \mkbibbrackets and \bibopenparen/\bibcloseparen with \bibopenbracket/\bibclosebracket.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.