参考文献列表中的方括号引用

参考文献列表中的方括号引用

\usepackage[backend=biber,style=authoryear]{biblatex}在文档中使用方括号完整超链接它在文档中给出了这个[MacRae and Pattison 2002],在参考文献中给出了这个

MacRae, K. and J. Pattison (2002). “Home chemotherapy.” In: Nursing Times 98.35, pp. 34–35.

我怎样才能使它在参考文献中也有相同的方括号引用?

答案1

像这样的事情??

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\renewcommand\mkbibparens[1]{[#1]}
\addbibresource{IEEEexample.bib}

\begin{document}

foo~\parencite{IEEEexample:masterstype}
\printbibliography

\end{document}

在此处输入图片描述

答案2

在阅读了你对 Herbert 的回答的新评论后,我得出了以下结论

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}%
}

\makeatletter
\renewbibmacro*{begentry}{%
  \begingroup
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \defcounter{maxnames}{\value{mymaxcitenames}}%
    \parencite{\thefield{entrykey}}%
  \endgroup
  \addspace
}
\makeatother

类似于 Lockstep 在在参考书目条目开头添加 [AuthorYear] 块,但更短。(当然,您可以使用\cite或任何其他引用命令来代替\parencite上述命令。)

名称和年份之间的分隔符更改为

\renewcommand*{\nameyeardelim}{\addcomma\space}

因此我们有

数学家协会

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}%
}

\makeatletter
\renewbibmacro*{begentry}{%
  \begingroup
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \defcounter{maxnames}{\value{mymaxcitenames}}%
    \parencite{\thefield{entrykey}}%
  \endgroup
  \addspace
}
\makeatother

\renewcommand*{\nameyeardelim}{\addcomma\space}

\begin{document}

foo~\parencite{baez/article,wilde}
\printbibliography

\end{document}

平均能量损失

如果你只想在本地使用逗号(你为什么要这么做呢?),你可以使用

\makeatletter
\renewbibmacro*{begentry}{%
  \begingroup
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \renewcommand*{\nameyeardelim}{\addcomma\space}
    \parencite{\thefield{entrykey}}%
  \endgroup
  \addspace
}
\makeatother

旧答案

我不会重新定义最基本的\mkbibparens,而是选择重新定义\parencite使用\mkbibbrackets而不是\mkbibparens

\DeclareCiteCommand{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

当然你也可以重新定义\cite

\DeclareCiteCommand{\cite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\cite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

或定义一个新命令\brackcite

\DeclareCiteCommand{\brackcite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\brackcite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

尽管对我来说这比 Herbert 的解决方案的代码稍微多一些但它看起来更加健壮。

平均能量损失

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}

foo~\parencite{baez/article,wilde}
\printbibliography

\end{document}

在此处输入图片描述


在您对赫伯特的回答发表评论之后。

我不完全确定你想要什么,你可以用以下方法更改引文中名称和年份之间的分隔符

\newcommand*{\nameyeardelim}{\addcomma\space}

例如。

引文中姓名的显示方式由姓名格式控制labeldate。无论如何,要始终获取姓氏首字母,请尝试

\DeclareNameFormat{labelname}{%
  \ifcase\value{uniquename}%
    \usebibmacro{name:last-first}{#1}{#4}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}}

相关内容