# Error with URL in bibliography, TeX capacity exceeded

When I try to add the following Website to my bibliography I get an error, that TeX capacity is exceeded. I would be very thankful for your help. I integrated it into a file with JabRef. After this, you will find my main file. If you need anything else, feel free to ask.

@Misc{uni.utah.mm,
author = {Peter Alfeld},
note   = {[Online; Stand 10.08.2020]},
title  = {The Mandelbrot Set.},
url    = "\url{https://www.math.utah.edu/~alfeld/math/mandelbrot/mandelbrot.html}",
}

\documentclass[12pt, a4paper, bibliography=totocnumbered]{scrartcl}

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{tabularx}
\usepackage[bottom, perpage]{footmisc}
\usepackage{amsmath, amssymb}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{transparent}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[onehalfspacing]{setspace}
\captionsetup[figure]{font=small,labelfont=small}
\newcommand*{\captionsource}[2]{%
\caption[{#1}]{%
#1%
\\\hspace{\linewidth}%
\textbf{Quelle:} #2%
}%
}
\usepackage{float}
\usepackage[printonlyused]{acronym}
\usepackage[
pdftitle={Maturitätsarbeit - Die Darstellung Mandelbrot-artiger Mengen im dreidimensionalen Raum},
urlcolor=blue,
citecolor=black
]{hyperref}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
\makeatletter
\def\thickhline{%
\noalign{\ifnum0=}\fi\hrule \@height \thickarrayrulewidth \futurelet
\reserved@a\@xthickhline}
\def\@xthickhline{\ifx\reserved@a\thickhline
\vskip\doublerulesep
\vskip-\thickarrayrulewidth
\fi
\ifnum0={\fi}}
\makeatother
\renewcommand{\arraystretch}{1.3}
\bibliographystyle{unsrtdin}
\setcounter{secnumdepth}{8}
\newlength{\thickarrayrulewidth}
\setlength{\thickarrayrulewidth}{2\arrayrulewidth}
\setlength{\parindent}{0pt}

\makeindex

\urlstyle{same}
\usepackage[a4paper,left=2cm,right=2cm,top=3cm,bottom=3cm]{geometry}
\clearpairofpagestyles
\ofoot{\small \pagemark}
\renewcommand*{\sectionmark}[1]{%
\markright{\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat}{}#1}}%
}

\begin{document}
\font\myfont=cmr16
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}

\begin{singlespace}
\subject{\large Maturitätsarbeit}
\title{\Large Die Darstellung Mandelbrot-artiger Mengen im dreidimensionalen Raum}
\end{singlespace}
\maketitle
\hrule
\newpage

\tableofcontents
\newpage

\listoffigures
\newpage

\begin{acronym}
\acro{mm}[MM]{Mandelbrot-Menge}
\end{acronym}
\pagebreak

\input{vorwort.tex}
\pagebreak
\input{einleitung.tex}
\newpage
\bibliography{literatur}
\end{document}


The exact error message is

! TeX capacity exceeded, sorry [input stack size=5000].\@makeother #1->\catcode #112\relax .../~alfeld/math/mandelbrot/mandelbrot.html}}

• For most BibTeX styles you should not use \url inside a url field. url = "https://www.math.utah.edu/~alfeld/math/mandelbrot/mandelbrot.html", should be enough. (See also tex.stackexchange.com/q/455698/35864, which came up again just a few minutes ago.) – moewe Aug 10 at 15:01
• Unrelated, but for most uses \usepackage[utf8]{inputenc} is more than enough and \usepackage[utf8x]{inputenc} is overkill. Since \usepackage[utf8x]{inputenc} loads ucs you don't need to say \usepackage{ucs} in any case. The problem with utf8x/ucs is that it is incompatible with some packages. – moewe Aug 10 at 15:04
• @moewe is exactly right. I've just tried it and it works. This has to be changed in your bib-file: url = {https://www.math.utah.edu/~alfeld/math/mandelbrot/mandelbrot.html},. – phil-elkabat Aug 10 at 15:09
• @phil-elkabat Well, I wouldn't outright say that switching to biblatex would be 'better' (and I would be biased anyway). There are certainly good reasons to switch to biblatex (biblatex is usually easier to customise, supports Unicode properly, ...), but there are also equally good reasons to stick with BibTeX (publishers and the arXiv are not too keen on biblatex, there are many, many ready-made BibTeX styles out there, ...). It all depends on the specific situation. ... – moewe Aug 10 at 15:25
• ... You could certainly achieve a qualitatively similar result, but getting the exact same output as \bibliographystyle{unsrtdin} with biblatex would take some work. – moewe Aug 10 at 15:25

The first BibTeX styles predate the standardisation of the URL protocol by a few years. This means that the base BibTeX styles do not have a dedicated url field. Newer styles may support a url field, but the exact implementation and handling of that field is not uniform across styles.

With most styles that support a url field, however, the rule is to give the URL without change and without additional markup, since they interface with url/hyperref (or can more or less easily be made to interface with these packages). You don't need to wrap the URL in \url{...} when it is given in the url field and you do not need to escape otherwise special characters like % or _.

This is true for your style unsrtdin, which interfaces with url and hyperref and accepts URLs as-is. Just give the URL as

url = {https://www.math.utah.edu/~alfeld/math/mandelbrot/mandelbrot.html},


You may have to delete the temporary .bbl file after you fixed the .bib file, because the old code from the unfixed .bib file may live on in the .bbl file. (The procedure of generating a bibliography and the role of the .bbl file is explained wonderfully in Question mark or bold citation key instead of citation number if you want to know more.)

In full (note that the MWE crates the .bib file via filecontents, that is just to make the example self-contained, in a real-world document the .bib file would live outside the .tex file)

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{hyperref}

\bibliographystyle{unsrtdin}

\begin{filecontents}{\jobname.bib}
@misc{uni.utah.mm,
author = {Peter Alfeld},
note   = {[Online; Stand 10.08.2020]},
title  = {The Mandelbrot Set},
url    = {https://www.math.utah.edu/~alfeld/math/mandelbrot/mandelbrot.html},
}
\end{filecontents}

\begin{document}
\cite{uni.utah.mm}
\bibliography{\jobname}
\end{document}


It should be noted that unsrtdin (as part of the din1505 style bundle) implements a DIN 1505-2-compliant citation style. The German standard DIN 1505-2 (from 1984) was replaced by DIN ISO 690 in 2013 and makes some (in my eyes at least) questionable typographic decisions. If you are not forced to use that style, you may want to look for something else.

• First of all, thank you a lot for your answer. I do have the .bib file separate. I did remove the \url{...} but I still have the same error... – major.hph Aug 11 at 12:17
• @JanHochstrasser Did you remove the .bbl file before you recompiled? (The bibliography data is not directly read by LaTeX, instead the helper program BibTeX reads the .bib file and generates LaTeX-readable data in the .bbl file. The .bbl file is then read and typeset by LaTeX. See more in tex.stackexchange.com/q/63852/35864. That means that if there is an error in the .bib file it may hang around in the .bbl file even after it has been fixed. In that case it helps to delete the .bbl and probably also .aux` files and compile again.) – moewe Aug 11 at 14:57
• Thank you a lot! Now I could solve my problem and can continue to write my paper. – major.hph Aug 12 at 10:33
• @major.hph If the answer helped you solve ypour problem you may want to consider accepting it by clicking on the green checkmark on the top left. See tex.stackexchange.com/help/someone-answers. That will mark the question as resolved. – moewe Aug 12 at 15:00
• Sure! Sorry, I am new to StackExchange and didn't know. – major.hph Aug 13 at 20:58