如何在 biblatex-chicago 中显示单个引文的 url?

如何在 biblatex-chicago 中显示单个引文的 url?

我使用includeall=false中的选项biblatex-chicago。虽然这会隐藏我不想在脚注中显示的项目,但它也会在我希望显示 url 时隐藏它们。在下面的 MWE 中,我希望能够做的是保留全局选项,这样 book1 引用的 url 就不会显示,但能够在脚注和参考书目中显示 Nazzal2005 引用的 url。

\documentclass[12pt,a4paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{lipsum} % just for dummy text
\usepackage[notes, backend=biber, includeall=false,]{biblatex-chicago} %Sets Bibliography style.
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{book1,
address = {Anytown},
booktitle = {Example book},
pages = {5},
title = {{Any book you want}},
url = {http://www.amazon.com},
year = {2000}
}
@article{EPost11/12/1915,
Entrysubtype = {magazine},
address = {Wellington},
journal = {Evening Post},
keywords = {primary},
day = {11},
month = dec,
pages = {5},
title = {{Exiled Samoans}},
year = {1915}
}
@misc{Nazzal2005,
author = {Nazzal, Mary},
number = {April},
title = {{Nauru : An Environment Destroyed and International Law}},
url = {http://www.lawanddevelopment.org/articles/nauru.html},
urldate = {2014-03-18},
year = {2005}
}

\end{filecontents*}

\addbibresource{\jobname} % if you’re using biblatex
\begin{document}

\lipsum[1]\autocite{Nazzal2005}

\lipsum[1]\autocite{EPost11/12/1915}

\lipsum[1]\autocite{book1}

\printbibliography
\end{document}

答案1

你可以做类似的事情

\newbibmacro*{bib+doi+url}{% 16th ed.
  \iffieldundef{urlyear}%
    {}%
    {\printurldate}% Date fix
  \iffieldundef{addendum}% Punctuation fixes in 0.9.9c
    { \newunit\newblock}%
    {\newcunit\newblock}%
  \iftoggle{cms@doionly}%
    {\iffieldundef{doi}%
       {}%
       {\printfield{doi}%
        \setunit*{\addperiod\addspace}\newblock%
        \clearfield{url}}}%
    {\ifboolexpr{%
        togl {cms@doi}%
        and
        not test {\iffieldundef{doi}}%
     }%
       {\printfield{doi}%
        \setunit*{\addperiod\addspace}\newblock}%
       {}}%
  \ifboolexpr{%
    togl {cms@eprint}%
    and
    not test {\iffieldundef{eprint}}%
  }%
    {\usebibmacro{eprint}%
     \setunit*{\addperiod\addspace}\newblock}%
    {}%
  \ifboolexpr{%
    (togl {cms@url} or test {\ifentrytype{misc}})
    and
    not test {\iffieldundef{url}}%
  }%
    {\printfield{url}}%
    {}}%

\newbibmacro*{cite+doi+url}{% 16th ed.
  \iffieldundef{urlyear}%
    {}%
    {\printurldate}% Date fix
  \newcunit\newblock
  \iftoggle{cms@doionly}%
    {\iffieldundef{doi}%
       {}%
       {\printfield{doi}%
        \clearfield{url}}}%
    {\ifboolexpr{%
      togl {cms@doi}%
      and
      not test {\iffieldundef{doi}}%
     }%
       {\printfield{doi}}%
       {}}%
  \newcunit\newblock
  \ifboolexpr{%
    togl {cms@eprint}%
    and
    not test {\iffieldundef{eprint}}%
  }%
    {\usebibmacro{eprint}}%
    {}%
  \newcunit\newblock
  \ifboolexpr{%
    (togl {cms@url} or test {\ifentrytype{misc}})
    and
    not test {\iffieldundef{url}}%
  }%
    {\printfield{url}}%
    {}}%

这实际上使@misc条目忽略cms@url由 设置为 false 的切换includeall=false。您可以添加您喜欢的任何其他类型,例如,通过替换为@online始终打印其 URL(togl {cms@url} or test {\ifentrytype{misc}})

(togl {cms@url} or test {\ifentrytype{misc}} or test {\ifentrytype{online}})

或者,我们可以选择includeall=true删除您不想要的 URL。

\AtEveryBibitem{\ifentrytype{misc}{}{\clearfield{url}}}
\AtEveryCitekey{\ifentrytype{misc}{}{\clearfield{url}}}

如果您想要更多类型,请使用

\AtEveryBibitem{%
  \ifboolexpr{test {\ifentrytype{misc}} or test {\ifentrytype{online}}}
    {}
    {\clearfield{url}}}
\AtEveryCitekey{%
  \ifboolexpr{test {\ifentrytype{misc}} or test {\ifentrytype{online}}}
    {}
    {\clearfield{url}}}

指定要保存 URL 的位置,或者使用

\AtEveryBibitem{%
  \ifboolexpr{test {\ifentrytype{article}} or test {\ifentrytype{book}}}
    {\clearfield{url}}
    {}}
\AtEveryCitekey{%
  \ifboolexpr{test {\ifentrytype{article}} or test {\ifentrytype{book}}}
    {\clearfield{url}}
    {}}

指定删除 URL 的位置。

相关内容