我正在嘗試在樣式中使用shorthand
a ,這就是我在使用命令時所期望的:@mvcollection
authoryear-comp
\textcite
曹(第1234號)
然而,生成的是這樣的:
威廉等。 (曹,編號1234)
\cite
另一方面,普通指令會如預期產生引文:
曹,沒有。 1234
本例中@mvcollection
是中世紀德國憲章和契約的 5 卷版本,依編號排序;我再次將每一卷單獨歸檔。但是,我在這裡嘗試將集合中的條目作為一個整體來引用,因為單一記錄的枚舉不會隨每個磁碟區重新開始。我不明白的是為什麼在使用時year
將 替換為shorthand
而不是editor
並一起替換。year
\textcite
微量元素:
\documentclass{article}
\usepackage[
style=authoryear-comp,
backend=biber,
safeinputenc,
]{biblatex}
\begin{filecontents*}{\jobname.bib}
@mvcollection{CAO,
editor = {Friedrich Wilhelm and Richard Newald and Helmut {de Boor} and Diether Haacke and Bettina Kirschstein},
gender = {pp},
title = {{Corpus der altdeutschen Originalurkunden bis zum Jahr 1300}},
shorthand = {CAO},
sortkey = {CAO0},
volumes = {5},
publisher = {Moritz Schauenburg and Erich Schmidt},
location = {Lahr and Berlin},
year = {1932--2004},
pagination = {number},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\textcite[1234]{CAO}
\end{document}
答案1
\textcite
修改起來有點痛苦。以下內容shorthand
優先於任何內容,並確保後注始終包含在圓括號中。
\documentclass{article}
\usepackage[
style=authoryear-comp,
backend=biber,
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@mvcollection{CAO,
editor = {Friedrich Wilhelm and Richard Newald and Helmut de Boor and Diether Haacke and Bettina Kirschstein},
gender = {pp},
title = {Corpus der altdeutschen Originalurkunden bis zum Jahr 1300},
shorthand = {CAO},
sortkey = {CAO0},
volumes = {5},
publisher = {Moritz Schauenburg and Erich Schmidt},
location = {Lahr and Berlin},
date = {1932/2004},
pagination = {number},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\makeatletter
\newtoggle{cbx:postparens}
\renewbibmacro*{textcite}{%
\iffieldundef{shorthand}
{\iffieldequals{namehash}{\cbx@lasthash}
{\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
\(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
{\setunit{\addcomma}%
\usebibmacro{cite:extradate}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:labeldate+extradate}%
\savefield{labelyear}{\cbx@lastyear}}}
{\ifnameundef{labelname}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nonameyeardelim}\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labeldate+extradate}}
{\printnames{labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nameyeardelim}\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\iffieldundef{labelyear}
{\usebibmacro{cite:label}}
{\usebibmacro{cite:labeldate+extradate}}%
\savefield{labelyear}{\cbx@lastyear}}}%
\stepcounter{textcitecount}%
\savefield{namehash}{\cbx@lasthash}%
\togglefalse{cbx:postparens}}%
{\usebibmacro{cite:shorthand}%
\toggletrue{cbx:postparens}%
\global\undef\cbx@lasthash
\global\undef\cbx@lastyear}%
\setunit{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}
\renewbibmacro*{textcite:postnote}{%
\ifboolexpr{togl {cbx:postparens} and not test {\iffieldundef{postnote}}}
{\togglefalse{cbx:postparens}%
\printunit{\extpostnotedelim\bibopenparen\global\booltrue{cbx:parens}}}
{}%
\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}}}
\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
{\gdef\cbx@savedkeys{}%
\citetrackerfalse%
\pagetrackerfalse%
\DeferNextCitekeyHook%
\usebibmacro{cite:init}}
{\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
{\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
\global\clearfield{multipostnote}}
{}%
\xappto\cbx@savedkeys{\thefield{entrykey},}%
\iffieldequals{namehash}{\cbx@lasthash}
{\iffieldundef{shorthand}
{}
{\stepcounter{textcitetotal}%
\global\undef\cbx@lasthash}}
{\stepcounter{textcitetotal}%
\savefield{namehash}{\cbx@lasthash}}}
{}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\makeatother
\begin{document}
\textcite[1234]{CAO}
\end{document}
答案2
在這種情況下,\textcite
檢查是否存在labelname
與引用關聯的 a,如果為空,則使用簡寫。對於這個特定條目,它editor
被用作labelname
.如果您不希望它用於此類角色,您可以使用該選項useeditor=false
,該選項也可以使用 來基於每個條目進行設定options = {useeditor=false},
。請注意,這將改變條目在參考書目中的格式,考慮到引文格式,這實際上是有意義的。我相信這在語義上是您正在尋找的,但結果與您期望的並不相同(它看起來像 plain \cite
)。但是,也許\parencite
也是一個可能的“開箱即用”選項(當然取決於您的文字流程)。
完整的 MWE:
\documentclass{article}
\usepackage[
style=authoryear-comp,
backend=biber,
safeinputenc,
]{biblatex}
\begin{filecontents*}{\jobname.bib}
@mvcollection{CAO,
editor = {Friedrich Wilhelm and Richard Newald and Helmut {de Boor} and Diether Haacke and Bettina Kirschstein},
gender = {pp},
title = {{Corpus der altdeutschen Originalurkunden bis zum Jahr 1300}},
shorthand = {CAO},
sortkey = {CAO0},
volumes = {5},
publisher = {Moritz Schauenburg and Erich Schmidt},
location = {Lahr and Berlin},
year = {1932--2004},
pagination = {number},
options = {useeditor=false},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\textcite[1234]{CAO}
\parencite[1234]{CAO}
\printbibliography
\end{document}