3

Why is it that

\begin{verbatim}
some verbatim
\end{verbatim}\bigskip

will work without errors, but if I changed the ending line to

\end{verbatim}\\[1\baselineskip]

I'll get errors?

Am I misunderstanding a basic concept of LaTex or?

3
  • Was that supposed to be \\[1\baselineskip]? Commented Jul 30, 2014 at 16:32
  • 1
    The error you get is There's no line here to end which should be self explaining: \end{verbatim} ends a paragraph and \\ is not legal between paragraphs. I'd place \bigskip (or \vspace{\baselineskip}, if you prefer) below \end{verbatim}, not on the same line. But why would you want a big space below the verbatim text?
    – egreg
    Commented Jul 30, 2014 at 16:51
  • I have the feeling that you might be interested in package parskip. Possible?
    – Johannes_B
    Commented Jul 30, 2014 at 16:51

1 Answer 1

7

verbatim is a display environment so after it you are in vertical (par) mode so you can use vertical spacing commands such as \bigskip (although you should almost never need to do this, the correct spacing should be specified in your class file).

Conversely \\ is a command to be used in horizontal (LR) mode it forces a break in the current line. There is no current line at that point so you get an error. Use of \\ outside tables is almost always incorrect even when it doesn't generate an error.

2
  • Outside tables and equations surely? Commented Jul 30, 2014 at 20:44
  • @IanThompson yes well outside alignments Commented Jul 30, 2014 at 20:54

You must log in to answer this question.

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