Created
June 27, 2015 03:36
-
-
Save ckunte/aefd903185156cedea28 to your computer and use it in GitHub Desktop.
A simple LaTeX document template to list syntax highlighted python code (e.g., in Appendices, etc.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% Highlighted code example in LaTeX | |
% ckunte on 2015-03-08. | |
% | |
\documentclass[11pt,a4paper]{article} | |
% Use utf-8 encoding for foreign characters | |
\usepackage[utf8]{inputenc} | |
% Setup for fullpage use | |
\usepackage{fullpage} | |
% Package for including code in the document. Credits to | |
% Prof. Olivier Verdier for pythonhighlight.sty: | |
% https://github.com/olivierverdier/python-latex-highlighting | |
\usepackage{pythonhighlight} | |
% If you want to generate a toc for each chapter (use with book) | |
%\usepackage{minitoc} | |
% Syntax highlighting of code | |
\usepackage{listings} | |
% This is now the recommended way for checking for PDFLaTeX: | |
\usepackage{ifpdf} | |
\ifpdf | |
\usepackage[pdftex]{graphicx} | |
\else | |
\usepackage{graphicx} | |
\fi | |
\title{An article with python code highlighted} | |
\author{Chyetanya Kunte} | |
\date{2015-03-08} | |
\begin{document} | |
\ifpdf | |
\DeclareGraphicsExtensions{.pdf, .jpg, .tif} | |
\else | |
\DeclareGraphicsExtensions{.eps, .jpg} | |
\fi | |
\section*{Appendix A: Query motion data} % (fold) | |
\label{sec:introduction} | |
The code for querying motion data is as follows: | |
% The following ends with {start line no.}{end line no.} | |
\inputpython{query-motions.py}{1}{35} | |
% section appendix_a (end) | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment