4
4

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 5 years have passed since last update.

not-used-fig.rb: LaTeX処理で実際には使わなかった画像ファイルの一覧を得るRubyスクリプト

Posted at

背景

  • LaTeX を使っている。
  • その文書中に入れる図版用の画像ファイルは専用の画像ディレクトリにまとめている。
  • 最初は使うと思っていた画像ファイルが、校正の途中で不要になることがよくある。
  • その結果、画像ディレクトリに、使うファイルと使わないファイルが混在する。

問題

  • 使っているのに存在しないならLaTeX処理中にエラーになってくれるが、使わない画像ファイルがあってもエラーにはならない。
  • その結果、使わない画像ファイルを消したくても、それを見つけることが難しい。

解法

  • LaTeX処理で出力されるログファイルを調べて、実際に使っている画像ファイルの一覧を得る。
  • 一方、画像ディレクトリ中の画像ファイルの一覧を得る。
  • 両者を比較することで、使わない画像ファイルの一覧を得ることができる。
  • Rubyスクリプト not-used-fig.rb ではこの解法を実現している。
4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?