-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy-preamble.sty
More file actions
185 lines (155 loc) · 4.88 KB
/
Copy pathmy-preamble.sty
File metadata and controls
185 lines (155 loc) · 4.88 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
%%
%% Custom preamble package
%% Contains:
%% - standard imports,
%% - custom color definition and means to invert colors (white on black PDF)
%% - size commands
%%
%% Author: Dorian Lesbre
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{my-preamble} [2023/02/24 v1.1.0 a lot of imports]
% ==========================
% Commonly used packages
% ==========================
\RequirePackage{listings}
\RequirePackage{xcolor, colortbl}
%\RequirePackage[utf8]{inputenc}
%\RequirePackage[T1]{fontenc}
\RequirePackage{amsfonts}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{mathrsfs}
\RequirePackage{mathtools}
\RequirePackage{mathpartir}
%\RequirePackage{nicefrac}
\RequirePackage{bm}
\RequirePackage{url}
\RequirePackage{graphicx}
\RequirePackage{pgf, tikz}
\RequirePackage{svg}
\RequirePackage{multicol}
\RequirePackage{multirow}
\RequirePackage{adjustbox}
\RequirePackage{scalerel}
% Code coloring
%\RequirePackage{minted}
\@ifclassloaded{beamer}{
\RequirePackage{hyperref}
}{
\RequirePackage{enumitem}
\RequirePackage{abstract}
\RequirePackage[hidelinks]{hyperref}
% Only color cite and ref
\hypersetup{linktoc = all, colorlinks = true, allcolors = color_fg, citecolor = color_emph, linkcolor = color_emph}
}
\ProcessOptions\relax
\newcommand{\temp}[1]{{\color{red}\textbf{TODO:} #1}}
% expands text into margins
% usage:
% \Wider{text to expand}
% \Wider[size]{text to expand}
\newcommand\Wider[2][3em]{
\makebox[\linewidth][c]{
\begin{minipage}{\dimexpr\textwidth+#1\relax}
\raggedright#2
\end{minipage}
}
}
\@ifclassloaded{beamer}{
% Beamer margins
\newlength\beamerleftmargin{}
\setlength\beamerleftmargin{\Gm@lmargin}
\newlength\beamerrightmargin{}
\setlength\beamerrightmargin{\Gm@rmargin}
% Tikz macro to add/remove style from nodes on certain slides
\tikzset{onslide/.code args={<#1>#2}{%
\only<#1>{\pgfkeysalso{#2}}
}}
% Allow \cellcolor to use beamer overlay specs
\newcommand<>\cellcolorb[1]{%
\only#2{\cellcolor{#1}}%
}
% Add a tikz node at current pos, useful to have overlays point to this place
\newcommand{\tikzpt}[1]{\tikz[overlay, remember picture, baseline=-3pt] \coordinate (#1);}
% Split a slit in two columns
\newcommand\twosplit[3][t]{%
\begin{columns}[#1]
\begin{column}{0.475\linewidth}
#2
\end{column}\hfill
\begin{column}{0.475\linewidth}
#3
\end{column}
\end{columns}
}
}{}
% ==========================
% Color definitions
% ==========================
% Classic black on white
\definecolor{classic_text_color}{HTML}{000000} % black
\definecolor{classic_page_color}{HTML}{FFFFFF} % white
\definecolor{classic_emph_color}{HTML}{0000FF} % blue
\definecolor{classic_emph2_color}{HTML}{FF0000} % red
\definecolor{classic_emph3_color}{HTML}{FFFF00} % green
\definecolor{classic_emph4_color}{HTML}{EE8C00} % Dark Orange
% Inverted white on black
\definecolor{inverted_text_color}{HTML}{FFFFFF} % white
\definecolor{inverted_page_color}{HTML}{000000} % black
\definecolor{inverted_emph_color}{HTML}{FFFF00} % yellow
\definecolor{inverted_emph2_color}{HTML}{FF00FF} % magenta
\definecolor{inverted_emph3_color}{HTML}{00FFFF} % cyan
\definecolor{inverted_emph4_color}{HTML}{FFB000} % Light orange
\newcommand{\invertcolors}{
%\usemintedstyle{github-dark}
\colorlet{color_fg}{inverted_text_color}
\colorlet{color_bg}{inverted_page_color}
\colorlet{color_emph}{inverted_emph_color}
\colorlet{color_emph2}{inverted_emph2_color}
\colorlet{color_emph3}{inverted_emph3_color}
\colorlet{color_emph4}{inverted_emph4_color}
\color{color_fg}
\pagecolor{color_bg}
}
\newcommand{\resetcolors}{
%\usemintedstyle{colorful}
\colorlet{color_fg}{classic_text_color}
\colorlet{color_bg}{classic_page_color}
\colorlet{color_emph}{classic_emph_color}
\colorlet{color_emph2}{classic_emph2_color}
\colorlet{color_emph3}{classic_emph3_color}
\colorlet{color_emph4}{classic_emph4_color}
\color{color_fg}
\pagecolor{color_bg}
}
\resetcolors{}
% ==========================
% Size commands
% ==========================
\newcommand{\sizeppppp}{\Huge}
\newcommand{\sizepppp}{\huge}
\newcommand{\sizeppp}{\LARGE}
\newcommand{\sizepp}{\Large}
\newcommand{\sizep}{\large}
\newcommand{\size}{\normalsize}
\newcommand{\sizem}{\small}
\newcommand{\sizemm}{\footnotesize}
\newcommand{\sizemmm}{\scriptsize}
\newcommand{\sizemmmm}{\tiny}
% Center a minted using the given with
% \begin{mintedcenter}[<minted options>]{<width>}{<minted langage>}
% ex: \begin{mintedcenter}[autogobble]{0.5\textwidth}{ocaml}
% \newenvironment{mintedcenter}[3][]
% {\center\minipage{#2}\minted[#1]{#3}}
% {\endminted\endminipage\endcenter}
% \setminted{autogobble=true}
% Commands to have links to definitions
\newcommand{\newlink}[2]{{\protect{\hypersetup{linkcolor=}\hyperlink{#1}{#2}}}}
\makeatletter
\newcommand{\newtarget}[1]{\Hy@raisedlink{\hypertarget{#1}{}}}
\makeatother
\newcommand{\newdef}[1]{\newtarget{def:#1}}
\endinput
%% End of file my-preamble.sty