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

推荐订阅源

The Cloudflare Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
小众软件
小众软件
J
Java Code Geeks
V
Visual Studio Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
博客园 - 叶小钗
N
Netflix TechBlog - Medium
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
T
The Exploit Database - CXSecurity.com
The Hacker News
The Hacker News
Cisco Talos Blog
Cisco Talos Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
AWS News Blog
AWS News Blog
Webroot Blog
Webroot Blog
The Last Watchdog
The Last Watchdog
T
Threatpost
I
Intezer
T
Tenable Blog
L
LINUX DO - 热门话题
T
Tailwind CSS Blog
Scott Helme
Scott Helme
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
Engineering at Meta
Engineering at Meta
S
Schneier on Security
Recent Announcements
Recent Announcements
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Troy Hunt's Blog
量子位
H
Hacker News: Front Page
V2EX - 技术
V2EX - 技术
Google Online Security Blog
Google Online Security Blog
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
博客园 - Franky
www.infosecurity-magazine.com
www.infosecurity-magazine.com

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