I am trying to create a debug mode where I can comment out most things on the document. For now I was able to replace commands like \currenttime
from datetime
package with \def\currenttime{Current Time}
.
But when I tried to create a generic replacement for a environment as longtable
I could not create successfully a dummy environment. Doing:
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[showframe,pass]{geometry}
\newif\ifdebug
\debugtrue
% \debugfalse
\ifdebug
\def\hline{hline}
\def\RaggedRight{RaggedRight}
\newenvironment{longtable}[2]
{longtable environment}
{replacement for debug mode}
\else\fi
\begin{document}
\begin{longtable}[!ht]{ | >{\RaggedRight}p{3cm} | p{6cm} | }
\hline
Cor & Branco \\ \hline
Formato do papel & A5 \\ \hline
\end{longtable}
\end{document}
Throw these errors:
! Misplaced alignment tab character &.
l.93 Cor &
Branco \\ \hline
I can't figure out why you would want to use a tab mark
here. If you just want an ampersand, the remedy is
simple: Just type `I\&' now. But if some right brace
up above has ended a previous alignment prematurely,
you're probably due for more error messages, and you
might try typing `S' now just to see what is salvageable.
! Misplaced alignment tab character &.
l.94 Formato do papel &
A5 \\ \hline
I can't figure out why you would want to use a tab mark
here. If you just want an ampersand, the remedy is
simple: Just type `I\&' now. But if some right brace
up above has ended a previous alignment prematurely,
you're probably due for more error messages, and you
might try typing `S' now just to see what is salvageable.
For now I think the dummy environment could just output its contents as plain text or not display anything at all. Can it be fixed for replacing any environment, independent of the number of parameters or its contents?
Related:
&
in the best case (to something like 12).\catcode
\@=11` and it compiled successfully: en.wikibooks.org/wiki/TeX/catcode&
should never appear within a macro name (for example). 12 seems more appropriate.