我使用 biblatex-apa 來定義參考書目的佈局。現在,我引用了來自代理商或新聞網站的幾份(內部)文件,這些文件現在使用縮寫出現在文件中。我想讓這些縮寫以小寫字母顯示。實際上,我希望所有縮寫機構都以小寫字母出現。這可能嗎?我現在使用標籤(從 Zotero 匯出)來分割我的參考書目,所以我假設標籤也可能使引文在文字中顯示為小型大寫字母?有人知道該怎麼做嗎?
我的MWE:
\documentclass[10pt,a4paper,twoside]{book}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa, date=year, natbib=true, sorting=nyt, sortcites=true]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\bibliography{Zotero}
\begin{document}
\chapter{Literature review}
This is some text with a double reference \cite{nos_weeralarm_2009, ns_volle_2013}.
\printbibliography[notkeyword=internal]
\printbibliography[title={Internal Documents}, keyword=internal]
\end{document}
我的 Zotero.bib 的內容:
@online{nos_weeralarm_2009,
title = {Weeralarm en verkeeralarm ingetrokken},
url = {http://nos.nl/l/124074},
titleaddon = {{NOS.nl}},
author = {{NOS}}, %THIS AUTHOR MUST BE PRINTED IN SC
urldate = {2014-02-12},
date = {2009-12-20},
keywords = {gladheid, ijs, ongeluk, openbaar vervoer, schiphol, sneeuw}
}
@report{ns_volle_2013,
location = {Utrecht},
title = {Internal document title}},
institution = {NS},
type = {Internal Document},
author = {{NS}}, % THIS AUTHOR MUST BE PRINTED IN SC
date = {2013},
keywords = {internal}
}
答案1
如果您所有需要小型股機構的引文確實具有相同的標籤,那麼應該是可能的。
然而,在您的 MWE 中,這兩個條目不共享,因此我添加了要檢查的keyword
關鍵字。instauth
我們所做的非常簡單:在每個引文命令中,在每個參考書目條目之前,我們檢查該條目是否具有關鍵字instauth
,如果是,則將姓氏格式設定為通過biblatex
的\mkbibacro
巨集產生首字母縮略詞(請注意,要使其工作“ [t]他的首字母縮略詞應以大寫字母給出。”,第 89 頁,biblatex
文件)。
\AtEveryCitekey{%
\ifkeyword{instauth}
{\renewcommand*{\mkbibnamelast}[1]{\mkbibacro{#1}}}
{}%
}
\AtEveryBibitem{%
\ifkeyword{instauth}
{\renewcommand*{\mkbibnamelast}[1]{\mkbibacro{#1}}}
{}%
}
另一種重新定義是更短的
\renewcommand*{\mkbibnamelast}[1]{%
\ifkeyword{instauth}
{\mkbibacro{#1}}
{#1}}
條件式在哪裡裡面格式化指令。然後就不需要將變更掛接到\ifkeyword
定義的群組中,如上面所必需的。
instauth
我們甚至可以在某種程度上實現自動檢測。和
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite=true]{
\step[fieldsource=author, match=\regexp{^\{.+?\}$}, final]
\step[fieldset=keywords, append, fieldvalue={,instauth}]
}
}
}
所有author
包含用雙花括號括起來的字串的欄位都被歸類為instauth
.在某些極端情況下,這可能會崩潰——許多自動解決方案也是如此。
微量元素
\documentclass[a4paper]{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage{filecontents}
\usepackage[backend=biber, style=apa, date=year, natbib=true, sorting=nyt, sortcites=true]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{filecontents*}{\jobname.bib}
@online{nos_weeralarm_2009,
title = {Weeralarm en verkeeralarm ingetrokken},
url = {http://nos.nl/l/124074},
titleaddon = {{NOS.nl}},
author = {{NOS}}, %THIS AUTHOR MUST BE PRINTED IN SC
urldate = {2014-02-12},
date = {2009-12-20},
keywords = {gladheid, ijs, ongeluk, openbaar vervoer, schiphol, sneeuw}
}
@report{ns_volle_2013,
location = {Utrecht},
title = {Internal document title},
institution = {NS},
type = {Internal Document},
author = {{NS}}, % THIS AUTHOR MUST BE PRINTED IN SC
date = {2013},
keywords = {internal},
}
\end{filecontents*}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite=true]{
\step[fieldsource=author, match=\regexp{^\{.+?\}$}, final]
\step[fieldset=keywords, append, fieldvalue={,instauth}]
}
}
}
\renewcommand*{\mkbibnamelast}[1]{%
\ifkeyword{instauth}
{\mkbibacro{#1}}
{#1}}
\begin{document}
This is some text with a double reference \cite{nos_weeralarm_2009, ns_volle_2013, wilde, cicero}.
\printbibliography[notkeyword=internal]
\printbibliography[title={Internal Documents}, keyword=internal]
\end{document}
答案2
注意:自 2016 年 3 月(biblatex 3.3)起,您需要變更 \mkbibnamefamily 而不是 \mkbibnamelast。也可以看看Biblatex 3.3 名稱格式。