How to turn a Verbatim into an itemize environment?

Here's a pseudo verbatim approach that doesn't disable TeX's line breaking, at the cost of not allowing some special characters (namely \, { and }):

\documentclass{article}

\usepackage{soul}

\makeatletter
\newdimen\VBI@indent
\newbox\VBI@box
\newtoks\VBI@everypar
\newenvironment{verbitemize}{%
  \let\VBI@tilde~% Save the tilde
  \setbox\VBI@box\hbox{\hss$\bullet$\VBI@tilde\hss}% Save the bullet box
  \ifdim\parindent > \wd\VBI@box
    \setbox\VBI@box\hb@xt@\parindent{\unhbox\VBI@box}%
  \fi
  \VBI@indent\wd\VBI@box% Measure the hanging indentation
  \parindent\z@% Remove paragraph indentation
  \obeylines% Make ^^M active
  \VBI@everypar{% Add a few tokens to \everypar:
    \copy\VBI@box% $\bullet$^
    \hangindent\VBI@indent% Hanging indentation
    \hangafter\@ne}%
  \expandafter\futurelet\expandafter\VBI@tokn
    \expandafter\VBI@check@minipage\the\everypar\relax\@nnul
  \def\VBIdo{% List of special characters to be allowed in this speudo-verbatim mode
    \do\$\do\&\do\#\do\^\do\_\do\~%
  }% BEWARE! \do\\, \do\{, and \do\} CANNOT be used here
  \let\do\@makeother\VBIdo
}{}
\def\VBI@check@minipage#1\@nnul{%
  \ifx\VBI@tokn\@minipagefalse
    \everypar{\@minipagefalse\the\VBI@everypar
                   \everypar{\the\VBI@everypar}}%
  \else
    \everypar\expandafter{\the\everypar\the\VBI@everypar}%
  \fi}
\makeatother

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

\begin{verbitemize}
  Some normal item point
  A longer item point that might require multiple requirement lines but does not contain hyphens
  A line with a \st{pesky error-causing hyphen} not anymore \texttt{=D}
  Another normal line
  Another hyphen-related erroring line
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  A line with special characters: $ & # ^ _ ~
  Last line
\end{verbitemize}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

\end{document}

enter image description here

The environment does a few verbatim-like settings before typesetting something:

First it saves the ~ in \VBI@tilde to allow the user to write ~:

  \let\VBI@tilde~%

then it creates a box \VBI@box that contains the bullet:

  \setbox\VBI@box\hb@xt@\parindent{\hss$\bullet$\VBI@tilde\hss}%

and use its width to measure the hanging indentation:

  \VBI@indent\wd\VBI@box

Here we don't want to use normal paragraph indentation:

  \parindent\z@

Now we make new lines active, so each one will insert a \par token

  \obeylines

then after each new line the \VBI@everypar token list will be executed:

  \VBI@everypar{%
    \copy\VBI@box
    \hangindent\VBI@indent
    \hangafter\@ne}%

but before inserting this into \everypar we need to check if we're inside a minipage. The minipage clears the \everypar token list, so we need to check. I used a macro \VBI@check@minipage that will look inside the \everypar token list and check if \@minipagefalse is there.

Now we only need to make special characters usable without escaping:

  \def\VBIdo{\do\$\do\&\do\#\do\^\do\_\do\~}%
  \let\do\@makeother\VBIdo

this will allow $, &, #, ^, _, and ~. If you don't want any of them, just remove the entry. Beware that \, { and } should not be used here, otherwise the environment will not find the \end{verbitemize}.

Edit:

Fixed for working inside minipages and in cases the \parindent is smaller than the bullet point.


Maybe something along these lines. I created a new verbitemize environment, using the constructs of the verbatimbox package, and use ! as the linebreak character.

\documentclass{article}
\usepackage{verbatimbox}
\catcode`!=\active
\def!{\newline\mbox{}\hspace{2em}}
\catcode`!=12 %
\newcommand\vbsetup{$\bullet$~}

\makeatletter
\newenvironment{verbitemize}{%
\catcode`!=\active %
\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{}%
}
\makeatother

\begin{document}
\noindent Here is normal text!

\begin{verbitemize}[\vbsetup]
This is a test
Now another.
Here I insert! manual line breaks! with an! exclamation point.
Finally, the last line
\end{verbitemize}

\noindent Back!to!normal!text!
\end{document}

enter image description here


\documentclass{article}
\usepackage{listings}
\lstnewenvironment{VerbItem}{%
    \renewcommand*\thelstnumber{\textbullet}%
    \lstset{basicstyle=\ttfamily\small,breakatwhitespace,breaklines,
            numbers=left,numbersep=2pt,xleftmargin=0.75em}}{}
\begin{document}

\begin{VerbItem}
Some normal item point
A longer item point that might require multiple requirement lines but does not contain hyphens
A line with a pesky error-causing hyphen
Another normal line
Another hyphen-related erroring line
Last line
\end{VerbItem}

\noindent
foo bar baz

\end{document}

enter image description here