1

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:

enter image description here

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:

  1. Wrap mdframed environment into a command
  2. How to write an environment wrapping document environment
  3. Beamer - ! File ended while scanning use of \next
  4. File ended while scanning use of \next
  5. "Runaway argument? File ended while scanning use of \abx@aux@page."
  6. Use of the comment package
  7. How to write hidden notes in a LaTeX file?
  8. Comment package not working
0

0