You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX使用\ref{}引用图片时显示(??)的原因及解决方法

Overleaf中\ref{}引用图片显示(??)但可跳转的问题解决

问题核心原因

你遇到的问题本质是**figure环境未添加\caption命令**。LaTeX里,\label需要绑定到一个带编号的元素上才会生效,而figure只有在存在\caption时才会被系统分配编号。虽然PDF的跳转锚点已经生成(所以点击(??)能定位到图片),但没有编号的情况下,\ref无法获取到对应编号值,只能显示(??)。

修复方法

  1. 为figure添加标题并调整\label位置
    在figure环境内加入\caption命令,并且把\label放在\caption之后(确保标签绑定到正确的编号元素上)。修改后的代码示例:

    The figure (\ref{fig:20_25A}).
    
    \begin{figure}[!h]
        \centering
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/200.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/205.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/210.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/215.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/220.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/225.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/230.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.49\textwidth}
            \includegraphics[width=\textwidth]{TaskB_20-25/235.png}
        \end{subfigure}
        \caption{20-25A系列结果图} % 添加标题,可自定义内容
        \label{fig:20_25A} % 放在caption之后确保绑定正确编号
    \end{figure}
    
  2. 确保完整编译
    Overleaf一般会自动处理编译顺序,但如果修改后仍有问题,手动点击顶部「Recompile」按钮两次,让系统读取生成的编号辅助文件(.aux),完成交叉引用的解析。

额外技巧

如果不需要显示可见的标题,可以使用空标题\caption{},这样figure依然会生成编号,但文档中不会显示标题内容,\ref也能正常获取到编号。

内容的提问来源于stack exchange,提问作者ArvidSteen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 08:12:14