1

For an undated website I would like to remove (n.d.) from the citation and the reference. I tried to adapt the solution here to biblatex-chicago but I guess it is some other macros which will need to be redefined:

\documentclass{article}
\usepackage[authordate,backend=biber,indexing=true]{biblatex-chicago}
%\usepackage[style=authoryear-comp]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}

\renewbibmacro*{date+extradate}{%
  \ifboolexpr{test {\iffieldundef{labelyear}}
    or (test {\iffieldequalstr{labelyear}{nodate}}
        and test {\ifentrytype{online}})}
    {}
    {\printtext[parens]{%
       \iflabeldateisdate
         {\printdateextra}
         {\printlabeldateextra}}}}

\renewbibmacro*{cite:labeldate+extradate}{%
  \ifboolexpr{test {\iffieldundef{labelyear}}
    or (test {\iffieldequalstr{labelyear}{nodate}}
        and test {\ifentrytype{online}})}
    {}
    {\printtext[bibhyperref]{\printlabeldateextra}}}

\begin{document}
\textcites{lennon}{google}
\printbibliography
\end{document}

enter image description here

3
  • But you want the "n.d" for the book, right?
    – moewe
    Jul 28, 2018 at 9:04
  • @moewe Ideally yes, but if it considerably simplifies the solution I could live without n.d. for books.
    – muk.li
    Jul 28, 2018 at 9:08
  • 1
    I'll see what I can do, highly customised styles like biblatex-chicago and biblatex-apa can be much harder to modify than the standard styles.
    – moewe
    Jul 28, 2018 at 9:39

1 Answer 1

1

For the "nodate" detection, biblatex-chicago treats a missing labelyear and an explicit literal nodate inserted by \DeclareLabeldate alike, so we can't use the improved answer to Remove "n.d." (no date) from online entries without dates in biblatex.

But biblatex-chicago has the option nodates (from the biblatex-chicago manual, p. 121)

nodates=true This option means that for all entry types except inreference, misc, and reference, biblatex-chicago will automatically provide \bibstring{nodates} for any entry that doesn’t otherwise provide a date for citations and for the heads of entries in the list of references. If you set nodates=false in your preamble, then the package won’t perform this substitution in any entry type whatsoever. (The bibstring expands to “n.d.” in English.)

Unfortunately, that option applies to all type (save for the three exception listed above), but we can make that option type specific with only a few lines of code. We then set nodate=false only for @online entries, while all other entries retain the default nodate=true.

\documentclass{article}
\usepackage[authordate,backend=biber,indexing=true]{biblatex-chicago}
%\usepackage[style=authoryear-comp]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    author = {Victor},
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\DeclareTypeOption[boolean]{nodates}[true]{%
  \settoggle{cms@nodates}{#1}}%

\ExecuteBibliographyOptions[online]{nodates=false}

\begin{document}
\textcites{lennon}{google}{baez/online}
\printbibliography
\end{document}

The citations read "Lennon (n.d.), “Google,” and Baez and Lauda (2004)". The bibliography entries now start with "Baez, John C., and Aaron D. Lauda. 2004. Higher....", "“Google.”", and "Lennon, John. n.d."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .