Language definitions and styles for listings in LaTeX.
- C
\documentclass{article}
\usepackage{listings}
\usepackage{c/style} % include custom style for C.
\begin{document}
% Use default language and custom style for C.
\lstinputlisting[language=C,style=c]{foo.c}
\end{document}
- Go
\documentclass{article}
\usepackage{listings}
\usepackage{go/lang} % include custom language for Go.
\usepackage{go/style} % include custom style for Go.
\begin{document}
% Use custom language and style for Go.
\lstinputlisting[language=go,style=go]{foo.go}
\end{document}
- Assembly with NASM syntax
\documentclass{article}
\usepackage{listings}
\usepackage{nasm/lang} % include custom language for NASM assembly.
\usepackage{nasm/style} % include custom style for NASM assembly.
\begin{document}
% Use custom language and style for NASM assembly.
\lstinputlisting[language=nasm,style=nasm]{foo.asm}
\end{document}
- The REIL instructions
\documentclass{article}
\usepackage{listings}
\usepackage{reil/lang} % include custom language for the REIL instruction set.
\usepackage{nasm/style} % include custom style for NASM assembly.
\begin{document}
% Use custom language and style (NASM) for the REIL instruction set.
\lstinputlisting[language=reil,style=nasm]{foo.reil}
\end{document}
\documentclass{article}
\usepackage{listings}
\usepackage{llvm/lang} % include custom language for LLVM IR.
\usepackage{nasm/style} % include custom style for NASM assembly.
\begin{document}
% Use custom language and style (NASM) for LLVM IR.
\lstinputlisting[language=llvm,style=nasm]{foo.ll}
\end{document}
Example of C, Go, assembly, REIL and LLVM IR listings (example.tex, example.pdf) using the default language with a custom style for C, a custom language with a custom style for Go, a custom language with a custom style for NASM assembly, a custom language with a custom style for REIL instructions, and a custom language with a custom style for LLVM IR.
The source code and any original content of this repository is hereby released into the public domain.