3

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? – Werner Jun 9 '16 at 1:14
  • What do you mean ? – Sarah Jun 9 '16 at 1:15
3

You can try with the capabilities of listings:

enter image description here

\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 – Sarah Jun 9 '16 at 1:41
  • @Werner: What about \let\verbatim\relax \let\endverbatim\relax \lstnewenvironment{verbatim}[1][] {\lstset{ basicstyle=\ttfamily, columns=flexible, escapeinside = {/*}{*/} }} {} – user94293 Jun 9 '16 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.