![网站和其他项目的不同引用风格](https://linux22.com/image/278866/%E7%BD%91%E7%AB%99%E5%92%8C%E5%85%B6%E4%BB%96%E9%A1%B9%E7%9B%AE%E7%9A%84%E4%B8%8D%E5%90%8C%E5%BC%95%E7%94%A8%E9%A3%8E%E6%A0%BC.png)
我想将网站的引用输出与 MWE 中书籍、期刊等的设置区分开来(我想保留)。
对于该网站且仅对于该网站,我希望获得以下输出:
标题. (年份). 检索日期从网址。
请考虑以下包含一本书和一个网站的参考书目 MWE。
\RequirePackage{filecontents}
\begin{filecontents*}{mybib.bib}
@book{van_de_donk_cyberprotest_2004,
address = {London},
url = {www.jstor.com/somearticle.html},
urldate = {2013-10-29},
title = {Cyberprotest: {New} media, citizens, and social movements},
publisher = {Routledge},
editor = {van de Donk, Wim B. H. J.},
year = {2004}
}
@misc{website,
title = {This is a blog},
url = {www.blog.com},
urldate = {2013-08-29},
journal = {Blog},
month = feb,
year = {2009}
}
}
\end{filecontents*}
\documentclass[a4paper]{article}
% Set the values for the bibliography
\usepackage[
style=apa,
backend=biber,
isbn=false,
url=false,
doi=false,
eprint=false,
hyperref=true,
backref=false,
firstinits=false,
]{biblatex}
% Remove series & month
\AtEveryBibitem{
\clearfield{series}
\clearfield{labelmonth}
\clearfield{edition}
}
% Recommended by biblatex
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{xpatch}
% Set language
\usepackage[british]{babel}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{mybib.bib}
\begin{document}
\cite{test1}
\cite{test2}
\printbibliography
\end{document}
答案1
正如我所写,您可以执行以下操作:
- 使用选项
url=true
重新定义 bibmacro
url+date
,以便只有当 entrytype 为misc
\savebibmacro{url+urldate} \renewbibmacro*{url+urldate}{% \ifentrytype{misc}{\restorebibmacro{url+urldate}\usebibmacro{url+urldate}}{}% }
答案2
您可能喜欢以下对*cite
命令的重新定义(如 中定义apa.cbx
)。我们只是为条目添加了不同的处理方式@misc
;其余部分保持不变。将此代码放入您的序言中。
\makeatletter
\renewbibmacro*{cite}{%
\ifentrytype{misc}%<--- from here
{\usebibmacro{cite:noname}%
\newunit
\printtext[parens]{\usebibmacro{cite:plabelyear+extrayear}}%
\newunit
\usebibmacro{url+urldate}%
\printtext{\addperiod}
}%<----- to here is new; what follows is standard apa.cbx
{\iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
{\setunit{\compcitedelim}%
\usebibmacro{cite:plabelyear+extrayear}}%
% Single cite
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
{\usebibmacro{cite:noname}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}
% Normal cite
{\ifnameundef{shortauthor}
{\printnames[labelname][-\value{listtotal}]{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}}%
\setunit{\multicitedelim}}}
\makeatother
数学家协会
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{van_de_donk_cyberprotest_2004,
address = {London},
title = {Cyberprotest: {New} media, citizens, and social movements},
publisher = {Routledge},
editor = {van de Donk, Wim B. H. J.},
year = {2004}
}
@misc{website,
title = {This is a blog},
url = {www.blog.com},
urldate = {2013-08-29},
journal = {Blog},
month = feb,
year = {2009}
}
}
\end{filecontents*}
\documentclass[a4paper]{article}
% Set the values for the bibliography
\usepackage[
style=apa,
backend=biber,
isbn=false,
url=false,
doi=false,
eprint=false,
hyperref=true,
backref=false,
firstinits=false,
]{biblatex}
\usepackage{hyperref}
% Remove series & month
\AtEveryBibitem{
\clearfield{series}
\clearfield{labelmonth}
\clearfield{edition}
}
% Recommended by biblatex
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{xpatch}
% Set language
\usepackage[british]{babel}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{\jobname.bib}
\makeatletter
\renewbibmacro*{cite}{%
\ifentrytype{misc}
{\usebibmacro{cite:noname}%
\newunit
\printtext[parens]{\usebibmacro{cite:plabelyear+extrayear}}%
\newunit
\usebibmacro{url+urldate}%
\printtext{\addperiod}
}
{\iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
{\setunit{\compcitedelim}%
\usebibmacro{cite:plabelyear+extrayear}}%
% Single cite
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
{\usebibmacro{cite:noname}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}
% Normal cite
{\ifnameundef{shortauthor}
{\printnames[labelname][-\value{listtotal}]{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}}%
\setunit{\multicitedelim}}}
\makeatother
\begin{document}
\cite{van_de_donk_cyberprotest_2004}
\cite{website}
\printbibliography
\end{document}
产量