TransWikia.com

Modifying `trad-alpha` to remove year from the bibliography item

TeX - LaTeX Asked on October 13, 2020

I have this minimal working example:

documentclass{book}
usepackage{filecontents}
begin{filecontents}{chapterref.dbx}
DeclareDatamodelFields[type=field,datatype=literal]{
  shortdesc,
}
DeclareDatamodelEntryfields{shortdesc}
end{filecontents}

usepackage[backref, refsegment=chapter, datamodel=chapterref, 
style=trad-alpha % https://tex.stackexchange.com/a/69706/38244
]{biblatex}
usepackage[colorlinks]{hyperref}

begin{filecontents}{jobname.bib}
@misc{A01,
  author    = {Author, A. and Duthor, D.},
  year      = {2001},
  title     = {Alpha},
  shortdesc = {Conference1},
}


@misc{N02,
    author = {Nuthor, C.},
    title = {New title},
    year = {2001},
}

@misc{N03,
    author = {Nuthor, C},
    title = {More new title},
    year = {2000},
}
end{filecontents}

addbibresource{jobname.bib}


begin{document}
  chapter{First Chapter}
  Some more text cite{A01}. More citation cite{N02} and again cite{N03}


  printbibliography
end{document}

It produces:

cite-year

and

bib-year

What I am looking for is to remove the years from the bibliography items (highlighted in yellow) together with the immediate comma before, while keeping the rest as it are. The year is kind of redundant (as the year is already mentioned in the cite item {luckiliy, I don’t have to cite any paper more than 100 years old}).

Any advice will be appreciated.

EDIT.
As explained by @AlanMunn’s comments, the linked question is significantly different. In that case, the other person asked for removing the duplicate year (which are suffixed by a, b etc.). In my case, I would like to remove the year from the bibliography key.

EDIT 2. (Also commented by @AlanMunn) I am still getting the same result as before with the accepted answer of the linked question.

One Answer

You can redefine the bibliography macro date to print nothing. This is the method used by the authoryear standard styles to avoid printing the year twice.

documentclass{article}

usepackage[style=trad-alpha]{biblatex}
usepackage[colorlinks]{hyperref}

renewbibmacro*{date}{}

addbibresource{biblatex-examples.bib}

begin{document}
  Some more text autocite{sigfridsson,worman,geer,nussbaum}.
  printbibliography
end{document}

Bibliography without date


AtEveryBibitem{clearfield{year}}

as mentioned in the comments by Alan Munn and Marijn should also work here.

Note that AtEveryBibitem will not suppress the year in a fullcite citation, so there you would need

AtEveryCitekey{clearfield{year}}

as well.

I usually prefer to use clearfield only as a last resort and prefer source mapping (where the data is not even used by Biber, this is not an option here) or clearing the field with an input handler. A more detailed comparison of the several ways to suppress fields can be found in How to omit address field while using biblatex, Remove title in biblatex references.

In this case I found it natural to simply redefine the bibmacro that would print the date to do nothing, since this is what the authoryear styles do in a similar situation, but this might not always be easily possible. If the styles had been different one might have had to redefine several different macros, at which point a different solution might have become more attractive.

Correct answer by moewe on October 13, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP