The environ environments read their content in one go like a macro and are therefore not "real" environments, but rather pseudo-environments (looks like an environment, works like a macro). This does not allow for verbatim content, as with normal macros. The content is read before the verbatim mode can be enabled, so all code is already parsed and categorized.
To get around this, you need to use a normal environment and then replicate the content several times. Usually this can be done by storing the content in a savebox, but your three alternatives do not allow for this because boxing will fix the content. Instead you should write the content to an external file and read it in multiple times. This can be done automatically without the need for manual filecontents environments. An easy way is provided by the listings package as shown by me in Write environment body verbatim to a file.
\documentclass{article}
\makeatletter
\RequirePackage{listings}
\lst@RequireAspects{writefile}
\newcommand{\mlw}[3]{}
\newcommand{\mlwa}[3]{#1}
\newcommand{\mlwb}[3]{#2}
\newcommand{\mlwc}[3]{#3}
\lstnewenvironment{multichaps}{%
% Write file to given filename
\lst@BeginWriteFile{\jobname.mul}%
}
{%
\lst@EndWriteFile% closes output file
\let\mlw\mlwa
\input{\jobname.mul}%
\let\mlw\mlwb
\input{\jobname.mul}%
\let\mlw\mlwc
\input{\jobname.mul}%
}
\makeatother
\begin{document}
\begin{multichaps}
\section{Installation on \mlw{Mac}{Windows}{Linux}}
Now it's time to test the system. Create a file
test.tex with the follwoing content.
\begin{verbatim}
\documentclass{article}
\begin{document}
Hallo World!
\end{document}
\end{verbatim}
Now open your \mlw{Terminal}{(Eingabeaufforderung)}{Terminal}
and call \verb+pdflatex test+
\end{multichaps}
\end{document}
Alternative, you can store the content verbatim in a macro and reevaluate it using e-TeX's \scantokens, which is basically the same as to write it into an external file and rereading it, but more efficient. One issue here seems the handling of end-of-line (EOF) characters. The content can be stored in a macro e.g. using my newverbs package. However, it does not provide an environment variant yet, so you need to use the macro version:
\documentclass{article}
\usepackage{newverbs}
\newcommand{\mlw}[3]{}
\newcommand{\mlwa}[3]{#1}
\newcommand{\mlwb}[3]{#2}
\newcommand{\mlwc}[3]{#3}
\makeatletter
\newcommand{\multichaps}{%
\begingroup
\expandafter\Collectverb\expandafter\@multichaps\expandafter
}
% The EOL character must be active to work with 'verbatim'.
% By default it should produce a space.
% This will break implicit paragraphs!
\begingroup
\catcode13=\active%
\gdef\activenl{%
\catcode13=\active%
\let^^M\space%
}%
\endgroup%
\newcommand{\@multichaps}[1]{%
\activenl
\let\mlw\mlwa
\scantokens{#1}%
\let\mlw\mlwb
\scantokens{#1}%
\let\mlw\mlwc
\scantokens{#1}%
\endgroup
}
\makeatother
\begin{document}
\multichaps=
\section{Installation on \mlw{Mac}{Windows}{Linux}}
Now it's time to test the system. Create a file
test.tex with the follwoing content.
\begin{verbatim}
\documentclass{article}
\begin{document}
Hallo World!
\end{document}
\end{verbatim}
Now open your \mlw{Terminal}{(Eingabeaufforderung)}{Terminal}
and call \verb+pdflatex test+
=
\end{document}
\mlw. Perhapsnewverbsis a solution. Instead of\renewcommanding I think it would be better to define akeycommandwith boolean options. The\BODYwill IMHO be printed thrice, is this correct? – Speravir Apr 09 '12 at 02:19verbatim? Or, why wouldn't\ttfamilysuffice? – Werner Apr 09 '12 at 04:48\mlwit’s{verbatim}together withenviron. The\mwlthink works fine but I wanted to show it and ask for other ideas besidesenviron. – Tobi Apr 09 '12 at 08:13verbatim… :-) – Tobi Apr 09 '12 at 08:13environenvironments are no real environments. I call the pseudo-environments. They actually read the whole content like a macro, so verbatim material does not work inside them. – Martin Scharrer Apr 09 '12 at 09:41