2

For my master thesis I use the apacite style to cite my sources. However, I always get the error "" when I have an entry in my literature.bib file with url or doi.

Here is what I have:

In main.tex:

\usepackage[hidelinks]{hyperref}
\usepackage{breakurl}
\usepackage{url}

\usepackage[natbibapa]{apacite}  
\bibliographystyle{apacite}   

In literature.bib:

@misc{Severt2022,
    author = {Natalie Severt},
    title = {An Introduction to Recommender Systems (+9 Easy Examples) | Iterators},
    url = {https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples},
    howpublished = {\url{https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples}},
    day = {16},
    month = {08},
    year = {2022},
    note = {Accessed on 12/11/2022},
}

The error:

Missing number, treated as zero.

<to be read again> 
                   \protect 
l.249 ...tion-recommender-systems-9-easy-examples}
                                                  }.
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \protect 
l.249 ...tion-recommender-systems-9-easy-examples}
                                                  }.
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

What the output looks like:

Severt, N. (2022, 16. 08). An introduction to recommender systems (+9 easy examples) | iterators. ’https://www"2Eiteratorshq"2Ecom/blog/an"2Dintroduction "2Drecommender"2Dsystems"2D9"2Deasy"2Dexamples’. Zugriff auf https:// www"2Eiteratorshq"2Ecom/blog/an"2Dintroduction"2Drecommender"2Dsystems "2D9"2Deasy"2Dexamples ((Accessed on 12/11/2022))

All the special characters are changed in something like "2E or something and I do not know why.

What it should look like:

Severt, N. (2022, 16. 08). An introduction to recommender systems (+9 easy examples) | iterators. https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples ((Accessed on 12/11/2022))

3
  • Welcome to TeX.SE.
    – Mico
    Dec 11, 2022 at 20:09
  • Please tell us which TeX distribution you employ and when you last updated it.
    – Mico
    Dec 11, 2022 at 20:15
  • I use overleaf in the cloud Dec 12, 2022 at 20:07

1 Answer 1

0

When using the apacite citation management package and eponymous bibliography style, I think it makes little sense -- actually, no sense -- to provide both a url and a howpublished field for entries of type @misc.

I further think that there's nothing to be gained from loading the breakurl package; instead, be sure to load the xurl package, which allows LaTeX to insert line breaks anywhere in long URL strings.

enter image description here

\documentclass{article} % or some other suitable document class

%% Change 'howpublished' field to 'xxhowpublished' (BibTeX ignores
%% unknown field types)
\begin{filecontents}[overwrite]{literature.bib}
@misc{Severt2022,
    author = {Natalie Severt},
    title  = {An Introduction to Recommender Systems (+9 Easy Examples)},
    url    = {https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples},
    xxhowpublished = {\url{https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples}},
    day    = {16},
    month  = {08},
    year   = {2022},
    note   = {Accessed on 12/11/2022},
}
\end{filecontents}

\usepackage[T1]{fontenc}

\usepackage[natbibapa]{apacite}  
\bibliographystyle{apacite} 

\usepackage{xurl} % <-- new
\usepackage[hidelinks]{hyperref}

\begin{document}
\noindent
\citet{Severt2022}
\bibliography{literature}
\end{document}
2
  • no, still same error Dec 12, 2022 at 20:08
  • @LukasReitbauer - My code does not generate an error. If your code does, it must differ in some essential way from mine. Sadly -- though probably not surprisingly -- my mind-reading abilities are just worthless. Chances that I will somehow manage to guess what's going in your code are nil unless you provide some actionable information. Writing "still same error" is not actionable information. And I just checked: The code I posted compiles just fine on Overleaf.
    – Mico
    Dec 12, 2022 at 21:05

You must log in to answer this question.

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