All Projects → mewmew → lstlangs

mewmew / lstlangs

Licence: Unlicense License
Language definitions and styles for listings in LaTeX.

Programming Languages

TeX
3793 projects

latex

Language definitions and styles for listings in LaTeX.

Usage

  • 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

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.

Example listings

Fibonacci listings

REIL listings

LLVM IR listings

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].