我用方括号括起我的引用(/parencite
)来自以下答案:Biblatex,作者年份,方括号.所以现在我有
[Doe 1995]
文字。但我希望
[Doe(1995)]
在文本中。参考书目的方式不应改变。现在它是这样的:
Doe,J.(1995),......
我如何实现这个目标?
答案1
有很多括号和大括号,但我们开始吧。:-) 我建议使用 Audrey 的回答对链接问题并添加bibmacro的重新定义cite
(即在cite:labelyear+extrayear
bibmacro中添加括号)。
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\makeatletter
\newrobustcmd*{\parentexttrack}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
\blx@bibopenparen#1\blx@bibcloseparen
\endgroup}
\AtEveryCite{%
\let\parentext=\parentexttrack%
\let\bibopenparen=\bibopenbracket%
\let\bibcloseparen=\bibclosebracket}
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
% \usebibmacro{cite:labelyear+extrayear}}% DELETED
\printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}% ADDED
{\usebibmacro{cite:shorthand}}}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\null\vfill\noindent
Filler text \parencite[see][59--63]{A01}. \\
Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}. \\
Filler text \parencite[see][\pno~59 \brackettext{last paragraph}]{A01}. \\
\parentext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}.} \\
\brackettext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}.} \\
\citeauthor{A01} show that this is filler text \parencite*{A01}. \\
\textcite[see][\pno~59 \parentext{last paragraph}]{A01} show that this is filler text. \\
Filler text \autocite{A01}. \\
\citeauthor{A01} show that this is filler text \autocite*{A01}. \\
Filler text.\smartcite[\pno~59 \brackettext{last paragraph}]{A01}
Filler text.\footnote{More filler text \smartcite[see][\pno~59 \brackettext{last paragraph}]{A01}.} \\
\parencites{A01,B02} \\
\textcites{A01,B02} \\
\printbibliography
\end{document}