2

How change from:

Einstein [2] fez um bom trabalho. As pessoas precisam de ajuda [2].

to:

Einstein (2) fez um bom trabalho. As pessoas precisam de ajuda [2].

My code:

\documentclass{book}

\usepackage[style=numeric]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{ref.bib}

@article{einstein,
author = {Albert Einstein},
  title = {the true about tree},
  journaltitle = {Annalen der Physik},
  year = {1905},
  volume = {322},
  number = {10},
  pages = {891-921}
}

@article{einstein2,
  author = {Albert Einstein},
  title = {the lie about tree},
  journaltitle = {Annalen der Physik},
  year = {1906},
  volume = {322},
  number = {10},
  pages = {891-921}
  }

\end{filecontents}

\addbibresource{ref.bib}

\renewcommand*{\mkbibnamefamily}[1]{#1}%

\begin{document}


\chapter{Capitulinho}
\section{Section}

\textcite{einstein} fez um bom trabalho.
As pessoas precisam de ajuda \cite{einstein}.

\textcite{einstein2} fez um bom trabalho.
As pessoas precisam de ajuda \cite{einstein2}.

\printbibliography

\end{document}

And if I use \usepackage[style=numeric]{biblatex}, how change from:

Einstein (2) fez um bom trabalho. As pessoas precisam de ajuda (2).

to:

Einstein (2) fez um bom trabalho. As pessoas precisam de ajuda [2].

2

You can try biblatex-ext's ext-numeric style (\usepackage[style=ext-numeric]{biblatex}). You will only need

\DeclareInnerCiteDelims{textcite}{\bibopenparen}{\bibcloseparen}

to get what you want.

\documentclass{article}
\usepackage[style=ext-numeric]{biblatex}

\DeclareInnerCiteDelims{textcite}{\bibopenparen}{\bibcloseparen}

\addbibresource{biblatex-examples.bib}
\begin{document}
\textcite{sigfridsson} fez um bom trabalho.
As pessoas precisam de ajuda \cite{sigfridsson}.

\textcite{nussbaum} fez um bom trabalho.
As pessoas precisam de ajuda \cite{nussbaum}.

\printbibliography
\end{document}

enter image description here

edit: biblatex-ext v0.4 changes the names of a few macros. \DeclareInnerCiteDelim is \DeclareInnerCiteDelims now.


If you don't want to use biblatex-ext and prefer the standard numeric style instead you need.

\makeatletter
\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\setunit{\multicitedelim}}
    {\ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \setunit*{\printdelim{namelabeldelim}}%
     \printtext{\bibopenparen}\global\booltrue{cbx:parens}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}%
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \usebibmacro{cite}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}

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

Actually it would be enough to redefine only textcite, because biblatex tries very hard to match the brackets properly. But I consider it good practice to also define the textcite:postnote to use the matching brackets.

  • Nice package indeed! :) – gusbrs Apr 19 '18 at 13:54

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.