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

推荐订阅源

F
Fortinet All Blogs
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
宝玉的分享
宝玉的分享
T
Tenable Blog
WordPress大学
WordPress大学
K
Kaspersky official blog
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hacker News - Newest:
Hacker News - Newest: "LLM"
P
Palo Alto Networks Blog
Help Net Security
Help Net Security
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com
A
Arctic Wolf
Forbes - Security
Forbes - Security
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
H
Hacker News: Front Page
W
WeLiveSecurity
博客园 - 【当耐特】
G
Google Developers Blog
Martin Fowler
Martin Fowler
TaoSecurity Blog
TaoSecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
N
Netflix TechBlog - Medium
C
Cisco Blogs
I
Intezer
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
L
Lohrmann on Cybersecurity
Engineering at Meta
Engineering at Meta

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