Skip to content

Instantly share code, notes, and snippets.

@zeroby0
Forked from sgmonda/code-print.tex
Created May 17, 2019 06:25
Show Gist options
  • Select an option

  • Save zeroby0/a88aa2101672184f8a21e17e355f627b to your computer and use it in GitHub Desktop.

Select an option

Save zeroby0/a88aa2101672184f8a21e17e355f627b to your computer and use it in GitHub Desktop.
Simple LaTeX template to print beautiful black&white Javascript source code
\documentclass[a4paper, 12pt]{article}
\usepackage[letterpaper, margin=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\usepackage{listings}
\usepackage{xcolor}
\newcommand\realnumberstyle[1]{}
\makeatletter
\makeatother
\lstset{
aboveskip=0cm,
stringstyle=\ttfamily,
showstringspaces = false,
basicstyle=\scriptsize\ttfamily,
commentstyle=\color{gray!45},
keywordstyle=\bfseries,
ndkeywordstyle=\bfseries,
identifierstyle=\ttfamily,
numbers=left,
numbersep=15pt,
numberstyle=\tiny,
numberfirstline = false,
breaklines=true
}
\lstdefinelanguage{JavaScript}{
keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, const, let, async, await, if, in, while, do, else, case, break, from},
ndkeywords={class, export, boolean, throw, implements, import, this},
sensitive=false,
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]"
}
\begin{document}
\begin{lstlisting}[language=JavaScript,numbers=left]
Paste your code here
\end{lstlisting}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment