-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstd_commands.tex
349 lines (296 loc) · 12.3 KB
/
std_commands.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
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-- DISCLAIMER:
%-- This is open sourced LaTeX utils that I adapted and changed over time,
%-- anyone are free to change or use it.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-- place any standard commands/environments here to get included in
%-- documents. When you include this file, you should do it before
%-- the \begin{document} tag.
%-- NECESSARY ENVIRONMENTS OR PACKAGES (paste in to main.tex if necessay):
% \usepackage[usenames,dvipsnames,xcdraw,svgnames,table]{xcolor}
% \usepackage{array}
% \usepackage{ifthen}
% \usepackage{xspace}
% \usepackage{pifont}
% \usepackage{footnote}
% \usepackage{footmisc}
%
% % enumerate* and itemize*
% \usepackage[inline]{enumitem}
%
% % for \begin{comment}
% \usepackage{verbatim}
%
% % for source-code listings
% \usepackage[newfloat,draft=false]{minted}
%
% % for formulas
% \usepackage{mathtools, nccmath}
% \usepackage{xpatch}
% % to split lists into multiple columns
% \usepackage{multicol}
% https://tex.stackexchange.com/questions/166263/drawing-multicolumn-table-in-latex
% TODO: siunitx
%
% % for \sfrac
% \usepackage{xfrac}
% % Change from 1 to 0 to get rid of the comments.
% \newcommand{\showcomments}{1}
% \input{std_commands}
% % macro for project name
% \newcommand{\proj}{Rumpelstiltskin\xspace}
% \hyphenation{Rumpelstiltskin}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defined values
% brewer qualitative colors
% \definecolor{brewergreen}{HTML}{1b9e77}
% \definecolor{brewerorange}{HTML}{d95f02}
% \definecolor{brewerpurple}{HTML}{7570b3}
% special foot note stuff
\newcommand{\astfootnote}[1]{
\let\oldthefootnote=\thefootnote
\setcounter{footnote}{0}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\footnote{#1}
\let\thefootnote=\oldthefootnote
}
% a command to indicate current editing progress
\newcommand{\resume}{
\begin{center}
\color{brewerorange}
\vspace{3pt}
\hrule
\vspace{1pt}
\hrule
\hrule
\vspace{10pt}
\textbf{This section is not yet complete.}
\vspace{10pt}
\hrule
\hrule
\vspace{1pt}
\hrule
\vspace{3pt}
\end{center}
}
% reduce space before and after formula
% \xpatchcmd{\NCC@ignorepar}{%
% \abovedisplayskip\abovedisplayshortskip}
% {%
% \abovedisplayskip\abovedisplayshortskip%
% \belowdisplayskip\belowdisplayshortskip}
% {}{}
\setlength{\abovedisplayskip}{3pt} \setlength{\abovedisplayshortskip}{3pt}
\setlength{\belowdisplayskip}{5pt} \setlength{\belowdisplayshortskip}{5pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Common setup
% an environment for invariants
\newcounter{invn}
\renewcommand{\theinvn}{\Roman{invn}}
\newenvironment{invariant}{\vspace{.5em} \color{brewerorange} \refstepcounter{invn} \noindent \textbf{\color{brewerorange} Invariant \Roman{invn}.}}{\vspace{.5em}}
% for handy reference
%
% paragraph without spacing:
% \setparsizes{0pt}{0pt}{0pt plus 1fil}
% additional hyphenation rules
\hyphenation{da-ta-flow}
%-- Macros... examples...
\newcommand{\netex}{FlexNet\xspace}
\hyphenation{FlexNet}
\newcommand{\blah}{blah blah blah}
% an environment for todos
\newenvironment{inprogress}{\color{ACMBlue}\textbf{Sun:} \begin{tabular}{||p{.48\textwidth}}}{\end{tabular}}
\newcommand{\inprog}[1]{
\ifthenelse{\equal{\showcomments}{1}}{{\color{ACMOrange}\vspace{.5em}%
\noindent\begin{tabular}{@{}||p{.46\textwidth}} \textbf{In progress: } #1
\end{tabular}}}{}}
\newcommand{\replace}[1]{
\ifthenelse{\equal{\showcomments}{1}}{{\color{VioletRed}\vspace{.5em}%\hspace*{.15em}
\noindent\begin{tabular}{@{}||p{.46\textwidth}} \textbf{Replaced: } #1
\end{tabular}}}{}}
\newcommand{\update}[1]{
\ifthenelse{\equal{\showcomments}{1}}{{\color{ACMBlue}\vspace{.5em}%
\noindent\begin{tabular}{@{}||p{.46\textwidth}} \textbf{Update: } #1
\end{tabular}}}{}}
%-- Code... Not sure this is useful...
\newcommand{\code}[1]{\texttt{\textbf{#1}}}
%-- Terms... Use this to introduce a term in the paper.
\newcommand{\term}[1]{\emph{#1}}
%-- Provides stylization for e-mail addresses
%\newcommand{\email}[1]{\emph{(#1)}}
%-- Starts a minor section (puts the title inline w/ the text.
\newcommand{\minorsection}[1]{\noindent\textbf{#1}:}
\newcommand{\minorsectionit}[1]{\noindent\textit{#1}:}
%-- Jiri caption
\newcommand{\minicaption}[2]{\caption[#1]{\textbf{#1} \textnormal{#2}}}
%-- Units on numbers: 4KB -> \units{4}{KB}
\newcommand{\units}[2]{#1\,#2}
%-- Commands... i.e. WRITE commands.
\newcommand{\command}[1]{{\sc \MakeLowercase{#1}}}
%-- For notes about things that need to be fixed.
\newcommand{\fix}[1]{\marginpar{\LARGE\ensuremath{\bullet}}
\MakeUppercase{\textbf{[#1]}}}
%-- For adding inline notes to a draft preceded by your initials
%-- E.g., \fixnote{JJW}{What the heck is a foobar?}
\newcommand{\fixnote}[2]{\marginpar{\LARGE\ensuremath{\bullet}}{\textbf{[#1:} \textit{#2\,}\textbf{]}}}
%-- Setting margins: \setmargins{left}{right}{top}{bottom}
\newcommand{\setmargins}[4]{
% Calculations of top & bottom margins
\setlength\topmargin{#3}
\addtolength\topmargin{-.5in} %-- seems like this should be 1, but .5
%-- balances the text top to bottom
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\setlength\textheight{\paperheight}
\addtolength\textheight{-#3}
\addtolength\textheight{-#4}
% Calculations of left & right margins
\setlength\oddsidemargin{#1}
\addtolength\oddsidemargin{-1in}
\setlength\evensidemargin{\oddsidemargin}
\setlength\textwidth{\paperwidth}
\addtolength\textwidth{-#1}
\addtolength\textwidth{-#2}
}
%-- For the tabularx environment... Using L, C, R as the column type
%-- will left, center, or right justify the text.
% \newcolumntype{L}{X}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
%-- To comment out a swatch of text, use \omitit{blah blah blah} or \eat{ xxx }
\long\def\omitit#1{}
\newcommand\eat[1]{}
% \newcommand\bs{\bigskip}
\newcommand{\para}[1]{{\vspace{4pt} \bf \noindent #1 \hspace{10pt}}}
\newcommand{\bs}[1]{{\vspace{4pt} \bf \noindent #1\xspace}}
%-- Inline title; useful for sub-sub-sections in which you don't want a separate
%-- line for the title.
\newcommand{\inlinesection}[1]{\smallskip\noindent{\textbf{#1.}}}
%-- todo notes
\newenvironment{outlineenv}{\par\color{black}}{\par}
\newenvironment{pagelenenv}{\par\color{red}}{\par}
%\newcommand{\outline}[1]{\begin{outlineenv}#1\end{outlineenv}}
\newcommand{\paralenblah}[1]{\begin{pagelenenv}Estimated length: #1 paragraphs\end{pagelenenv}}
\newcommand{\pagelenblah}[1]{\begin{pagelenenv}Estimated length: #1 pages\end{pagelenenv}}
\newcommand{\pagelen}[1]{\ifthenelse{\equal{\showcomments}{1}}{\pagelenblah{#1}}{}}
\newcommand{\outlinetext}[1]{\ifthenelse{\equal{\showcomments}{1}}{\outline{#1}}{}}
% define shortcuts for comment
% \newcommand{\outline}[1]{\textsf{\textbf{\leavevmode\color{VioletRed}[Outline: #1]}}}
\newcommand{\todoA}[1]{\textsf{\textbf{\color{BurntOrange}{[[#1]]}}}}
\newcommand{\todoB}[1]{\textsf{\textbf{\color{RoyalPurple}{[[#1]]}}}}
\newcommand{\todoC}[1]{\textsf{\textbf{\color{ForestGreen}{[[#1]]}}}}
\newcommand{\todoD}[1]{\textsf{\textbf{\color{VioletRed}{[[#1]]}}}}
\newcommand{\todoE}[1]{\textsf{\textbf{\color{RedOrange}{[[#1]]}}}}
\newcommand{\todoF}[1]{\textsf{\textbf{\color{RoyalBlue}{[[#1]]}}}}
\newcommand{\rough}[1]{\textit{\color{Orange}{#1}}}
% \newcommand{\pjd}[1]{\ifthenelse{\equal{\showcomments}{1}}{\textbf{\textcolor{RoyalBlue}{[[[Peter: #1]]]}}}
% \newcommand{\khor}[1]{\ifthenelse{\equal{\showcomments}{1}}{\textbf{\textcolor{BurntOrange}{[[[Isaac: #1]]]}}}
% \newcommand{\sun}[1]{\ifthenelse{\equal{\showcomments}{1}}{\textbf{\textcolor{ForestGreen}{[[[Shuwen: #1]]]}}}
\newcommand{\todo}[1]{\ifthenelse{\equal{\showcomments}{1}}{\todoA{TODO: #1}}{}}
\newcommand{\ma}[1]{\ifthenelse{\equal{\showcomments}{1}}{\todoC{MA: #1}}{}}
\newcommand{\edit}[1]{\ifthenelse{\equal{\showcomments}{1}}{\todoD{Edited: #1}}{}}
% eg, ie, etc, et al ....
\newcommand{\cf}{{cf.}\xspace}
\newcommand\etc{etc\@ifnextchar.{}{.\@}}
\newcommand{\eg}{\emph{e.g.},\xspace}
\newcommand{\etal}{et al.\xspace}
\newcommand{\ie}{\emph{i.e.}\xspace}
\newcommand{\re}{r.e.\xspace}
\newcommand{\aka}{a.k.a.\xspace}
% packed items and enum..
\newenvironment{packed_itemize}{
\begin{itemize}[leftmargin=*]
\setlength{\itemsep}{2pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
% \setlength{\partopsep}{0pt}
\setlength{\topsep}{2pt}
}{\end{itemize}}
\newenvironment{packed_enumerate}{
\begin{enumerate}[leftmargin=*]
\setlength{\itemsep}{2pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\topsep}{2pt}
}{\end{enumerate}}
\def\compactify{\itemsep=0pt \topsep=0pt \partopsep=0pt \parsep=0pt}
\let\latexusecounter=\usecounter
\newenvironment{CompactItemize}
{\def\usecounter{\compactify\latexusecounter}
\begin{itemize}}
{\end{itemize}\let\usecounter=\latexusecounter}
\newenvironment{CompactEnumerate}
{\def\usecounter{\compactify\latexusecounter}
\begin{enumerate}}
{\end{enumerate}\let\usecounter=\latexusecounter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Little numbers in circles plus background colors
% \newcommand{\colorcirc}[2]{\protect\raisebox{-0.5pt}{\tikzexternaldisable\protect\tikz{\protect\path[fill=#1] (0,0.004) circle [radius=0.105];\protect\node [inner sep=0,outer sep=0] at (0,0) {\small{#2}};}}}
\newcommand{\colorcirc}[2]{\protect\raisebox{-0.5pt}{\protect\tikz{\protect\path[fill=#1] (0,0.004) circle [radius=0.105];\protect\node [inner sep=0,outer sep=0] at (0,0) {\small{#2}};}}}
%-- Little numbers in circles... Maybe possible to define smarter macro, but
%-- simple attempts didn't work. There are also UTF-8 characters that can be used.
%-- Might need this to get it working:
\newcommand{\circone}{\protect\raisebox{-0.5pt}{\ding{192}}\xspace}
\newcommand{\circtwo}{\protect\raisebox{-0.5pt}{\ding{193}}\xspace}
\newcommand{\circthree}{\protect\raisebox{-0.5pt}{\ding{194}}\xspace}
\newcommand{\circfour}{\protect\raisebox{-0.5pt}{\ding{195}}\xspace}
\newcommand{\circfive}{\protect\raisebox{-0.5pt}{\ding{196}}\xspace}
\newcommand{\circsix}{\protect\raisebox{-0.5pt}{\ding{197}}\xspace}
\newcommand{\circseven}{\protect\raisebox{-0.5pt}{\ding{198}}\xspace}
\newcommand{\circeight}{\protect\raisebox{-0.5pt}{\ding{199}}\xspace}
\newcommand{\circnine}{\protect\raisebox{-0.5pt}{\ding{200}}\xspace}
\newcommand{\circten}{\protect\raisebox{-0.5pt}{\ding{201}}\xspace}
%\renewcommand{\footnotelayout}{\setstretch{1.05}} % Reduce line spacing in footnote
\setlength{\skip\footins}{1mm} % Reduce space between main text and footnote
\setlength{\footnotesep}{1mm} % Reduce space between footnotes
%% This part goes in preamble
\newcommand{\dummyfig}[1]{
\centering
\fbox{
\begin{minipage}[c][.45\textheight][c]{.95\textwidth}
\centering{#1}
\end{minipage}
}
}
% \renewcommand{\footnotesize}{\scriptsize}
\newcommand{\squeezeup}{\vspace{-6.0mm}}
% tikz configuration
\usetikzlibrary{shapes.geometric,shapes.arrows,decorations.pathmorphing}
\usetikzlibrary{matrix,chains,scopes,positioning,arrows,fit}
\usetikzlibrary{arrows.meta, chains, positioning, shapes}
% \renewcommand{\rmdefault}{bch} % change default font
\tikzset{
% STYLES
node distance =0.5cm, auto,%font=\footnotesize,
every node/.style={node distance=1cm},
% The comment style is used to describe the characteristics of each force
comment/.style={rectangle, inner sep=2pt, text width=2.5cm, node distance=0.25cm,}, %font=\scriptsize\sffamily},
% The force style is used to draw the forces' name
force/.style={rectangle, draw, fill=black!10, inner sep=2pt, text width=2.5cm, text badly centered, minimum height=1cm,}, %font=\bfseries\footnotesize\sffamily},
%Define standard arrow tip
>=stealth',
%Define style for boxes
punkt/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=3.5em,
minimum height=2em,
text centered},
% Define arrow style
pil/.style={
->,
thick,
shorten <=2pt,
shorten >=2pt,},
% colored ones
gray/.style = {fill=black!10},
blue/.style = {fill=blue!30},
red/.style = {fill=red!30},
green/.style = {fill=green!30},
orange/.style = {fill=orange!15},
% process/.style = {base, minimum width=2.5cm, fill=orange!15,font=\ttfamily},
}