Skip to content

Instantly share code, notes, and snippets.

@martinshaw
Created May 7, 2018 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinshaw/5616e311e81aff6bfbc22532ea573d20 to your computer and use it in GitHub Desktop.
Save martinshaw/5616e311e81aff6bfbc22532ea573d20 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
%% Define your header here.
%% See http://texblog.org/2007/11/07/headerfooter-in-latex-with-fancyhdr/
\fancyhead[CO,CE]{John Doe, Class 123}
\usepackage[usenames,dvipsnames]{color} %% Allow color names
%% The listings package will format your source code
\usepackage{listings}
\lstdefinestyle{customasm}{
belowcaptionskip=1\baselineskip,
xleftmargin=\parindent,
language=C++,
breaklines=true, %% Wrap long lines
basicstyle=\footnotesize\ttfamily,
commentstyle=\itshape\color{Gray},
stringstyle=\color{Black},
keywordstyle=\bfseries\color{OliveGreen},
identifierstyle=\color{blue},
xleftmargin=-8em,
showstringspaces=false
}
\begin{document}
\lstinputlisting[style=customasm]{/path/to/your/code.c}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment