Last active
April 3, 2021 00:29
Simple LaTeX template to print beautiful black&white Javascript source code
This file contains 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[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