我想使用 更改作者年份引用\parencite
,以便作者显示为:
(AUTHOR, year) and/or (AUTHOR, year, p.) (one page) (AUTHOR, year, pp.) (multiple pages)
到目前为止,我已成功将引文和参考书目中的姓氏改为大写(不是我的选择,但我正在尝试实现这一点):
\renewcommand{\mkbibnamefirst}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnamelast}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnameprefix}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnameaffix}[1]{\MakeUppercase{#1}}
\DeclareNameFormat{author}{%
\ifthenelse{\value{listcount}=1}
{\MakeUppercase{#1}%
\ifblank{#3}{}{\addcomma\space #3}}
{\ifblank{#3}{}{#3\space}%
\MakeUppercase{#1}}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
\parencite
我也尝试过使用以下方法更改文内引用的多作者分隔符
\renewcommand*{\finalnamedelim}{;\space}
\renewcommand*{\multicitedelim}{;\space}
因此参考文献如下所示:
(AUTHOR1; AUTHOR2; AUTHOR3, year).
但它没有起作用。
我还想将参考文献列表中的所有多作者姓名设置为姓氏开头,并用分号分隔,但以下方法也不起作用:
\DeclareNameAlias{sortname}{last-first}
我在序言中使用了以下内容:
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{EB Garamond}
\setsansfont{Candara}
\setmonofont{Consolas}
\usepackage{polyglossia}
\setmainlanguage{brazil}
\usepackage{csquotes}
\usepackage[style=historian,doi=false,citestyle=authoryear]{biblatex}
\DefineBibliographyStrings{brazil}{namedash={---},volumeof={de},url={Disponível em: }}
\renewcommand{\mkbibnamefirst}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnamelast}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnameprefix}[1]{\MakeUppercase{#1}}
\renewcommand{\mkbibnameaffix}[1]{\MakeUppercase{#1}}
\DeclareNameFormat{author}{%
\ifthenelse{\value{listcount}=1}
{\MakeUppercase{#1}%
\ifblank{#3}{}{\addcomma\space #3}}
{\ifblank{#3}{}{#3\space}%
\MakeUppercase{#1}}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
答案1
我不知道这historian
是什么风格(它不是标准的风格),但我看到你citestyle=authoryear
无论如何都在使用,所以这应该是相同的。
我相信下面的例子可以满足您的要求。它使用了biblatex
示例书目。请注意,有些年份后面有字母,这是因为同一作者在同一年有几部作品。
\documentclass{article}
\usepackage[style=authoryear, backend=biber]{biblatex}
% \renewcommand{\mkbibnamefirst}[1]{\MakeUppercase{#1}}
% \renewcommand{\mkbibnamelast}[1]{\MakeUppercase{#1}}
% \renewcommand{\mkbibnameprefix}[1]{\MakeUppercase{#1}}
% \renewcommand{\mkbibnameaffix}[1]{\MakeUppercase{#1}}
\renewcommand*{\nameyeardelim}{\addcomma\addspace}
\newbibmacro*{cite_p}{%adapted from authoryear.cbx
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}%
{\usebibmacro{cite:label}%
\setunit{\addspace}}%
{\printnames[labelname_p]{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}%
\iffieldundef{pages}%
{}%
{\addcomma\addspace\printfield{pages}}%
}
{\usebibmacro{cite:shorthand}}}
\DeclareCiteCommand{\parencite}[\mkbibparens]%adapted from authoryear.cbx
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite_p}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareNameFormat{labelname_p}{%from biblatex.def
\ifcase\value{uniquename}%
\usebibmacro{name:last}{\MakeUppercase{#1}}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{\MakeUppercase{#1}}{#4}{#5}{#8}}
{\usebibmacro{name:first-last}{\MakeUppercase{#1}}{#4}{#6}{#8}}%
\or
\usebibmacro{name:first-last}{\MakeUppercase{#1}}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}}
\addbibresource{biblatex-examples.bib}
\addbibresource{test.bib}
\begin{document}
\begin{itemize}
\item Year and pages \parencite{nietzsche:historie}.
\item Two inbook with year and pages \parencite{nietzsche:historie, brandt}
\item A book with no pages \parencite{massa}
\item textcite on a book with no pages \textcite{massa}.
\item Several books \parencite{murray, augustine, cotton, bertram, massa}.
\item Article with single page \parencite{art1}
\item textciting \textcite{nietzsche:historie, brandt}
\end{itemize}
\nocite{*}
\printbibliography
\end{document}
解释
如果你想知道细节,请将我这里的内容与 中的内容进行比较authoryear.cbx
,你应该看到我做了哪些更改。但是,简而言之:
\renewcommand*{\nameyeardelim}{\addcomma\addspace}
确保姓名和年份以空格和逗号分隔- 制作了新的引文宏
cite_p
,基本上是复制的cite
,但在最后添加了页面部分 - 重新定义
parencite
以使用我们的自定义cite_p
。 - 3+4确保其他引用命令不变。
更新
修复了一些错误,如下面的评论所述
答案2
由于您仅对现有的引用命令做了很小的更改,因此该\AtNextCite
钩子非常方便:
\let\origparencite\parencite
\let\origparencites\parencites
\newrobustcmd*{\parencitehook}{%
\AtNextCite{%
\renewcommand*{\nameyeardelim}{\addcomma\addspace}%
\renewcommand*{\mkbibnamelast}[1]{\MakeUppercase{##1}}}}
\renewrobustcmd*{\parencite}{\parencitehook\origparencite}
\renewrobustcmd*{\parencites}{\parencitehook\origparencites}
这种方法的优点是它适用于任何作者年份样式。