LaTeX Wiki
Advertisement

In LaTeX, the \verb command is used to print text verbatim, turning off the special meaning of metacharacters like \. Spaces are preserved and text is typeset using the typewriter (\tt) font.

Syntax[]

\verb char literal-text char
\verb* char literal-text char

The literal-text cannot include a line break. The * variant prints spaces as ␣ characters.

Example[]

The xcolor package provides the \verb!\color! command.
You can mix colors by writing \verb|\color{green!40!yellow}|.

The first \verb has its literal-text surrounded with exclamation marks. The second instead uses vertical bars because an exclamation mark is part of literal-text.

See also[]

This article includes content from the unofficial LaTeX2e reference manual, which is licensed under the old-style GNU documentation license.

Advertisement