# How to add a todo notes in verbatim environment?

I need to describe the header of a .ctl file. For this purpose, I am using verbatim package for displaying the header. My command lines are below:

\begin{verbatim}
dset ^newcase_d01_2612.dat
options  byteswapped
undef 1.e30
title  OUTPUT FROM WRF V3.4 MODEL
\end{verbatim}


And now, I would like to add a todo note at each line. As verbatim environment erase every command, how can I "cheat" with verbatim and use todo notes environment?

• You'll have to switch to a different environment. Are you okay with that? Jun 9 '16 at 1:14
• What do you mean ? Jun 9 '16 at 1:15

You can try with the capabilities of listings:

\documentclass{article}

\usepackage{listings,todonotes}

\lstnewenvironment{todoverbatim}[1][]
{\lstset{
basicstyle=\ttfamily,
columns=flexible,
escapeinside = {/*}{*/}
}}
{}

\begin{document}

\begin{verbatim}
dset ^newcase_d01_2612.dat
options  byteswapped
undef 1.e30
title  OUTPUT FROM WRF V3.4 MODEL
\end{verbatim}

\begin{todoverbatim}
dset ^newcase_d01_2612.dat /*\todo{something 1}*/
options  byteswapped /*\todo{something 2}*/
undef 1.e30 /*\todo{something 3}*/
title  OUTPUT FROM WRF V3.4 MODEL /*\todo{something 4}*/
\end{todoverbatim}

\end{document}


Instead of using verbatim, you would use todoverbatim. The layout is marginally different, and you can modify the escaping characters.

• Thank you so much for your availability, I would have never thought to this solution, I'm trying to put in my code to see if it works Jun 9 '16 at 1:41
• @Werner: What about \let\verbatim\relax \let\endverbatim\relax \lstnewenvironment{verbatim}[1][] {\lstset{ basicstyle=\ttfamily, columns=flexible, escapeinside = {/*}{*/} }} {} Jun 9 '16 at 1:49