-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexcommands.tex
133 lines (121 loc) · 3.56 KB
/
texcommands.tex
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
% vim:ts=1:et:nospell:spelllang=en_gb:ft=tex
\usepackage{xspace}
\usepackage{xparse}
\usepackage{listings}
\usepackage{color}
\newcommand\code{\lstinline[basicstyle=\ttfamily\selectfont, breaklines=true, breakatwhitespace=true]}
\NewDocumentCommand\ppt{s}{\IfBooleanTF#1{{Microsoft PowerPoint}\xspace}{{PowerPoint}\xspace}}
\newcommand\mxp{{MindXpres}\xspace}
\newcommand\latex{\LaTeX\xspace}
\newcommand\lstref[1]{Listing \ref{lst:#1}}
\newcommand\figref[1]{Figure \ref{fig:#1}}
\newcommand\fig[2]{
\begin{figure}[h!]
\centering
\includegraphics[width=0.85\textwidth]{img/#1.png}
\caption{#2}
\label{fig:#1}
\end{figure}
}
%\lstloadlanguages{C}
\definecolor{maroon}{rgb}{0.6,0,0}
\definecolor{darkgreen}{rgb}{0,0.65,0.1}
\definecolor{darkblue}{rgb}{0,0,0.7}
\definecolor{grey}{rgb}{0.90,0.90,0.90}
\definecolor{pblue}{rgb}{0.13,0.13,1}
\definecolor{pgreen}{rgb}{0,0.5,0}
\definecolor{pred}{rgb}{0.9,0,0}
\definecolor{pgrey}{rgb}{0.46,0.45,0.48}
\lstdefinelanguage{XML} {
morestring=[s]{"}{"},
morecomment=[s]{<?}{?>},
morecomment=[s]{<!--}{-->},
commentstyle=\color{blue},
moredelim=[s][\color{maroon}]{\ }{=},
moredelim=[s][\color{black}]{>}{<},
moredelim=[s][\color{black}]{\ />}{<},
stringstyle=\color{darkgreen},
identifierstyle=\color{darkblue}
}
\lstnewenvironment{lstjava}[2]
{
\csname lst@SetFirstLabel\endcsname
\lstset{language=Java,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
commentstyle=\color{pgreen},
keywordstyle=\color{pblue},
stringstyle=\color{pred},
moredelim=[il][\textcolor{pgrey}]{$$},
moredelim=[is][\textcolor{pgrey}]{\%\%}{\%\%}
}
}
{
\csname lst@SaveFirstLabel\endcsname
\centering
\renewcommand{\figurename}{Listing}
\renewcommand{\figureshortname}{Lst.}
\caption{#2}
\label{lst:#1}
}
\lstnewenvironment{lstxml}[2]
{
\csname lst@SetFirstLabel\endcsname
\lstset{language=XML}
}
{
\csname lst@SaveFirstLabel\endcsname
\centering
\renewcommand{\figurename}{Listing}
\renewcommand{\figureshortname}{Lst.}
\caption{#2}
\label{lst:#1}
}
\lstnewenvironment{lstxml*}
{
\csname lst@SetFirstLabel\endcsname
\lstset{language=XML,
xrightmargin=0pt
}
}
{
\csname lst@SaveFirstLabel\endcsname
}
\lstnewenvironment{lstxmlnoref}[0]
{
\csname lst@SetFirstLabel\endcsname
\lstset{language=XML}
}
{
\csname lst@SaveFirstLabel\endcsname
}
\newcommand\fignl[1]{
\centering
\includegraphics[width=\textwidth]{img/#1.png}
}
\newcommand\cl[2]{
\centering
\caption{#2}
\label{lst:#1}
}
\lstset{
basicstyle=\ttfamily\fontsize{7pt}{8pt}\selectfont,
numbers=left, % where to put the line-numbers
numberstyle=\fontsize{7pt}{8pt}\selectfont, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it is 1 each line will be numbered
numbersep=1em, % how far the line-numbers are from the code
backgroundcolor=\color{grey}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
frameround=tttt,
flexiblecolumns=false,
basewidth={0.5em,0.45em},
linewidth=\textwidth,
xleftmargin=2em,
xrightmargin=1em
}