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

推荐订阅源

S
Secure Thoughts
Apple Machine Learning Research
Apple Machine Learning Research
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
博客园_首页
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
The Cloudflare Blog
量子位
人人都是产品经理
人人都是产品经理
小众软件
小众软件
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
Attack and Defense Labs
Attack and Defense Labs
Hacker News: Ask HN
Hacker News: Ask HN
TaoSecurity Blog
TaoSecurity Blog
Forbes - Security
Forbes - Security
罗磊的独立博客
Webroot Blog
Webroot Blog
美团技术团队
Help Net Security
Help Net Security
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
C
Check Point Blog
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
Microsoft Azure Blog
Microsoft Azure Blog
AI
AI
Cloudbric
Cloudbric
Application and Cybersecurity Blog
Application and Cybersecurity Blog
W
WeLiveSecurity
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
B
Blog RSS Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LINUX DO - 热门话题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
O
OpenAI News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
Know Your Adversary
Know Your Adversary

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].