-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.sty
43 lines (40 loc) · 1.16 KB
/
code.sty
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
\ProvidesPackage{code}[2019/11/04]
\usepackage{listings}
\usepackage{xcolor}
\newcommand{\code}[1]{\colorbox{lightlightgray}{\lstinline[
language=C++, %C++ gives us true and false
showstringspaces=false,
basicstyle=\ttfamily,
columns=flexible,
keywordstyle=\color{blue},
commentstyle=\color{gray},
]$#1$}}
\definecolor{lightlightgray}{RGB}{230,230,230}
%common overrides are numbers=none and basicstyle=\small
\lstnewenvironment{codeblock}[1][]
{
\minipage{\textwidth}
\lstset{
language=C++,
backgroundcolor=\color{lightlightgray},
showstringspaces=false,
breaklines=true,
breakatwhitespace=false,
basicstyle=\ttfamily,
columns=fixed,
keywordstyle=\color{blue},
commentstyle=\color{gray},
breaklines=false,
captionpos=b,
extendedchars=true,
numbers=left,
numberstyle=\small\color{gray},
#1
}
\lstset{}
\csname\@lst @SetFirstNumber\endcsname
}
{
\csname\@lst @SaveFirstNumber\endcsname
\endminipage
}