对于我的硕士论文,我使用该样式来引用我的资料来源。但是,当我的文件中有一个带有 url 或 doi 的apacite
条目时,我总是会收到错误“” 。literature.bib
以下是我所拥有的:
在 main.tex 中:
\usepackage[hidelinks]{hyperref}
\usepackage{breakurl}
\usepackage{url}
\usepackage[natbibapa]{apacite}
\bibliographystyle{apacite}
在 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},
}
错误:
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.)
输出如下:
Severt, N. (2022 年 8 月 16 日)。推荐系统简介 (+9 个简单示例) | 迭代器。'https://www
"2Eiteratorshq
"2Ecom/blog/an"2Dintroduction
"2Drecommender"2Dsystems
"2D9"2Deasy
"2Dexamples'。访问 https:// www"2Eiteratorshq
"2Ecom/blog/an"2Dintroduction
"2Drecommender"2Dsystems
"2D9"2Deasy
"2Dexamples ((访问日期 2022 年 11 月 12 日))
所有特殊字符都变成了类似"2E
这样的字符,我不知道为什么。
它看起来应该是这样的:
Severt, N. (2022, 16. 08)。推荐系统简介 (+9 个简单示例) | 迭代器。https://www.iteratorshq.com/blog/an-introduction-recommender-systems-9-easy-examples ((2022 年 11 月 12 日访问))
答案1
当使用apacite
引文管理包和同名参考书目样式时,我认为为类型条目提供url
和字段没有什么意义——实际上,没有任何意义。howpublished
@misc
我进一步认为加载该包没有任何好处breakurl
;相反,一定要加载该xurl
包,它允许 LaTeX 在长 URL 字符串的任何位置插入换行符。
\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}