'free white spaces section in LaTeX

I'm writing a document which will contain something like the image I included below. I don't want to use images because if I do, the document will contain a lot of images and I want to include this text in my LaTeX document the right way.

I don't know if this is possible, but can I have a section in latex, in which I can write whitespaces and tabs the way I do in a .txt document?

content



Solution 1:[1]

You can use the verbatim environment:

\begin{verbatim}
The verbatim environment
  simply reproduces every
 character you input,
including all  s p a c e s!
\end{verbatim}

I'm not sure if tabs will do what you want; replace them by spaces if necessary.

Solution 2:[2]

An alternative to verbatim environment is to use a tabular-like environment, here's a sketch:

\documentclass{article}

\begin{document}
\begin{tabular}{*{14}{c}}
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 &   &     &    \\
e & i & n & - & t & e & s & t & e & s & t  &   &     &    \\
t & e & s & t &   &   &   &   &   &   &    &   & I=0 & j=0\\
  & t & e & s & t &   &   &   &   &   &    &   & I=1 & j=0\\
  &   & t & e & s & t &   &   &   &   &    &   & I=2 & j=0\\
  &   &   & t & e & s & t &   &   &   &    &   & I=3 & j=0\\
  &   &   &   & t & e & s & t &   &   &    &   & I=4 & j=1\\
  &   &   &   &   & t & e & s & t &   &    &   & I=5 & j=2\\
  &   &   &   &   &   & t & e & s & t &    &   & I=6 & j=3\\
  &   &   &   &   &   &   & t & e & s & t  &   & I=7 & j=4\\
\multicolumn{14}{l}{Und dann wird j auf 1...             }\\
  &   &   &   &   &   &   &   & t & e & s  & t & I=8 & j=2\\
\end{tabular}
\end{document}

and its output.

tabular

In my opinion a tabular (or other table environment) here has the advantage that you can then configure spacing, font family and size, etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thomas
Solution 2 MattAllegro