schallerala / latex-javaScript

typeset JavaScript codes in Latex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latex-JavaScript

Typeset JavaScript codes in Latex based on the Boxy Yesterday scheme.

Keywords from

- JavaScript (ES 6)
- Node.js
- Express.js
- Jasmine

Original color scheme: Sample

Installation

kpsewhich -var-value=TEXMFHOME # outputs the path in which to place the .sty. For example: ~/Library/texmf on Mac
cp jslistings.sty ~/Library/texmf/tex/latex/local
texthash ~/Library/texmf # to update tex's database
kpsewhich jslistings.sty # to make sure it knows it

Issue

Unable to color closing parentheses when breaklines is set to true like:

\lstset{
    % ...
    breaklines=true,
    % ...
}

Then use the package etoolbox to add the patchcmd command and use it this way (Stackoverflow answer):

\usepackage{etoolbox} % provides the \patchcmd macro
% ...
\makeatletter
\patchcmd{\lsthk@SelectCharTable}{`)}{``}{}{} % patch listings
%\patchcmd{\lsthk@SelectCharTable}{``}{`)}{}{} % undo patch if needed
\makeatother

More

Didn't look more for it, but can generate an dtx from the sty:

sty2dtx jslistings.sty

About

typeset JavaScript codes in Latex

License:MIT License


Languages

Language:TeX 85.2%Language:JavaScript 14.8%