TransWikia.com

Redefine includegraphics* (starred version)

TeX - LaTeX Asked on June 12, 2021

I have this code:

setlength{fboxsep}{0pt}
letincludegraphicsbakincludegraphics
renewcommand*{includegraphics}[2][]{colorbox{white}{includegraphicsbak[#1]{#2}}}

How can I make it work with the starred version of includegraphics?

I get this error if includegraphics* is used in the file:

! LaTeX Error: File `*' not found.

One Answer

The code shown would also disable the second optional argument of includegraphics

The second optional and the * form are both really for the graphics package interface which is really not used much so one possibility would be to ignore this aspect. (The star form just adds clip to the supplied keys, so it is more natural to use includegraphics[clip] than includegraphics* when using graphicx.)

However you can support all the argument parsing by hooking in the box after the arguments are parsed

makeatletter
letold@Ginclude@graphicsGinclude@graphics
defGinclude@graphics#1{colorbox{white}{old@Ginclude@graphics{#1}}}
makeatother

Correct answer by David Carlisle on June 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP