0

is there a way to pass these strings:

\let\includegraphicsbak\includegraphics
\renewcommand*{\includegraphics}[2][]{\fbox{\includegraphicsbak[#1]{#2}}}

by command-line?

I tried:

 latex "\let\includegraphicsbak\includegraphics \renewcommand*{\includegraphics}[2][]{\fbox{\includegraphicsbak[#1]{#2}}} \input{myfile.tex}"

but, obviously, it doesn't work because the compiler complains about "\includegraphics is undefined" (at that point). Any idea to fix that?

8
  • 1
    Why do you want to do something cruel like this?
    – Johannes_B
    Jun 18, 2017 at 6:35
  • @Johannes_B I need to "temporarily" compile this way to visually check what figures need to be trimmed. It would be a command called by an emacs script. Jun 18, 2017 at 6:39
  • 2
    Would using a different page colour an alternative way to judge what needs to be trimmed?
    – Johannes_B
    Jun 18, 2017 at 6:40
  • 2
    You could try on the commsnd line \AtBeginDocument{....}. (untested) Jun 18, 2017 at 6:55
  • 1
    Related: Load a package by command line
    – Johannes_B
    Jun 18, 2017 at 7:52

1 Answer 1

2

You can delay your redefinition by using \AtBeginDocument{....}:

 latex "\AtBeginDocument{\let\includegraphicsbak\includegraphics \renewcommand*{\includegraphics}[2][]{\fbox{\includegraphicsbak[#1]{#2}}}} \input{myfile.tex}"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .