BibTeX, biblatex and biberBiblatex: How to suppress month in bibliography?

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Sleft
Posts: 16
Joined: Fri Nov 12, 2010 4:19 pm

Biblatex: How to suppress month in bibliography?

Post by Sleft »

Hello

I'm using biblatex. Is there any way to suppress the month in the bibliography without deleting months from the bib file? For example it prints:
Dretske, Fred I. (Dec. 24, 1970). “Epistemic Operators”. In: The Journal of Philosophy 67.24, pp. 1007–1023. issn: 0022362X. JSTOR: 2024710.
Instead I want it to print:
Dretske, Fred I. (1970). “Epistemic Operators”. In: The Journal of Philosophy 67.24, pp. 1007–1023. issn: 0022362X. JSTOR: 2024710.
Using the mergedate option is not what I mean.

Here's an example document:

Code: Select all

\documentclass{article}
\usepackage[english]{babel}
\usepackage[style=authoryear-comp]{biblatex}

\bibliography{testbib}

\begin{document}

\autocite[1011]{dretepop}

\printbibliography

\end{document}
And here's the bibliography for that example document:

Code: Select all

@Article{dretepop,
   title	= {Epistemic Operators},
   author	= {Fred I. Dretske},
   journaltitle	= {The Journal of Philosophy},
   volume	= {67},
   number	= {24},
   hyphenation	= {english},
   pages	= {1007--1023},
   pagination	= {page},
   eprint	= {2024710},
   eprinttype	= {jstor},
   issn		= {0022362X},
   date		= {1970-12-24}
   }
When searching for clues about this problem I found these unanswered posts:
Last edited by Sleft on Wed Jan 19, 2011 8:18 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Biblatex: How to suppress month in bibliography?

Post by localghost »

I think the easiest would be to replace the »date« with a »year« inside the concerned database entry.
Sleft
Posts: 16
Joined: Fri Nov 12, 2010 4:19 pm

Re: Biblatex: How to suppress month in bibliography?

Post by Sleft »

Ideally I do not want to do changes to the database since I'm gonna use it for other documents which might benefit from having more detailed dates than just the year.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Biblatex: How to suppress month in bibliography?

Post by localghost »

In this case the biblatex manual should have some information about that. At the moment I'm not so familiar with this package. Furthermore I'm actually using an older version but will upgrade soon. If I understand Section 2.3.8 right, the full date will always be printed with adaption to local settings. But it seems to be possible to only specify a year in this field. If all comes to nothing, you may send a support request to the package author. Feel free to report back with his answer.
Sleft
Posts: 16
Joined: Fri Nov 12, 2010 4:19 pm

Re: Biblatex: How to suppress month in bibliography?

Post by Sleft »

Yes, I can either edit all database entries with a more detailed date field than year (to just the year) or delete the date field and replace it with a year field. However I'd rather be able to suppress the month (and day) since I might need detailed dates for other documents.
Sleft
Posts: 16
Joined: Fri Nov 12, 2010 4:19 pm

Biblatex: How to suppress month in bibliography?

Post by Sleft »

I've in been contact with the package author. He was very helpful.

First he pointed to the mergedate option:
there is no option for suppressing the month (that would seem odd to me), but maybe the "mergedate" option is what you're actually looking for? mergedate=false won't suppress the month, but it will separate the year label from the date specification.
But I said that it wasn't what I was looking for and he offered two solutions. The first one being:
Then try this:

Code: Select all

---------- authoryear2.bbx ----------
\ProvidesFile{authoryear2.bbx}
\RequireBibliographyStyle{authoryear}
\DeclareBibliographyOption{tersedate}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{mergedate}%
     \booltrue{bbx:tersedate}}
    {\boolfalse{bbx:tersedate}}}
\newbool{bbx:tersedate}
\newbibmacro*{date+extrayear}{%
  \iffieldundef{year}
    {}
    {\printtext[parens]{%
       \ifboolexpr{
	 bool {bbx:mergedate} and
	 not bool {bbx:tersedate}
       }
	 {\printdateextra}
	 {\printfield{labelyear}%
          \printfield{extrayear}}}}}
----------------------------------------
Save it as authoryear2.bbx and load it like this:

Code: Select all

\usepackage[style=authoryear,bibstyle=authoryear2,tersedate]{biblatex}
The "tersedate" option will print the year only.
The second solution is:
You could also clear the fields you don't want printed:

Code: Select all

\AtEveryBibitem{%
  \clearfield{day}%
  \clearfield{month}%
  \clearfield{endday}%
  \clearfield{endmonth}%
}
I've only tried the second solution and it works alright. (The package author did not mind me posting the solutions here.)
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Biblatex: How to suppress month in bibliography?

Post by meho_r »

Thanks for posting these infos here, they're very useful.
Chriss
Posts: 1
Joined: Fri Apr 04, 2014 3:57 pm

Biblatex: How to suppress month in bibliography?

Post by Chriss »

Hi,

I'm not much of a LaTeX expert, but that's how I got around this issue - after hours of swearing... :roll:

Locate the bibliographystyle file (*.bst) that you are using. It will be located somewhere in your TeX/LaTeX implementation folder - e.g. MiKTeX 2.9\bibtex\bst\natbib\plainnat.bst

Save this file to your working folder giving a new file name (e.g. plainnat_nomonth.bst) and open it with a text editor.

Search for the function format.date, it looks somewhat like:

Code: Select all

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  extra.label *
}
Comment the lines as below:

Code: Select all

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
%  month empty$
%    'skip$
%    { month
%      " " * swap$ *
%    }
%  if$
  extra.label *
}
and save the file...

Now you can implement this bib-style by using

Code: Select all

\bibliographystyle{plainnat_nomonth}
I do have to admit that I'm not a 100% sure if this is the correct way to alter the format.date function, however, it does work without producing any errors.

Cheers,
Chriss
Post Reply