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?

More than 1 year has passed since last update.

\graphicspathでエラーが出た

Posted at

LaTeX2e 美文章作成入門 8版

を読んで試していて、つまづいたところ。

画像ファイルをLaTeXで読み込むとき\includegraphicsで読み込むけど、画像ファイルを.texではなくてディレクトリにまとめておいて、そこを\includegraphicsで読みに行くとき

プリアンブルに\graphicspath{}で画像がまとめてあるディレクトリを指定しておかないといけない。

書籍にはその例として

\graphicspath{{sub1}{sub2}}

と書いてあった。自分は画像をまとめている場所が1つなので、

\graphicspath{sub1}と書いて実行したが、エラーが出てしまう。

原因がわからず色々試していたが、画像をファイルに入れるのではなく、.texファイルと同じ場所に入れたらうまいこと動いた。

結局、sub1を挟むカッコが2つでないといけないことが原因だった。

本の例文では参照しに行くフォルダが2つだから、{{フォルダ1}{フォルダ2}}のように分けるためにカッコがついているのかと思ったが、一つだけでも2つのカッコで挟む必要があった。

エラーが
LaTeX Error: Cannot determine size of graphic in ⚪︎⚪︎ (no BoundingBox).
などと出ていたので、気づくのが難しかった。

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?