user1949902
user1949902

Reputation: 361

In LaTeX, how to escape to print out a block of text

The Problem: I just want to print a sequence like this in plain text:

                     a (10)
                   _/ \_
                  /     \
             (4) b       c (4)
               _/ \___
              /       \
         (8) d       _ e _ (5)
            / \     /  |  \
           f   g   h   i   j
          (2) (4) (1) (1) (6)

I would like to avoid escaping all characters along the way, including special characters for preserving spaces. Essentially, I am drawing an ASCII picture!

Upvotes: 9

Views: 5246

Answers (1)

Werner
Werner

Reputation: 15065

For a pure ASCII-picture interpretation, use the verbatim environment:

enter image description here

\documentclass{article}
\begin{document}

\begin{verbatim}
             a (10)
           _/ \_
          /     \
     (4) b       c (4)
       _/ \___
      /       \
 (8) d       _ e _ (5)
    / \     /  |  \
   f   g   h   i   j
  (2) (4) (1) (1) (6)
\end{verbatim}

\end{document}

The verbatim environment sets interprets spaces, line breaks and special characters as-is.

Upvotes: 16

Related Questions