I have a \VerbatimInput call to a test.dat file, as shown here:




  frame=lines,  % top and bottom rule only
  framesep=2em, % separation between frame and text
  commandchars=\|\(\), % escape character and argument delimiters for
                  % commands within the verbatim
  commentchar=*        % comment character



The test.dat file is the following:



  (EL = 4) # this is compiled ok
  mH/(C*K) # this is not compiled, giving that error

Due to the ( * ) symbols, the compilation gives this error:

 Runaway definition?
 -> mH/(C
 ! File ended within \read.
 <read 1> 

 l.97 \VerbatimInput{./test.dat}

How could I compile this ?

  • 3
    It's not clear why you set commentchar=*
    – egreg
    Feb 2, 2017 at 11:54
  • 2
    please don't post disconnected fragments, post a single document that people can run to see the error, (you could minimise the preamble to just the packages needed to show the error) don't load enumerate and enumitem at the same time (or enumitem twice) Feb 2, 2017 at 11:58
  • 2
    As egreg says, what exactly are you tryingwith tht commenchar and commandchars combo? \|\(\) means that () acts like {} and since * is the comment char, everything after it is ignored. So the ( (aka {) remains and the data is inconsistent as it is trying to look for the ending ) which is not there. You should probably adjust this into something more suitable for your .dat file.
    – daleif
    Feb 2, 2017 at 12:33
  • @DavidCarlisle Thank you for your comment; I have simplified the preamble and gathered all in a single fragment
    – DavidC.
    Feb 2, 2017 at 12:34
  • 2
    (2/2) So fancyvrb is trying to scan for the start and end part of every (), because these now acts as if they were {} (aka the chars you specify arguments with). These always have to come in pairs. But commentchar=* says everything after * is ignored and this the scanner cannot find the end part to ( in mH/(C*K)
    – daleif
    Feb 2, 2017 at 13:47

1 Answer 1


First, I have to say that I have not actually used \VerbatimInput myself. However, that bit of code you posted looks exactly like the one posted in the following answer: Include data from a .txt verbatim

To quote the author:

  • specifying | and (/) as the escape character and argument delimiters means these symbols cannot appear as part of the verbatim text (or in this case, the contents of data.txt);
  • the line of asterisks in data.txt was removed by specifying * as the comment character (similar to % in LaTeX);

In other words, the code you copied gives special meaning to these four characters, and so it can't be used with files which contain them.

The lines which seem to be doing this are these:

commandchars=\|\(\), % escape character and argument delimiters for
              % commands within the verbatim
commentchar=*        % comment character

So, I would suggest removing those from your code or replacing the characters with some others which do not appear in your file.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .