如何将引用中的括号改为圆括号?

如何将引用中的括号改为圆括号?

如何改变:

爱因斯坦[2] 这不是一项简单的工作。因人而异 [2]。

到:

爱因斯坦(2)这不是一项好工作。因人而异 [2]。

我的代码:

\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}

如果我用\usepackage[style=numeric]{biblatex},如何改变:

爱因斯坦(2)这不是一项好工作。因人而异(2)。

到:

爱因斯坦(2)这不是一项好工作。因人而异 [2]。

答案1

你可以试试biblatex-extext-numeric风格(\usepackage[style=ext-numeric]{biblatex})。你只需要

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

得到你想要的。

\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

编辑:biblatex-ext v0.4 更改了一些宏的名称\DeclareInnerCiteDelim就是\DeclareInnerCiteDelims现在。


如果您不想使用biblatex-ext而更喜欢标准numeric风格,那么您需要。

\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

实际上,只需重新定义 就足够了textcite,因为biblatex会尽力正确匹配括号。但我认为定义textcite:postnote以使用匹配括号也是很好的做法。

相关内容