🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #11680

Re: /dev/null as LaTeX environemt: How???

#11680
From: Heiko Oberdiek
Date: Wed, 01 Sep 1999 00:00
53 lines
1990 bytes
On 1 Sep 1999 15:39:05 GMT, luecking@comp.uark.edu (Daniel Luecking)
wrote:

>Uwe Lammers <ulammers@astro.estec.esa.nl> writes:
>>I can immodestly claim to be quite an experienced TeX user but have not
>>been able to come up with a satisfactory solution to the following problem:
>>I want to write a new LaTeX environment which simply ignores everything
>>that stands between \begin{null} ... \end{null}
>[...]
>A roll-your-own solution is 
>\newenvironment{null}{\iffalse}{\fi}

* \null is already defined (\hbox{})
* TeX then look ahead for \fi, but it does see \end{null} and
  continues looking for the \fi.

Example:
%%% cut %%% test.tex %%% cut %%%
\documentclass{minimal}

\newenvironment{Null}{%
  \catcode`\{=12
  \catcode`\}=12
  \DoNull
}{%
  \ignorespacesafterend
}

\begingroup
  \catcode`\(=1
  \catcode`\)=2
  \catcode`\{=12
  \catcode`\}=12
  \def\x(%
    \endgroup
    \newcommand\DoNull()
    \long\def\DoNull##1\end{Null}(\end(Null))
  )
\x

\begin{document}
Hello
\begin{Null}
 \begin{center}
 \end{center}
Irgendwas
\end{Null}
Welt!
\end{document}
%%% cut %%% test.tex %%% cut %%%

Yours sincerely
  Heiko <oberdiek@ruf.uni-freiburg.de>
Technical Details
Message-ID: <37cd5973.45602151@news.uni-freiburg.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37CD30B9.346D1AE5@astro.estec.esa.nl> <7qjhap$m4p@picayune.uark.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f9e16,6ea37bb09b2e2750
X-Google-Attributes: gidf9e16,public
X-Google-Thread: f5731,6ea37bb09b2e2750
X-Google-Attributes: gidf5731,public
X-Google-Thread: 10ee61,6ea37bb09b2e2750
X-Google-Attributes: gid10ee61,public
X-Google-Thread: 158e15,6ea37bb09b2e2750
X-Google-Attributes: gid158e15,public
From: oberdiek@ruf.uni-freiburg.de (Heiko Oberdiek)
Subject: Re: /dev/null as LaTeX environemt: How???
Date: 1999/09/01
Message-ID: <37cd5973.45602151@news.uni-freiburg.de>
X-Deja-AN: 519848678
References: <37CD30B9.346D1AE5@astro.estec.esa.nl> <7qjhap$m4p@picayune.uark.edu>
Organization: Rechenzentrum der Universitaet Freiburg, Germany
Newsgroups: comp.text.tex,fj.comp.texhax,fr.comp.text.tex,de.comp.tex