Created
April 23, 2018 09:31
-
-
Save Liam0205/bf2498c523219fd511f61e28e2a145db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
\documentclass{article} | |
\usepackage{xcolor} | |
\usepackage{listings} | |
\lstdefinestyle{lfonts}{ | |
basicstyle = \footnotesize\ttfamily, | |
stringstyle = \color{purple}, | |
keywordstyle = \color{blue!60!black}\bfseries, | |
commentstyle = \color{olive}\scshape, | |
} | |
\lstdefinestyle{lnumbers}{ | |
numbers = left, | |
numberstyle = \tiny, | |
numbersep = 1em, | |
firstnumber = 1, | |
stepnumber = 1, | |
} | |
\lstdefinestyle{llayout}{ | |
breaklines = true, | |
tabsize = 2, | |
columns = flexible, | |
} | |
\lstdefinestyle{lgeometry}{ | |
xleftmargin = 20pt, | |
xrightmargin = 0pt, | |
frame = tb, | |
framesep = \fboxsep, | |
framexleftmargin = 20pt, | |
} | |
\lstdefinestyle{lgeneral}{ | |
style = lfonts, | |
style = lnumbers, | |
style = llayout, | |
style = lgeometry, | |
} | |
\lstdefinestyle{c}{ | |
language = {c}, | |
style = lgeneral, | |
} | |
\begin{document} | |
\begin{lstlisting}[style = c] | |
#include <stdio.h> | |
int main() { | |
printf("hello world!"); | |
} | |
\end{lstlisting} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment