Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Created December 7, 2015 15:44
Show Gist options
  • Save rkaneko/f8627624288f41442bf8 to your computer and use it in GitHub Desktop.
Save rkaneko/f8627624288f41442bf8 to your computer and use it in GitHub Desktop.
\usepackage{listings}
\usepackage{color}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}
\lstdefinelanguage{JavaScript}{
keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
keywordstyle=\color{blue}\bfseries,
ndkeywords={class, export, boolean, throw, implements, import, this},
ndkeywordstyle=\color{darkgray}\bfseries,
identifierstyle=\color{black},
sensitive=false,
comment=[l]{//},
morecomment=[s]{/*}{*/},
commentstyle=\color{purple}\ttfamily,
stringstyle=\color{red}\ttfamily,
morestring=[b]',
morestring=[b]"
}
\lstset{
language=JavaScript,
backgroundcolor=\color{lightgray},
extendedchars=true,
basicstyle=\footnotesize\ttfamily,
showstringspaces=false,
showspaces=false,
numbers=left,
numberstyle=\footnotesize,
numbersep=9pt,
tabsize=2,
breaklines=true,
showtabs=false,
captionpos=b
}
\begin{lstlisting}[language=javascript,firstnumber=1,caption=someReducer,label=src:someReducer] % language=javascriptはだめかも
function someReducer(state = initialState, action) {
}
\end{lstlisting}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment