0

I'm trying to get rid of the comma that's in between the url and the url date. I'm using

\DeclareFieldFormat{urldate}{%
    [letzter Zugriff: %
    \thefield{urlday}.
    \thefield{urlmonth}.
    \thefield{urlyear}\isdot]}

to get the urldate to show up as I want it to. The output with the link in front of it looks like this: enter image description here What I want is to get rid of the comma before the open square bracket. My MWE looks like this:

%!TEX program = lualatex 
\documentclass[a4paper, 11pt]{article}
\usepackage[a4paper,left=3cm,right=2.7cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{polyglossia} 
\usepackage{fontspec} 

\usepackage{setspace} %Zeilenabstand auf 1.5
\setstretch{1.4}

\setdefaultlanguage[spelling=new]{german}
\setmainfont{Arial} 
\setlength{\emergencystretch}{2pt} 

\usepackage[style=authoryear-ibid,backend=biber, natbib=true, dashed=false, doi=false, isbn=false, eprint=false]{biblatex} % , block=ragged
\addbibresource{verzeichnis.bib}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space} % Doppelpunkt nach Jahr in Literaturverzeichnis, 
\renewcommand*{\newunitpunct}{\addcomma\space} 

\DeclareFieldFormat{urldate}{%
    [letzter Zugriff: %
    \thefield{urlday}.%\addspace     %  addcomma works !!!
    \thefield{urlmonth}.%\addspace%
    \thefield{urlyear}\isdot]}

%%%Für klickbare ToC
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black,
    breaklinks=true
}

\begin{document}
   ....
  \nocite{*}
  \begingroup
  \raggedright
  \sloppy
  \printbibliography
  \endgroup
 
\end{document}

Bibliography:

@misc{Born.04.05.2020,
 author = {Frobeen, Anne},
 year = {04.05.2020},
 title = {Lernen im Schlaf: - ein Inter­view mit Schlaf­for­scher Jan Born},
 address = {in: https://www.tk.de/techniker/magazin/life-balance/besser-schlafen/schlaf-lernen-gedaechtnis-interview-jan-born-2059292},
 urldate = {2021-02-20}
}
5
  • Please provide a [MWEB]{tex.meta.stackexchange.com/questions/4407/…}. Without this we are only guessing your set up. The way you are formatting your urldate is not the way to do this. Commented Feb 28, 2021 at 22:11
  • @DavidPurton thank you, just added it.
    – Emkay
    Commented Feb 28, 2021 at 22:18
  • Do you always have "in: " before a URL? Or just sometimes? Commented Feb 28, 2021 at 22:21
  • I've added it in front of every URL because I've been unable to find a soulution where I can put an "in" there and this seemed to work fine
    – Emkay
    Commented Feb 28, 2021 at 22:23
  • I really cannot emphasise how much better the answer you got is than the definition of the urldate field format shown in the question: It is usually much better to use bibstrings than to hard-code text and the definition shown in the question completely disables all of biblatex's carefully crafted date handling and replaces it with a very basic approximation of manual date printing. If you got more biblatex advice from the same source you got that code from, you may want to reconsider that as well.
    – moewe
    Commented Mar 1, 2021 at 7:37

1 Answer 1

1

I suggest a number of changes:

  • Use the date=short option so you use the proper format for the date field (your current format is not valid).
  • Use an @online type, not @misc.
  • Use the url field, not the address field which will cause you problems if the URL has special characters.
  • Redefine the urlseen string rather than hard coding it in the urldate format.
  • Use \mkbibbrackets in your urldate format to get square brackets.
  • Redefine the url format for online entries to insert "in: ".

If you do all this, then the comma before the urldate will go away by itself. You are getting it because you are abusing the address field to hold a URL.

MWE

%! TeX Program = lualatex
\documentclass{article}
\begin{filecontents}[overwrite]{\jobname.bib}
@online{frobeen2020,
  author = {Frobeen, Anne},
  date = {2020-05-04},
  title = {Lernen im Schlaf: - ein Inter­view mit Schlaf­for­scher Jan Born},
  url = {https://www.tk.de/techniker/magazin/life-balance/besser-schlafen/schlaf-lernen-gedaechtnis-interview-jan-born-2059292},
  urldate = {2021-02-02}
}
\end{filecontents}
\usepackage{fontspec} 
\usepackage{polyglossia} 
\usepackage{csquotes}
\setdefaultlanguage[spelling=new]{german}
\setmainfont{Arial}
\usepackage[style=authoryear-ibid, date=short]{biblatex}
\urlstyle{same}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DefineBibliographyStrings{german}{
  urlseen = {letzter Zugriff}
}
\DeclareFieldFormat[online]{url}{\bibstring{in}\intitlepunct\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

output

6
  • Thank you so much! This solved 2 problems of mine at once! Just a quick note, if someone is ever facing the same problem as me: If you're using Citavi or any other external software to manage your sources: Check your .bib file!
    – Emkay
    Commented Feb 28, 2021 at 22:43
  • I've noticed that now every kind of source (books, articles) include the "in". Is there a way to use it for @online sources only?
    – Emkay
    Commented Feb 28, 2021 at 23:06
  • @Emkay That's what I meant when I asked about do you always have "in: ". I'll make a change. Should books and articles use the standard "URL: " prefix? Or just plain? Commented Feb 28, 2021 at 23:34
  • Sorry, my bad. Books and articles have no URLs in document, so plain. Thank you very much.
    – Emkay
    Commented Feb 28, 2021 at 23:37
  • Try that. This is probably better. Doing like I did it before was buggy. Commented Feb 28, 2021 at 23:41

You must log in to answer this question.

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