[Tex/LaTex] Copying code to LaTeX without losing the formatting


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?

Best Answer

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

Put your code here.

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

Related Question