我希望这个问题还没有在其他地方被问到;如果是这样,我很抱歉。
我的问题是,我正尝试使用芝加哥风格 (biblatex-chicago) 来格式化我的论文。如果这有帮助的话,我正在使用 XeLaTeX + polyglossia 来处理古希腊文本(但这对当前的问题来说并不特别重要)。芝加哥风格总体上效果很好,但我需要遵循特定期刊的引用风格。
这是我的 BibLaTeX .bib 文件的一个示例:
@BOOK{WIngram80,
title = {Sophocles: {A}n {I}nterpretation},
publisher = {Cambridge University Press},
year = {1980},
author = {Winnington-Ingram, R. P.},
address = {Cambridge}
}
以下是我在 .tex 文件中调用 BibLaTeX 的方法:\usepackage[authordate,backend=biber]{biblatex-chicago}
Biblatex-chicago 引用格式如下:
输入:See \textcite[120]{WIngram80}
输出:参见 Winnington-Ingram (1980, 120)
我需要将其格式化如下:参见 Winnington-Ingram (1980) 120。
除此之外,我使用的期刊使用芝加哥格式,除了文内引用。没有页码的引用也可以,例如“Winnington-Ingram (1980)”——但我希望解决这个问题,希望至少使用 \textcite。
此外,即使在括号引用(即 \parencite)中,我也需要保留括号中的日期,因此输出\parencite[120]{WIngram80}
应该是:“(Winnington-Ingram(1980)120)”
如果您需要任何其他信息,请告诉我。非常感谢!
** 编辑:谢谢 Moewe,你的建议非常有效!我还有一些关于格式的问题,主要是关于 hyperref 的问题,但它们也与本次讨论相关。
当我使用带有页码或其他参考参数的 \textcite 时,我希望姓氏和日期都超链接;页面并不重要。虽然这对于 \footcite 来说很好,但如果我在脚注中使用 \textcite 和其他信息,如下所示:
\footnote{See \textcite[78]{Vernant}. The French translation is my own.}
输出为:参见 Vernant (1977) 78. 法语翻译是我自己翻译的。(我使用大胆的以表明此处的链接位置)
我希望是这样:韦尔南(1977)78. 法语翻译是我自己做的。
我不确定这是否可行,但\footcite
如果脚注除了引用之外不需要任何其他内容,那么它可以像这样完美地工作。
输入:\footcite[See][218]{Barfield}
输出:参见巴菲尔德 (1988)218.
我到处都附有详细的脚注,并附有文本引文和其他评论,最重要的是,我希望保持一致,尤其是超链接。众所周知,编辑部对这些事情非常严格,所以我想确保一切都保持一致。
再次感谢moewe的帮助!
** 编辑:我意识到我忘了提及我收集的一些其他有助于超链接支持的补丁:
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\DeclareFieldFormat{textcitehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{%
#1%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}}
\savebibmacro{cite}
\savebibmacro{textcite}
\renewbibmacro*{cite}{%
\printtext[citehyperref]{%
\restorebibmacro{cite}%
\usebibmacro{cite}}}
\renewbibmacro*{textcite}{%
\ifboolexpr{
( not test {\iffieldundef{prenote}} and
test {\ifnumequal{\value{citecount}}{1}} )
or
( not test {\iffieldundef{postnote}} and
test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
}
{\DeclareFieldAlias{textcitehyperref}{noformat}}
{}%
\printtext[textcitehyperref]{%
\restorebibmacro{textcite}%
\usebibmacro{textcite}}}
我偶然看到了这个片段,但我不知道它是否会对可能的解决方案产生影响。抱歉之前没有提到这一点。
答案1
biblatex-chicago
实际上要经过相当长的时间才能实现您所得到的输出。
以下修改取消了将后注添加到括号中的行为
\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\renewbibmacro*{textcite:postnote}{%
\ifbool{cbx:parens}%
{\bibcloseparen\global\boolfalse{cbx:parens}}%
{}%
\iffieldundef{postnote}%
{}%
{\savefield{namehash}{\cbx@lastyear}%
\setunit{\postnotedelim}%
\printfield{postnote}}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
{}%
{\textcitedelim}}% Not \multicitedelim ???
\makeatother
旧版本中的部分chicago-authordate.cbx
位于\bibcloseparen
宏的末尾,因此需要用括号括起来后附言。
为了始终将年份放在括号中(即使在 中\parencite
),我们必须重新定义cite
bibmacro。由于 中的标准parens
字段格式biblatex
将使用嵌套括号内的方括号[]
,因此我们还必须定义该格式的更简单版本,以便始终使用括号 - 无论嵌套级别如何。
\DeclareFieldFormat{parenshc}{(#1)}
\makeatletter
\newbibmacro*{cite}{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}%
{\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\usebibmacro{cite:label}}
{\iffieldequals{namehash}{\cbx@lastyear}%
{}%
{\usebibmacro{cmsbracketname}% For names in []
\ifentrytype{customc}%
{\newcunit}%
{\setunit{\addspace}}}%
\usebibmacro{cite:label}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand+title}}}
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
{\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
{}%
{\usebibmacro{cmsbracketname}%
\setunit{\nameyeardelim}}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand}}}}%
\setunit{\multicitedelim}}% ???
\makeatother
这个修改将导致标准\cite
也将年份放在括号中,我不确定这是否是您想要的,但如果我们也处理这个问题,就会变得相当混乱。
平均能量损失
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{parenshc}{(#1)}
\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\newbibmacro*{cite}{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}%
{\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\usebibmacro{cite:label}}
{\iffieldequals{namehash}{\cbx@lastyear}%
{}%
{\usebibmacro{cmsbracketname}% For names in []
\ifentrytype{customc}%
{\newcunit}%
{\setunit{\addspace}}}%
\usebibmacro{cite:label}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand+title}}}
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
{\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
{}%
{\usebibmacro{cmsbracketname}%
\setunit{\nameyeardelim}}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand}}}}%
\setunit{\multicitedelim}}% ???
\renewbibmacro*{textcite:postnote}{%
\ifbool{cbx:parens}%
{\bibcloseparen\global\boolfalse{cbx:parens}}%
{}%
\iffieldundef{postnote}%
{}%
{\savefield{namehash}{\cbx@lastyear}%
\setunit{\postnotedelim}%
\printfield{postnote}}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
{}%
{\textcitedelim}}% Not \multicitedelim ???
\makeatother
\begin{document}
As was discovered \textcite[210]{cicero} and \textcite[210]{wilde} \parencite[210]{cicero} and \cite[210]{wilde}.
\textcite{wilde,cicero} vs \parencite{wilde,cicero}.
\textcite{baez/article,wilde,cicero} vs \parencite{baez/article,wilde,cicero}.
\printbibliography
\end{document}
要合并您的超链接修复,请尝试以下 MWE。请注意,您不必向此代码段添加任何其他超链接代码。我已将您在更新中发布的代码合并到此版本中。
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{parenshc}{(#1)}
\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\newbibmacro*{cite}{\printtext[citehyperref]{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}%
{\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\usebibmacro{cite:label}}
{\iffieldequals{namehash}{\cbx@lastyear}%
{}%
{\usebibmacro{cmsbracketname}% For names in []
\ifentrytype{customc}%
{\newcunit}%
{\setunit{\addspace}}}%
\usebibmacro{cite:label}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand+title}}}
{\iffieldundef{shorthand}%
{\ifthenelse{\ifnameundef{labelname}\OR
\ifentrytype{inreference}\OR
\ifentrytype{reference}\OR
\ifentrytype{mvreference}}% Simplified for CMS
{\usebibmacro{cite:label}%
\setunit{\addspace}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}%
{\iffieldundef{postnote}%
{\setunit{\compcitedelim}}%
{}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
{\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
{}%
{\usebibmacro{cmsbracketname}%
\setunit{\nameyeardelim}}%
\printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
\iffieldundef{postnote}%
{\savefield{namehash}{\cbx@lasthash}}%
{\savefield{namehash}{\cbx@lastyear}}}}}%
{\usebibmacro{cite:shorthand}}}}%
\setunit{\multicitedelim}}}% ???
\renewbibmacro*{textcite:postnote}{%
\ifbool{cbx:parens}%
{\bibcloseparen\global\boolfalse{cbx:parens}}%
{}%
\iffieldundef{postnote}%
{}%
{\savefield{namehash}{\cbx@lastyear}%
\setunit{\postnotedelim}%
\printfield{postnote}}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
{}%
{\textcitedelim}}% Not \multicitedelim ???
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\DeclareFieldFormat{textcitehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{%
#1%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}}
\renewbibmacro*{textcite}{%
\iftoggle{cms@los}%
{\printtext[textcitehyperref]{\usebibmacro{textcite:authshort}}}%
{\printtext[textcitehyperref]{\usebibmacro{textcite:citeshort}}}}
\makeatother
\begin{document}
As\footcite[See][]{knuth:ct:a,knuth:ct:b} was discovered \textcite[210]{cicero} and \textcite[210]{wilde} \parencite[210]{cicero} and \cite[210]{wilde}.
\textcite{wilde,cicero} vs \parencite{wilde,cicero}.\footcite{wilde}
\textcite{baez/article,wilde,cicero} vs \parencite{baez/article,wilde,cicero}.
\printbibliography
\end{document}