Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add code listings to LaTeX document using verbatim environment

📅 2012-Dec-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_2997" align="aligncenter" width="255"][Code displayed using verbatim environment]( Code displayed using verbatim environment[/caption]

Source code listings can be displayed in a LaTeX document using the verbatim environment like this:

int main()
    return 0;

The text inside the verbatim environment is typeset using typewriter font. Also, all the characters are printed, including whitespace.

Tried with: MikTeX 2.9 and Windows 8 Pro