0

I am using biblatex with IEEE and I am getting dates with and without brackets around them, depending on which entry type I'm using (such as @journal, @online, @misc, etc).

I have tried searching through the biblatex documentation (https://ctan.uib.no/macros/latex/contrib/biblatex/doc/biblatex.pdf) and other forum posts, but never found the same problem. I have made a minimal working example which shows the date formats for the misc and online entry types. I prefer the first one which has no brackets.

Is there a way to customize the date format for all entry types, or individually, so that the brackets are removed?

MWE:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[style=ieee,dashed=false]{biblatex}
\begin{filecontents}{bibliography.bib}
@misc{source1,
    author = {Name Nameson},
    title = {Misc source},
    date = {2022-01-13},
    url = {google.com},
}
@online{source2,
    author = {Name Nameson},
    title = {Online source},
    date = {2022-01-13},
    url = {google.com},
}
\end{filecontents}
\addbibresource{bibliography.bib}

\begin{document}
This is the first source \cite{source1} and this is the second source \cite{source2}. 
\printbibliography
\end{document}

Which produces: enter image description here

1 Answer 1

0

Formatting questions like this are up to the style. In this case style=ieee, makes a difference between non-@online and @online dates. This is not something you will generally find discussed in the documentation (neither the style documentation and much less the biblatex documentation).

Assuming you want to get rid of the brackets, you can use the following patch. (There is no general rule for different styles that tells you what you need to do in order to change things like this. You will have to look at the code of the style in question. In this case the brackets are added by the \printtext[parens]{...} wrapper around \usebibmacro{date} in the @online driver.)

\documentclass{article}

\usepackage[style=ieee,dashed=false]{biblatex}

\usepackage{xpatch}
\xpatchbibdriver{online}
  {\printtext[parens]{\usebibmacro{date}}}
  {\usebibmacro{date}}
  {}{}


\begin{filecontents}{\jobname.bib}
@misc{source1,
  author = {Name Nameson},
  title  = {Misc source},
  date   = {2022-01-13},
  url    = {google.com},
}
@online{source2,
  author = {Name Nameson},
  title  = {Online source},
  date   = {2022-01-13},
  url    = {google.com},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
This is the first source \cite{source1} and this is the second source \cite{source2}. 
\printbibliography
\end{document}

N. Nameson, Misc source, Jan. 13, 2022. [Online]. Available: google.com.
N. Nameson. “Online source.” Jan. 13, 2022, [Online]. Available: google.com.


If you want to change the comma as well, use

\xpatchbibdriver{online}
  {\printtext[parens]{\usebibmacro{date}}%
   \newunit\newblock}
  {\usebibmacro{date}%
   \setunit{\addperiod\space}\newblock}
  {}{}

instead.

2
  • Excellent, thank you, @moewe! This is exactly what I was looking for. Do you also happen to know if there is a way to change the comma after the date to a period?
    – simonova
    Jan 20, 2022 at 7:25
  • @simonova Have a look at the edit, please.
    – moewe
    Jan 20, 2022 at 15:19

You must log in to answer this question.

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