0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LaTeXにて、図のrefの値がずれてしまう問題を解決する

Last updated at Posted at 2025-01-05

どんな問題

次のような図を挿入した。

  \begin{figure}[htbp]
    \includegraphics[width=7cm]{img/capture.png}
    \label{fig:Viewerの画面キャプチャ}
    \caption{Viewerの画面キャプチャ}
  \end{figure}

次に、この画像を参照した。

  Viewerは、ユーザがアプリケーションを直感的に操作できるフロントエンド部分を担う。
  (図.\ref{fig:Viewerの画面キャプチャ})

画像のキャプションは問題なく生成された。

Screenshot 2025-01-05 at 15.13.54.png

しかし、生成された文章は次のようになった。

Screenshot 2025-01-05 at 15.13.24.png

$ref$の値がずれてしまったのだ。何度確認しても、$label$の値は合っている。

解決

$label$を$caption$の次の行に記述する。

  \begin{figure}[htbp]
    \includegraphics[width=7cm]{img/capture.png}
    \caption{Viewerの画面キャプチャ}
    \label{fig:Viewerの画面キャプチャ}
  \end{figure}

結果

Screenshot 2025-01-05 at 15.16.15.png

問題なく参照されるようになった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?