Skip to content

verbatim, comment and fancyvrb in Scissor LaTeX

Mostly. The verbatim environment, \verb, fancyvrb's Verbatim and BVerbatim print text exactly as typed in a monospaced font, and the comment environment hides its content; fancyvrb's options are ignored, and \verbatiminput, \VerbatimInput, \Verb, \excludecomment, alltt and spverbatim do not work as in a TeX installation.

What the packages do

  • The verbatim environment and \verb|...| print text exactly as typed, in a monospaced font: no commands are run and every space is kept. The verbatim package improves them and adds \verbatiminput{file} and a comment environment, whose content is skipped.
  • comment provides the comment environment too, and \excludecomment{name} and \includecomment{name} to define environments you can switch on and off.
  • fancyvrb adds Verbatim with options for frames, line numbers and font size, \Verb, \fvset and \VerbatimInput.
  • alltt keeps spaces and line breaks like verbatim, but still runs commands.

For code with syntax colours, see listings and minted.

What works here

CommandIn Scissor LaTeXNotes
\begin{verbatim}, \begin{verbatim*}WorksMonospaced, as typed. verbatim* shows spaces as normal spaces, not as ␣.
\verb|...|, \verb!...!WorksAny delimiter. \verb* shows normal spaces.
\begin{comment}WorksThe content is skipped, even if it is not valid LaTeX.
\begin{Verbatim}, \begin{BVerbatim}, \begin{Verbatim*} (fancyvrb)PartlyThe text is printed as in verbatim; options such as frame=single or numbers=left are ignored.
\fvset{...}Left outIgnored in the preamble; in the body it is skipped with a note and its options are printed.
\Verb|...| (fancyvrb)Not supportedSkipped with a note; the text is printed with its delimiters. Use \verb.
\verbatiminput{file}, \VerbatimInput{file}Not supportedSkipped with a note; the file name is printed. Paste the text into a verbatim environment.
\excludecomment{name}, \includecomment{name} (comment)Not supportedThe new environments are unknown: their content is always printed. Only the comment environment itself is skipped.
allttPartlyCommands inside work, but line breaks and extra spaces are lost and the text is not monospaced.
spverbatim, moreverb's verbatimtab and listingNot supportedTheir content is read as ordinary LaTeX, not verbatim. Use verbatim.

Examples

A verbatim block and inline \verb, with a comment environment that hides a draft paragraph:

verbatim, \verb and comment

LaTeXPreamble: \usepackage{verbatim}Open in editor (opens in a new tab)
Type \verb|\section{Results}| to start a section. The file
\verb|data_44.csv| holds the samples:
\begin{verbatim}
name,               count
Erika Mustermann,   44
Hans Mustermann,    38
\end{verbatim}
\begin{comment}
This draft paragraph by John Doe is not printed.
\end{comment}
The table above lists two people.
Rendered by Scissor LaTeX: verbatim, \verb and comment

fancyvrb's Verbatim prints the text; the frame and line numbers are not drawn:

Verbatim: options are ignored

LaTeXPreamble: \usepackage{fancyvrb}Open in editor (opens in a new tab)
\begin{Verbatim}[frame=single, numbers=left]
for i in range(44):
    print(i)
\end{Verbatim}

Compatibility

  • From a TeX installation to here: verbatim text and comments look the same. Text included with \verbatiminput must be pasted in, and fancyvrb frames and line numbers are missing.
  • From here to a TeX installation: documents compile there unchanged.

The full manuals are on CTAN: verbatim, comment, fancyvrb and alltt. See also Code listings.

Questions and answers

How do I comment out a block of text in LaTeX?

Put % at the start of each line, or wrap the block in \begin{comment} and \end{comment} with \usepackage{verbatim} or \usepackage{comment}. Both work here.

How do I show a file's content verbatim?

\verbatiminput does not read files here yet, and neither does \lstinputlisting from listings. Paste the content into a verbatim or lstlisting environment.

Every example on this page is typeset by Scissor LaTeX when the site is built. Last updated 2026-11-07.