forked from DimaTrushin/CppCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.sty
More file actions
49 lines (44 loc) · 2.19 KB
/
code.sty
File metadata and controls
49 lines (44 loc) · 2.19 KB
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
44
45
46
47
48
% Определим окружение для кода
% Используется пакет listings
\definecolor{@clr-background}{RGB}{250,250,250}
\definecolor{@clr-text}{RGB}{0,0,0}
\definecolor{@clr-string}{RGB}{255,85,255}
\definecolor{@clr-preprocessor}{RGB}{0,0,153}
\definecolor{@clr-keyword}{RGB}{255,128,0}
\definecolor{@clr-variable}{RGB}{0,0,0}
\definecolor{@clr-comment}{RGB}{0,102,0}
\definecolor{@clr-type}{RGB}{51,51,255}
\definecolor{@clr-stl}{RGB}{45, 160, 120}
\newcommand{\@twfont}{\footnotesize\ttfamily}
\lstdefinestyle{Cpp}{
numbers=left,
showlines=true,
frame=tb,
tabsize=2,
showstringspaces=false,
backgroundcolor=\color{@clr-background},
basicstyle=\color{@clr-text}\@twfont,
stringstyle=\color{@clr-string}\@twfont,
identifierstyle=\color{@clr-variable}\@twfont,
commentstyle=\color{@clr-comment}\@twfont,
directivestyle=\color{@clr-preprocessor}\@twfont,
keywordstyle=\color{@clr-keyword}\@twfont,
morekeywords={alignas,alignof,and,and_eq,asm,atomic_cancel,atomic_commit,atomic_noexcept,auto,bitand,bitor,bool,break,case,catch,char,char8_t,char16_t,char32_t,class,compl,concept,const,consteval,constexpr,constinit,const_cast,continue,co_await,co_return,co_yield,decltype,default,delete,do,double,dynamic_cast,else,enum,explicit,export,extern,false,float,for,friend,goto,if,inline,int,long,mutable,namespace,new,noexcept,not,not_eq,nullptr,operator,or,or_eq,private,protected,public,reflexpr,register,reinterpret_cast,requires,return,short,signed,sizeof,static,static_assert,static_cast,struct,switch,synchronized,template,this,thread_local,throw,true,try,typedef,typeid,typename,union,unsigned,using,virtual,void,volatile,wchar_t,while,xor,xor_eq},
emph={bool,char,char8_t,char16_t,char32_t,double,float,int,long,short,signed,unsigned,void,wchar_t},
emphstyle={\color{@clr-type}\@twfont},
emph=[2]{assert},
emphstyle=[2]{\color{@clr-preprocessor}}
%emph=[3]{move,forward},
%emphstyle=[3]{\color{@clr-stl}}
}
\newcounter{@cppcode}
\setcounter{@cppcode}{1}
\lstnewenvironment{cppcode}[1][]
{\lstset{
language=C++,
style=Cpp,
#1
}
}
{\setcounter{@cppcode}{\value{lstnumber}}}
\newcommand{\inputcppcode}[2][]{\lstinputlisting[language=C++, style=Cpp, #1]{#2}}