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].

  • Does this one https://tex.stackexchange.com/q/341041/105447 help? – gusbrs Apr 18 '18 at 22:33
  • 1
    If you have a recent version of biblatex (3.11), there is also biblatex-ext which allows for user options on the citation delimiters (see section 5.3). – gusbrs Apr 18 '18 at 23:10
  • Did my answer help you? Or is there something wrong with it? On this site you can accept an answer if it solved your issue and upvote answers that helped you. See https://tex.stackexchange.com/help/someone-answers – moewe Apr 21 '18 at 06:15

1 Answers1

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.

moewe
  • 175,683