On the question How to replace a command with a dummy one? I learned to do:
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[showframe,pass]{geometry}
\newif\ifdebug
\debugtrue
% \debugfalse
\ifdebug
\makeatletter
\@ifundefined{includegraphics}
{
\newcommand{\includegraphics}[2][]{ includegraphics \detokenize{#1} \detokenize{#2} }
}{}
\makeatother
\else\fi
\begin{document}
\sloppy
\includegraphics[width=\linewidth]{pictures/ex01}
\end{document}
Which generate the following PDF file:
So now would like to comment out the contents of the command, however when I added \begin{comment} & \end{comment} on \newcommand{\includegraphics}:
\@ifundefined{includegraphics}
{
\newcommand{\includegraphics}[2][]{ \begin{comment} includegraphics \detokenize{#1} \detokenize{#2} \end{comment} }
}{}
I got the error:
Runaway argument?
! File ended while scanning use of \next.
<inserted text>
\par
<*> ./test2.tex
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
! Emergency stop.
<*> ./test2.tex
*** (job aborted, no legal \end found)
How can the contents of the command be throw away?
Related:
- Wrap mdframed environment into a command
- How to write an environment wrapping document environment
- Beamer - ! File ended while scanning use of \next
- File ended while scanning use of \next
- "Runaway argument? File ended while scanning use of \abx@aux@page."
- Use of the comment package
- How to write hidden notes in a LaTeX file?
- Comment package not working
