[Tex/LaTex] biblatex and percent sign

biblatexurls

I am trying to switch to http://www.latextemplates.com/template/masters-doctoral-thesis in my masters thesis, and suddenly my bibliographic references are breaking everything, despite working fine before.

A MWE is: download the template, then

First, (in main.tex) Add Hi\cite{foo}. below \pagestyle{thesis}

Second, (in example.bib) Add

@misc{foo,
 title = {foo},
 howpublished = {\url{foo%x}},
}

somewhere.

Compile/bib/compile. It will give

Runaway argument?
{\url {foo\field {title}{foo} \endentry \par ...
... File ended while scanning use of \field.

i.e. the % will have been replaced with \field etc etc etc.

How can I stop that from happening?

Best Answer

Use the url field, as is shown in the exammple bibliography and as is explained in the documentation of biblatex. By the way, i recommend biber to do the sorting instead of BibTeX.

If your entry is solely an internet source, use the online entry type.

\begin{filecontents}{\jobname.bib}
    @online{percent,
        author  = {many},
        title   = {Percent sign},
        url     = {https://en.wikipedia.org/wiki/%25},
        urldate = {2016-07-18},
    }
    @online{urlsInBibEntries,
        author  = {Kalle},
        title   = {Bibtex and percent sign},
        url     = {http://tex.stackexchange.com/questions/319504/},
        date    = {2016-07-15},
        urldate = {2016-07-18},
    }
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber,
    style=numeric,
]{biblatex}
\addbibresource{\jobname.bib}%jobname NICHT ersetzen
\begin{document}

\cite{urlsInBibEntries}
\cite{percent}

\printbibliography
\end{document}