I would like to deactivate the indent for the verbatim environment, such that left margin is the same for everything.
\documentclass{article}
\usepackage{verbatimbox}
\makeatletter
\setcounter{VerbboxLineNo}{-1}
\renewenvironment{verbnobox}{%
% \setcounter{VerbboxLineNo}{-1}%
\let\my@par\par%
\def\verbatim@processline{%
{\addtocounter{VerbboxLineNo}{1}%
\@tmp\setbox0=\hbox{\@tmp\the\verbatim@line}%
\hsize=\wd0 \the\verbatim@line\my@par}}%
\verbatim\verbbox@inner%
}
{%
\endverbatim%
\global\def\@tmp{}%
\addtocounter{VerbboxLineNo}{-1}%
}
\makeatother
\begin{document}
\def\tmp{\makebox[0pt][r]{\scriptsize\theVerbboxLineNo\ \smash{%
\rule[-1.4\dp\strutbox]{1pt}{1.4\baselineskip}}\ }\small}
NO INDENT SHOULD BE AFTER THIS
\begin{verbnobox}[\tmp]
ADASFASFASF
\end{verbnobox}
NO INDENT SHOULD BE AFTER THIS
\begin{verbnobox}[\tmp]
AFASDASFASGASDF
\end{verbnobox}
RESET LINE NUMBERS
\setcounter{VerbboxLineNo}{-1}
\begin{verbnobox}[\tmp]
Reset Line Numbers should appear here
\end{verbnobox}
\end{document}
Best Answer
Simply removing the leading space from your verbatim content takes care of the problem.
Normally, leading spaces in LaTeX code are ignored. But that is not the case in
verbatim
style environments, where spaces are interpreted literally.