I am writing a package which uses the verbatim package.
\RequirePackage{verbatim}
For the documentation I'm using the ltxdoc class. So I have to put an % character before every line of the documentation. Also when I'm using the vebatim environment to typeset code examples like
% \begin{verbatim}
% Some Code
% Some other code
% \end{verbatim}
ltxdoc removes all the % at beginning of each line, also inside the verbatim environment.
It seems that the verbatim package redefines the special verbatim environment from the ltxdoc class, because when I write
% \begin{verbatim}
% some code example
% some other code example
% \end{verbatim}
the % before Some code and before Some other code is still there in the produced pdf. So the pdf-output is
% some code example
% some other code example
But it should be
some code example
some other code example
Can anyone help me to solve this problem?
Minimal working example (MWE)
This is an MWE of the .dtx file.
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{exercises}[2014/04/22 v1.0 .dtx exercises file]
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{exercises}
\begin{document}
\DocInput{exercises.dtx}
\end{document}
%</driver>
% \fi
% \GetFileInfo{exercises.sty}
% \title{The \textsf{exercises} package\thanks{This document
% corresponds to \textsf{exercises}~\fileversion, dated \filedate.}}
% \author{Roger Jud}
%
% \maketitle
%
% \begin{verbatim}
% \begin{exercise}
% Calculate $1 + 1 =$
% \end{exercise}
% \end{verbatim}
%
% \StopEventually{\PrintChanges\
%
% \begin{macrocode}
\RequirePackage{verbatim}
\newenvironment{exercises}{Start}{End}
% \end{macrocode}
% \Finale
\endinput


dtxfile, so that people can test what goes wrong with their own eyes. – jub0bs Apr 22 '14 at 16:19