Created
April 30, 2019 22:06
-
-
Save ainsleyrutterford/810c8fec4dc0e751cb8f6aafb2be08cd to your computer and use it in GitHub Desktop.
Simple example of the listings package in latex.
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
\usepackage{listings} | |
\lstset{language=C, | |
basicstyle=\ttfamily, | |
keywordstyle=\color{blue}\ttfamily, | |
stringstyle=\color{red}\ttfamily, | |
commentstyle=\color{green}\ttfamily, | |
morecomment=[l][\color{magenta}]{\#}} | |
% Do everything above in your preamble | |
\begin{lstlisting} | |
if (obstacles[i + j*nx]) tot_u = 0; | |
else tot_u = sqrt(u_sq); | |
\end{lstlisting} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment