Skip to content

Instantly share code, notes, and snippets.

@yuw
Created August 29, 2023 10:10
Show Gist options
  • Save yuw/b47f3b7960585f5e97df014ad687f5d4 to your computer and use it in GitHub Desktop.
Save yuw/b47f3b7960585f5e97df014ad687f5d4 to your computer and use it in GitHub Desktop.
graphicsパッケージのdraftオプションでファイル名に加えて縦横のサイズを表示する
% from graphics.sty 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
\def\Gin@setfile#1#2#3{%
\ifx\\#2\\\Gread@false\fi
\ifGin@bbox\else
\ifGread@
\csname Gread@%
\expandafter\ifx\csname Gread@#1\endcsname\relax
eps%
\else
#1%
\fi
\endcsname{\Gin@base#2}%
\else
\Gin@nosize{#3}%
\fi
\fi
\Gin@viewport@code
\Gin@nat@height\Gin@ury bp%
\advance\Gin@nat@height-\Gin@lly bp%
\Gin@nat@width\Gin@urx bp%
\advance\Gin@nat@width-\Gin@llx bp%
\Gin@req@sizes
\expandafter\ifx\csname Ginclude@#1\endcsname\relax
\Gin@drafttrue
\expandafter\ifx\csname Gread@#1\endcsname\relax
\@latex@error{Can not include graphics of type: #1}\@ehc
\global\expandafter\let\csname Gread@#1\endcsname\@empty
\fi
\fi
\leavevmode
\ifGin@draft
\hb@xt@\Gin@req@width{%
\vrule\hss
\vbox to \Gin@req@height{%
\hrule \@width \Gin@req@width
\vss
\edef\@tempa{#3}%
\rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
\rlap{ \ttfamily height=\expandafter\the\Gin@req@height}%
\rlap{ \ttfamily width=\expandafter\the\Gin@req@width}%
\vss
\hrule}%
\hss\vrule}%
\else
\@addtofilelist{#3}%
\ProvidesFile{#3}[Graphic file (type #1)]%
\setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
\dp\z@\z@
\ht\z@\Gin@req@height
\wd\z@\Gin@req@width
\box\z@
\fi}
\endinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment