惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google Online Security Blog
Google Online Security Blog
Help Net Security
Help Net Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Exploit Database - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security Affairs
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
月光博客
月光博客
博客园 - Franky
The GitHub Blog
The GitHub Blog
O
OpenAI News
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
V
Visual Studio Blog
爱范儿
爱范儿
S
Secure Thoughts
T
The Blog of Author Tim Ferriss
SecWiki News
SecWiki News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
J
Java Code Geeks
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
博客园_首页
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cisco Blogs
博客园 - 三生石上(FineUI控件)
Hacker News: Ask HN
Hacker News: Ask HN
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
人人都是产品经理
人人都是产品经理
腾讯CDC
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
The Last Watchdog
The Last Watchdog
博客园 - 叶小钗
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
罗磊的独立博客
有赞技术团队
有赞技术团队
B
Blog RSS Feed
L
LINUX DO - 最新话题

Super Blog

[译] 我所知道的全部智能体工程技巧(2026 年 6 月) 2024:悲观者正确,乐观者前行 Mac 终端无法联网问题解决 我和我的 2023 新起点 使用 Arc 浏览器自定义网页 我和我的 2022 Genius Bar 两日游 实训小记 《软件测试技术》笔记 Q-Learning 简介 软件测试技术实验 3 和 4 遇到的一些问题和解决方案 我和我的 2021 写过的第二个 App 在 SwiftUI 中自定义修饰器 关于最近,以及…… 《数据库原理》笔记 《数字逻辑与数字系统》笔记 《形式化方法》笔记 宣言
Overleaf LaTeX citation 无法正常显示问题解决
SUPER · 2024-12-26 · via Super Blog

神奇的 Overleaf。

问题

今天在用 Overleaf writing 的时候,使用 \cite{paper} 出现 ? 而非 ref 序号。main.tex 的具体内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@article{you2023,
author = {You},
title = {Overleaf is bad},
publisher = {Science},
year = 2023
}
@article{you2024,
author = {You},
title = {Overleaf is not what you need at all},
publisher = {Science},
year = 2024
}

\end{filecontents}

\begin{document}

Overleaf is bad~\cite{you2023}.

Overleaf is not what you need at all~\cite{you2024}.

DO NOT use Overleaf~\cite{you2024,you2023}.

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

显示效果为:

1
2
3
Overleaf is bad [?].
Overleaf is not what you need at all [?].
DO NOT use Overleaf [?, ?].

但十分奇怪的是,并不是开始时就出现此问题。当我新建项目并导入 TeX 文件时,Overleaf 可以正常编译并显示 ref 序号:

1
2
3
Overleaf is bad [1].
Overleaf is not what you need at all [2].
DO NOT use Overleaf [1, 2].

当删除 ref 内容再重新粘贴回去时,序号就会变为 ?,且重新编译不能解决。

于是搜索了一下相关问题,但并没有找到类似问题的讨论。尝试了清除缓存、检查并修改文件名、检查 sty 文件、调整文件路径、更换编译器等操作后,均无法解决此问题。

解决方案

Overleaf 内置的编译器(pdfLaTeXLaTeX)对 \jobname 的支持有问题,因此需要将隐式的 \jobname 替换为显式的文件名称。

main.tex 举例,需要将 \jobname 替换为 main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\usepackage{filecontents}

\begin{filecontents}{main.bib}

@article{you2023,
author = {You},
title = {Overleaf is bad},
publisher = {Science},
year = 2023
}
@article{you2024,
author = {You},
title = {Overleaf is not what you need at all},
publisher = {Science},
year = 2024
}

\end{filecontents}

\begin{document}

Overleaf is bad~\cite{you2023}.

Overleaf is not what you need at all~\cite{you2024}.

DO NOT use Overleaf~\cite{you2024,you2023}.

\bibliographystyle{plain}
\bibliography{main}

\end{document}

但如果只是这样替换,并无法解决问题。还需要在同目录下新建 main.bib 文件,将 \begin{filecontents}{main.bib}\end{filecontents} 之间的内容拷贝至 main.bib。此时可以删除 main.tex 中的对应内容。

此时,重新编译即可解决问题:

1
2
3
Overleaf is bad [1].
Overleaf is not what you need at all [2].
DO NOT use Overleaf [1, 2].