\usepackage{listings} \usepackage{xcolor} \definecolor{lstKeyword}{HTML}{000080} \definecolor{lstBG}{HTML}{FFFFFF} \definecolor{lstString}{HTML}{008000} \definecolor{lstNumber}{HTML}{0000FF} \definecolor{lstComment}{HTML}{808080} \definecolor{lstLineNumber}{HTML}{999999} \lstdefinestyle{custompython}{ backgroundcolor=\color{lstBG}, commentstyle=\color{lstComment}, keywordstyle=\color{lstKeyword}, numberstyle=\tiny\color{lstLineNumber}, stringstyle=\color{lstString}, basicstyle=\ttfamily, breakatwhitespace=false, breaklines=false, captionpos=b, keepspaces=true, numbers=left, numbersep=5pt, showspaces=false, showstringspaces=false, showtabs=false, tabsize=4 } \lstdefinestyle{customc}{ belowcaptionskip=1\baselineskip, breaklines=true, frame=L, xleftmargin=\parindent, language=C, backgroundcolor=\color{lstBG}, commentstyle=\itshape\color{lstComment}, keywordstyle=\bfseries\color{lstKeyword}, numberstyle=\tiny\color{lstLineNumber}, stringstyle=\color{lstString}, basicstyle=\ttfamily, breakatwhitespace=false, breaklines=false, captionpos=b, keepspaces=true, numbers=left, numbersep=5pt, showspaces=false, showstringspaces=false, showtabs=false, tabsize=4 } \lstdefinestyle{customasm}{ belowcaptionskip=1\baselineskip, frame=L, xleftmargin=\parindent, language=[x86masm]Assembler, basicstyle=\footnotesize\ttfamily, commentstyle=\itshape\color{purple!40!black}, } \lstset{escapechar=@,style=customc} \usepackage{xparse} \newcommand{\includecodecap}[2][c]{\lstinputlisting[caption=#2, escapechar=, style=custom#1]{#2}} \newcommand{\includecode}[2][c]{\lstinputlisting[escapechar=, style=custom#1]{#2}}