-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorials_header.tex
More file actions
83 lines (72 loc) · 1.67 KB
/
tutorials_header.tex
File metadata and controls
83 lines (72 loc) · 1.67 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
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
\usepackage{graphicx}
\usepackage{float}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{caption}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{url}
\usepackage{etoolbox}
\usepackage{natbib}
\renewcommand{\refname}{}
\renewcommand{\bibname}{}
% --- Title handling ---
\title{$title$}
\author{$author$}
\date{$date$}
\AtBeginDocument{
\maketitle
%\tableofcontents
\clearpage
}
% --- allow alt= ---
\makeatletter
\define@key{Gin}{alt}{}
\makeatother
% --- scale figures ---
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\makeatother
\setkeys{Gin}{width=\maxwidth,height=0.8\textheight,keepaspectratio}
% --- syntax highlighting (arXiv-safe) ---
\lstdefinelanguage{Python}{
keywords={def, return, if, else, elif, for, while, import, from, as, class, try, except, raise, with, lambda, yield, True, False, None},
keywordstyle=\color{blue}\bfseries,
comment=[l]{\#},
commentstyle=\color{gray}\itshape,
stringstyle=\color{red},
morestring=[b]',
morestring=[b]",
}
\lstset{
language=Python,
basicstyle=\ttfamily\small,
keywordstyle=\color{blue}\bfseries,
commentstyle=\color{gray}\itshape,
stringstyle=\color{red},
breaklines=true,
frame=single,
showstringspaces=false,
columns=fullflexible,
keepspaces=true
}
% --- new page per section ---
%\pretocmd{\section}{\clearpage}{}{}
\makeatletter
\pretocmd{\section}{%
\ifnum\pdfstrcmp{\@currentlabelname}{References}=0
% do nothing
\else
\clearpage
\fi
}{}{}
\makeatother
% --- nicer captions ---
\captionsetup{
font=small,
labelfont=bf
}
% --- FIX bold-text bug ---
\normalfont
\renewcommand{\familydefault}{\rmdefault}