5

I have some code of around 350 lines, and I need to paste it inside a LaTeX file without losing the formatting such as the extra spaces. What do I need to use to get this in LaTeX?

Adam
  • 153
  • 3
    What "code" exactly do you have? Is it some source code that you want to show as a listing (use verbatim then)? Could you copy-paste a few lines here as an example? – Suzanne Soy Apr 21 '16 at 22:56
  • 2
    Have a look at the listings package. You can include an external file with \lstinputlisting. –  Apr 21 '16 at 23:00

1 Answers1

7

You can use the package \usepackage{listings} and put your code in the following way

\begin{lstlisting}
Put your code here.
\end{lstlisting}

For information, you can read the wikibook LaTeX/Source Code Listings at https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

fyemath
  • 276