1

So I have a mendeley profile in which I created the bib file for my thesis. For multiple papers i provided multiple URLs (e.g. arxiv and a github repo).

When I cite a paper with multiple URLs the URL key in the bibliogrpahy is messed up. Specifically there is no space inbetween the 2 URLs and on top the link is not correct.

Is there a way to fix this ?

Sample for a bib entry:

@article{ControlNet,
    title = {{Adding Conditional Control to Text-to-Image Diffusion Models}},
    year = {2023},
    author = {Zhang, Lvmin and Rao, Anyi and Agrawala, Maneesh},
    month = {2},
    url = {http://arxiv.org/abs/2302.05543 https://github.com/lllyasviel/ControlNet},
    arxivId = {2302.05543}
}

biblatex setup:

\usepackage[style=numeric]{biblatex}
\addbibresource{references.bib}

citation:

\cite{ControlNet}

results: Unseperated URLs and incorrect links

============= EDIT

Adapted accordingly to the link provided in the comments: github.com/plk/biblatex/issues/229#issuecomment-279766334

bibtex setup looks like:

%% Setup Bibliography
\usepackage[style=numeric, datamodel=urls]{biblatex}

\DeclareListFormat{urls}{%
  \url{#1}%
  \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
    {}}

\renewbibmacro*{url}{\iffieldundef{url}{\printlist{urls}}{\printfield{url}}}

\addbibresource{references.bib}

urls.dbx file:

\DeclareDatamodelFields[type=list, datatype=uri]{urls}
\DeclareDatamodelEntryfields{urls}

Problem still remaining - what am i doing wrong ?

7
  • 2
    url can hold only one url. If you want more you must define a new list field and change the bib macros so that they use it. see github.com/plk/biblatex/issues/1304 and github.com/plk/biblatex/issues/229#issuecomment-279766334 Sep 20 at 12:00
  • In the second link you provided the urls.dbx is modified. Since I'm working on overleaf I can't edit any files except for the tex files. Or am I misunderstanding something.
    – Chris
    Sep 20 at 12:18
  • urls.dbx is a file that you can create yourself. Sep 20 at 12:25
  • @UlrikeFischer edited the question to have current state - problem still remains
    – Chris
    Sep 20 at 12:43
  • 1
    @Mico thanks for the advise! Will change.
    – Chris
    Sep 20 at 13:31

1 Answer 1

2

Works only for URLs devided by a space.

\documentclass[paper=a5,DIV=16,parskip=half-,fontsize=10pt]{scrreprt}
\usepackage[british]{babel}
\usepackage[autostyle]{csquotes}
\begin{filecontents}[force,noheader]{\jobname.bib}
@article{ControlNet,
    title = {{Adding Conditional Control to Text-to-Image Diffusion Models}},
    year = {2023},
    author = {Zhang, Lvmin and Rao, Anyi and Agrawala, Maneesh},
    month = {2},
    url = {http://arxiv.org/abs/2302.05543 https://github.com/lllyasviel/ControlNet},
    arxivId = {2302.05543}
}\end{filecontents}
\usepackage[style=authoryear]{biblatex}

\def\URLA#1 #2 #3!!{\url{#1}\ifx\relax#2\relax\else, \url{#2}\fi
  \ifx\relax#3\relax \else, \URLA#3 !!\fi}

\DeclareFieldFormat{url}{%
  \mkbibacro{URL}(s)\addcolon\addspace
  \begingroup\edef\x{\endgroup\noexpand\URLA\thefield{urlraw} !!}\x}

\addbibresource{\jobname.bib}
\begin{document}
\cite{ControlNet}
\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

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