Code Snippet

Often times it is useful to include some code in a document, either as an example or to display it for publication. This template simplifies the process of including code from virtually any programming language in a LaTeX document. It uses the listings package to create a box around a piece of code and allows a large number of well-commented customizations to change its appearance.

Description

Often times it is useful to include some code in a document, either as an example or to display it for publication. This template simplifies the process of including code from virtually any programming language in a LaTeX document. It uses the listings package to create a box around a piece of code and allows a large number of well-commented customizations to change its appearance. The template also defines a custom command to include your code from a separate file, making the body of your document much cleaner than if you had pasted the code directly in. Documentation for the listings package is included with the template and contains a list of all programming languages supported by the package.

Important note: the template compiles as a standalone document but the code listing can be easily transferred to any document by copying the preamble of this template into the preamble of your document and including code anywhere in your document using the command defined in the template.

Preview

  • Template Preview Image

Authorship

This template was created by Vel.

Current Version

v1.0 (February 14, 2013)

License

This template is licensed under a CC BY-NC-SA 3.0 license. Click here to see what this license means for your use of the template.

Open Template for Free Editing Online

Download Template


This page last updated on: February 14, 2013