[Tex/LaTex] How to hide a part of a latex file

renderingspacing

I would like to have a generic command that basically reserves space for a set of commands, without actually rendering them in the PDF.

For example, \hide{this is some hidden text} will allocate space in the pdf for that string, but will never actually print it — it will be just white.

Or alternatively, it should also work with \hide{\includegraphics[width=3in]{image.png}}. If there is no way to do it generically, I would at the very least want to know whether I can do it with the includegraphics command.

Best Answer

there are

\phantom{whatever}%  an empty box with width and height of the argument
\vphantom{whatever}%  an empty box with a zero width and height of the argument
\hphantom{whatever}%  an empty box with a width and zero height of the argument