I'm working on a custom documentclass for the proceedings of a conference. To make editing of the contributions easier, I'm trying to discourage authors from following some problematic practices.

One of the practises I'd like to discourage is using \resizebox for text. Unfortunately one often finds this advice on the internet, even on this page. To prevent this I'd like to redefine \resizebox to issue a warning if it contains text, images alone should be OK.

(for the purpose of my question, I'd like to simply define "contains text" as contains letters a-z,A-Z)





This should be OK:


This should issue a warning:


This should issue a warning:

    abc & def & ghi\\

  • And what should happen with \resizebox{\textwidth}{!}{\someusercommand}? – Ulrike Fischer May 14 at 9:51
  • @UlrikeFischer Ideally it would depend on what \someusercommand expands to. Is this possible? – Åke May 14 at 9:52
  • I don't think that it would work reliably. You could set the font to \nullfont, but you would then have to handle the case that a box can have zero size, and probably you would get angry comments why test disappear. I also doubt if the people who use resizebox like this read warnings in the log. – Ulrike Fischer May 14 at 10:07
  • 1
    \resizebox{\textwidth}{!}{\includegraphics[height=5cm]{example-image}} is just an over-complicated way of saying \includegraphics[width=\textwidth]{example-image}, so you could issue the warning always... – Phelype Oleinik May 14 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.