Here is a use case:
Code: Select all
% preamble
\documentclass[11pt,a4paper]{article}
\pagestyle{plain}
\setlength{\textwidth}{17cm}
\setlength{\oddsidemargin}{-1cm}
\setlength{\evensidemargin}{-2cm}
% included packages
\usepackage{verbatim,listings,fancyvrb}
\usepackage{color}
\usepackage{url}
\usepackage{tipa}
\usepackage[utf8]{inputenc}
\usepackage{graphicx,epsfig}
\usepackage{parskip}
\usepackage{ifthen}
\usepackage{caption}
\usepackage{hevea}
%
% Define new command 'verbatim" which is used to hold the code of any language.
%
\let\oldverbatim=\verbatim
\let\oldendverbatim=\endverbatim
\renewenvironment{verbatim}[1][test]
{
\oldverbatim
}
{
\oldendverbatim
}
\begin{document}
This is the example command:
\begin{verbatim}
# ls -l
\end{verbatim}
\end{document}
The error when compiling with pdflatex is:
Code: Select all
! Illegal parameter number in definition of \next.
<to be read again>
}
l.43 #
ls -l
If I set the following:
Code: Select all
\catcode`\#=11\relax
My question now is: how to enable the verbatim package to read the argument correctly without needing to define the catcodes. Is it possible to set the verbatim environment like that - so it only reads for optional arguments in the current line, and if no arguments given, then there is no arguments present. What's in the next line is already the verbatim text?