1

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.

hola
  • 4,026
  • 3
  • 35
  • 72
  • 3
    Not really a duplicate, although the method is similar. For this question you need \AtEveryBibitem{\clearfield{year}}. The linked question is getting rid of the a, b etc used in articles by the same author with the same year. – Alan Munn Jun 07 '19 at 21:10
  • 1
    @Marijn So did I. The linked answer only deletes extrayear (now called extradate so nothing should happen anyway) and there isn't any extradate/extrayear here to begin with. Things might work if you delete the year field, but then that's slightly different. – moewe Jun 07 '19 at 21:10
  • 3
    @Marijn No, even if the solution is similar the question really is completely different. And questions should be closed based on the question, not on the similarity of answers. – Alan Munn Jun 07 '19 at 21:26
  • I'm not sure why you've added the extra example. Both @moewe and I have pointed out that it doesn't do what you want. And the moewe's answer here does do what you want (as would the answer I gave in my comment.) – Alan Munn Jun 07 '19 at 22:54
  • @AlanMunn Alright, I'll remove it. I saw Marijn's comment that "yes it does, I tried it myself :)", so I was confused whether I was missing something. – hola Jun 07 '19 at 22:56
  • @pushpen.paul I'll try to explain a bit. The other question asked how to remove an element from the bibliography items, and so did your question. The answer to that other question was to use \clearfield{that element} and also for your question this is a solution. That is why I voted as duplicate, after I tried it myself and verified that the solution indeed works on your MWE. The difference is that 1. the element is different and 2. the element in the other question is automatically generated (the a, b suffix) and this one is not. So the thing you were missing is that you needed to change – Marijn Jun 08 '19 at 12:23
  • the element from extrayear to year, which was readily identified by the comment of @AlanMunn. – Marijn Jun 08 '19 at 12:24
  • @Marijn OK, I got it... Still, both the questions are different, regardless of how close the solutions are... I mean, for a novice like me, it's next to impossible to figure out the other solution (with a tweak) may work in my case... – hola Jun 08 '19 at 15:50

1 Answers1

3

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.

moewe
  • 175,683
  • 1
    What's the advantage of this over \AtEveryBibitem{\clearfield{year}}? – Alan Munn Jun 07 '19 at 21:13
  • 1
    @AlanMunn A matter of taste I would say. I prefer this method, because that's what the standard authoryear styles do in a (remotely) similar situation. Plus, I prefer to use \clearfield only when it can't be avoided (usually I think \DeclareSourcemap is nicer). \clearfield{year} might have the advantage that the year really is gone, but with biblatex-trad that is more of a theoretical issue... – moewe Jun 07 '19 at 21:20
  • When using \fullcite it might be preferred not to remove the year at every cite key, the reason to remove the year is to avoid redundancy of the year information in the key and in the entry itself, but in a \fullcite the key is not printed. That would also be an argument to prefer \clearfield over renewing date, i.e., to preserve \fullcite output. – Marijn Jun 08 '19 at 14:54