-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpygmentize.sty
More file actions
26 lines (21 loc) · 987 Bytes
/
pygmentize.sty
File metadata and controls
26 lines (21 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
%%% Author: Shrey banga
%%% Use Pygments for syntax highlighting source code
%%% requires --enable-pipes and "pygmentize" to be a valid command
%%% e.g. usage \pygmentize {source.py}
\ProvidesPackage{pygmentize}
\usepackage{fancyvrb}
\usepackage{color}
\usepackage[utf8]{inputenc}
%%% Any other options in the package are passed to command line
\newcommand \pygopts{}
\DeclareOption{linenos} { \expandafter\def\expandafter\pygopts\expandafter{\pygopts -P linenos=True } }
\DeclareOption{mathescape} { \expandafter\def\expandafter\pygopts\expandafter{\pygopts -P mathescape=True } }
% Theme's style defs are loaded by a python script
% The script basically calls print(LatexFormatter(style=theme).get_style_defs())
\DeclareOption* { \input "|pygmentize-styledefs.py \CurrentOption" }
\ProcessOptions\relax
\def \cmdline{|pygmentize -f tex }
\newcommand{\pygmentize}[2][]{
\input "\cmdline -P "verboptions=#1" \pygopts #2"
%\typeout{"\cmdline -P "verboptions=#1" \pygopts #2"}
}