网站和其他项目的不同引用风格

网站和其他项目的不同引用风格

我想将网站的引用输出与 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

正如我所写,您可以执行以下操作:

  1. 使用选项url=true
  2. 重新定义 bibmacro url+date,以便只有当 entrytype 为misc

    \savebibmacro{url+urldate}
    \renewbibmacro*{url+urldate}{%
       \ifentrytype{misc}{\restorebibmacro{url+urldate}\us‌​ebibmacro{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}

产量 在此处输入图片描述

相关内容