forked from StonyBrook-Lin630-F15/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycommands.sty
330 lines (278 loc) · 10.7 KB
/
mycommands.sty
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
\ProvidesPackage{mycommands}
% typeset strings
\newcommand{\String}[1]{\ensuremath{\mathit{#1}}}
\definecolor{codebg}{rgb}{0.95,0.95,0.95}
\newminted{python}{linenos,mathescape,gobble=4,fontsize=\footnotesize,bgcolor=codebg,samepage=false}
\newmintedfile{python}{linenos,mathescape,fontsize=\footnotesize,bgcolor=codebg,samepage=false}
\addto\captionsenglish{\renewcommand{\chaptername}{Lecture}}
\addto\captionsenglish{\renewcommand{\bibname}{References and Further Reading}}
\def\thesection{\arabic{section}}
\newcommand{\Note}[1]{\marginpar{\footnotesize\bfseries #1}}
\newcounter{homework}[chapter]
\def\thehomework{\thechapter.\arabic{homework}}
\newenvironment{homework}[1][\unskip]{%
\refstepcounter{homework}%
\noindent\ignorespaces%
\textbf{#1Homework \thehomework} \quad%
}%
{\par\noindent%
\ignorespacesafterend}
\newcommand{\DangerSymbol}{\ensuremath{\skull}}
\newcommand{\difficultsymbol}{\ensuremath{\skull}}
\newcommand{\difficult}{\difficultsymbol\ }
% \setof - set with auto-sized brackets
\newcommand{\setof}[1]{\ensuremath{\left \{ #1 \right \}}}
% \tuple - tuple with auto-sized brackets
\newcommand{\tuple}[1]{\ensuremath{\left \langle #1 \right \rangle }}
\newcommand{\ftuple}[1]{\tuple{\mathrm{#1}}}
\newcommand{\ttuple}[1]{\tuple{\text{#1}}}
% Defines
\newcommand{\is}{\ensuremath{\mathrel{\mathop:}=}}
% emptystring
\newcommand{\emptystring}{\ensuremath{\varepsilon}}
% inverse
\newcommand{\inverse}[1]{\ensuremath{ #1^{-1} }}
% \cardof - cardinality
\newcommand{\cardof}[1]{\ensuremath{| #1 |}}
\newcommand{\rewrite}{\ensuremath{\rightarrow}}
\newcommand{\rewriteR}[1]{\ensuremath{\xrightarrow{#1}}}
\newcommand{\mlex}[2]{\ensuremath{\text{#1} ::\thinspace \mathrm{#2}}}
\newcommand{\SelEq}{\ensuremath{\mathop{=}}}
\newcommand{\fsel}[1]{\ensuremath{\SelEq\mathrm{#1}}}
\newcommand{\restrictor}{\ensuremath{\upharpoonright}}
\newcommand{\idom}{\ensuremath{\triangleleft}}
\newcommand{\pdom}{\ensuremath{\triangleleft^+}}
\newcommand{\rdom}{\ensuremath{\triangleleft^*}}
\newcommand{\word}[1]{\emph{#1}}
% citations - various macros for citations
% I got those from the class stylesheet of the Semantics & Pragmatics Open Publishing Journal;
% see their guide for authors on how to put them to good use
\newcommand{\posscitet}[1]{\citeauthor{#1}'s (\citeyear{#1})}
\newcommand{\possciteauthor}[1]{\citeauthor{#1}'s}
\newcommand{\pgposscitet}[2]{\citeauthor{#1}'s (\citeyear{#1}:~#2)}
\newcommand{\secposscitet}[2]{\citeauthor{#1}'s (\citeyear{#1}:~$\S$#2)}
\newcommand{\pgcitealt}[2]{\citealt{#1}:~#2}
\newcommand{\seccitealt}[2]{\citealt{#1}:~$\S$#2}
\newcommand{\pgcitep}[2]{(\citealt{#1}:~#2)}
\newcommand{\seccitep}[2]{(\citealt{#1}:~$\S$#2)}
\newcommand{\pgcitet}[2]{\citeauthor{#1} (\citeyear{#1}:~#2)}
\newcommand{\seccitet}[2]{\citeauthor{#1} (\citeyear{#1}:~$\S$#2)}
% example box environment
\tikzstyle{examplebox} = [draw=black, fill=white, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{exampletitle} = [fill=black, text=white]
% code for an examplebox
% first we need a background layer
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
% we define a couple of macros for parts of the box:
% box on entire page, top, middle, bottom
\def\ExampleboxframeTotal#1{
\tikzset{external/export next=false}
\tikz{
\node[inner sep=10pt, inner ysep=20pt] (text) {#1};
\begin{pgfonlayer}{background}
\draw[black, very thick, rounded corners]
(text.south west) -- (text.north west) --
(text.north east) -- (text.south east) -- cycle;
\end{pgfonlayer}
}
}
\def\ExampleboxframeTop#1{
\tikzset{external/export next=false}
\tikz{
\node[inner sep=10pt, inner ysep=20pt] (text) {#1};
\begin{pgfonlayer}{background}
\draw[black, very thick, rounded corners]
(text.south west) -- (text.north west) --
(text.north east) -- (text.south east);
\end{pgfonlayer}
}
}
\def\ExampleboxframeMiddle#1{
\tikzset{external/export next=false}
\tikz{
\node[inner sep=10pt, inner ysep=20pt] (text) {#1};
\begin{pgfonlayer}{background}
\draw[black, very thick, rounded corners]
(text.south west) -- (text.north west);
\draw[black, very thick, rounded corners]
(text.north east) -- (text.south east);
\end{pgfonlayer}
}
}
\def\ExampleboxframeBottom#1{
\tikzset{external/export next=false}
\tikz{
\node[inner sep=10pt, inner ysep=20pt] (text) {#1};
\begin{pgfonlayer}{background}
\draw[black, very thick, rounded corners]
(text.north west) -- (text.south west) --
(text.south east) -- (text.north east);
\end{pgfonlayer}
}
}
% define a new list via tocloft
% \newcounter{examplebox}[chapter]
% \def\theexamplebox{\thechapter.\arabic{examplebox}}
\newlistof[chapter]{examplebox}{exs}{List of Examples}
\cftsetindents{examplebox}{1.5em}{2.3em}
\newenvironment{examplebox}[1][\unskip]{
\refstepcounter{examplebox}
\def\FrameCommand{\ExampleboxframeTotal}
\def\FirstFrameCommand{\ExampleboxframeTop}
\def\MidFrameCommand{\ExampleboxframeMiddle}
\def\LastFrameCommand{\ExampleboxframeBottom}
\vskip\baselineskip
\MakeFramed {\FrameRestore}
\noindent
\tikzset{external/export next=false}
\tikz\node[fill=black,text=white,anchor=west,overlay]
at (0em,2.5em) {Example \theexamplebox \quad #1};%
\addcontentsline{exs}{examplebox}{\protect\numberline{\theexamplebox} #1}%
\ignorespaces
}
{\endMakeFramed}
\newenvironment{dexamplebox}[1][\unskip]{
\refstepcounter{examplebox}
\def\FrameCommand{\ExampleboxframeTotal}
\def\FirstFrameCommand{\ExampleboxframeTop}
\def\MidFrameCommand{\ExampleboxframeMiddle}
\def\LastFrameCommand{\ExampleboxframeBottom}
\vskip\baselineskip
\MakeFramed {\FrameRestore}
\noindent
\tikzset{external/export next=false}
\tikz\node[fill=black,text=white,anchor=west,overlay]
at (0em,2.5em) {Example \theexamplebox\quad #1 \quad\DangerSymbol};%
\addcontentsline{exs}{examplebox}{\protect\numberline{\theexamplebox} #1 \DangerSymbol}%
\ignorespaces
}
{\endMakeFramed}
\theoremstyle{plain}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\normalfont\upshape}
\theoremseparator{.}
\theoremsymbol{\ensuremath{\Box}}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremheaderfont{\normalfont\itshape}
\theoremsymbol{\ensuremath{\bigodot}}
\newtheorem{exercise}{Exercise}[chapter]
\theorembodyfont{\normalfont\itshape}
\theoremsymbol{}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{problem}[theorem]{Problem}
\theorembodyfont{\normalfont\upshape}
\theoremprework{\bigskip\hrule}
\theorempostwork{\hrule\bigskip}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{nonumberplain}
\theoremheaderfont{\normalfont\itshape}
\theoremprework{}
\theorempostwork{}
\newcommand{\QED}{\ensuremath{\blacksquare}}
\qedsymbol{\QED}
\theoremsymbol{\ensuremath{\QED}}
\newtheorem{proof}{Proof}
\theoremsymbol{\ensuremath{\bigodot}}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}
\theoremsymbol{}
\theoremheaderfont{\normalfont\scshape}
\theoremindent1.5em
\newtheorem{ucase}{Case}
\theoremstyle{plain}
\newtheorem{case}{Case}
\theoremindent1.5em
\newtheorem{subcase}{Case}
\numberwithin{subcase}{case}
\newcommand{\ltr}{\noindent\textsc{Left to right}.\ }
\newcommand{\rtl}{\noindent\textsc{Right to left}.\ }
\newcommand{\Automaton}[4][3]{%
\begin{tikzpicture}
\Tree
[.\node(root){#3};
#4
]
\node (label) at ($(root)+(-#1em,0)$) {#2};
\draw[dashed] (label) to (root);
\end{tikzpicture}
}
\newcommand{\Transducer}[6][3]{%
\begin{tikzpicture}
\Tree
[.\node(root){#3};
#4
]
\node (label) at ($(root)+(-#1em,0)$) {#2};
\node (tree) at ($(root)+(#1em,0)$) {%
\Tree
[.\node{#5};
#6
]
};
\foreach \Node in {label,tree}
\draw[dashed] (\Node) to (root);
\end{tikzpicture}
}
\newcommand{\Component}[1]{\ensuremath{\mathit{#1}}}
\newcommand{\Lex}{\Component{Lex}}
\newcommand{\SliceLang}[1]{\ensuremath{\mathrm{FSL}(#1)}}
\newcommand{\SliceRoot}{\ensuremath{\mathit{sliceroot}}}
\newcommand{\Occurrence}[1]{\ensuremath{\mathit{occ}_{#1}}}
\newcommand{\MinimalistOperation}[1]{\ensuremath{\mathit{#1}}}
\newcommand{\Merge}{\MinimalistOperation{merge}}
\newcommand{\Move}{\MinimalistOperation{move}}
\newcommand{\outdom}{\ensuremath{\blacktriangleleft}}
\newcommand{\LogicTransSymb}{\ensuremath{\Phi}}
\newcommand{\GraphTrans}{\LogicTransSymb_{\mathit{gr}}}
\newcommand{\TreeTrans}{\LogicTransSymb_{\mathit{tr}}}
\newcommand{\LcrLim}{\ensuremath{|\gamma|}}
\newcommand{\LceLim}{\ensuremath{|\delta|}}
\newcommand{\LI}{\ensuremath{\mathit{lex}}}
\newcommand{\Feat}{\Component{Feat}}
\newcommand{\match}{\ensuremath{\mathit{match}}}
\newcommand{\CatF}{\ensuremath{\mathit{cat}}}
\newcommand{\binrel}[3]{\ensuremath{#2 \mathrel{#1} #3}}
\newcommand{\notbinrel}[3]{\ensuremath{#2 \not\mathrel{#1} #3}}
\newcommand{\SliceP}{\ensuremath{\mathit{slice}}}
\newcommand{\slicesib}{\ensuremath{\sim}}
\newcommand{\slicedom}{\stackrel{\slicesib}{\idom}}
\newcommand{\FPol}[1]{\ensuremath{\pi(#1)}}
\newcommand{\FType}[1]{\ensuremath{\tau(#1)}}
\newcommand{\FOp}[1]{\ensuremath{\omega(#1)}}
\newcommand{\FName}[1]{\ensuremath{\nu(#1)}}
\newcommand{\PFmapping}{\ensuremath{\pi}}
\newcommand{\LFmapping}{\ensuremath{\lambda}}
% Derivation Tree Commands
\newcommand{\Lab}[3]{\textsuperscript{#2}#1\textsubscript{#3}}
\newcommand{\BLab}[3]{\textsuperscript{#2}#1\boxed{\textsubscript{#3}}}
\newcommand{\IBLab}[3]{\textsuperscript{#2}#1\boxed{\textsubscript{#3}}}
\newcommand{\psep}{\ensuremath{\bullet}}
\newcommand{\expandmark}{\ensuremath{\circ}}
\newcommand{\tsb}[1]{\textsubscript{#1}}
\newcommand{\tsp}[1]{\textsuperscript{#1}}
\newcommand{\placeholders}{\ensuremath{\phi}}
% Derivation Tree Typesetting
\newcommand{\TreeSize}{}
\newcommand{\TreeScale}{.8}
\newcommand{\TreeDistanceValue}{2.3em}
% Metric names
\newcommand{\MaxTen}{\textbf{Max}\xspace}
\newcommand{\MaxLex}{\textbf{Max\tsb{Lex}}\xspace}
\newcommand{\BoxTen}{\textbf{Payload}\xspace}
\newcommand{\BoxLex}{\textbf{Payload\tsb{Lex}}\xspace}
\newcommand{\SumBoxTen}{\textbf{SumTen}\xspace}
\newcommand{\SumBoxLex}{\textbf{SumTen\tsb{Lex}}\xspace}
% Left Corner Relation
\newcommand{\LeftCorner}{\ensuremath{\mathrm{lc}}}
% math hyphen
\mathchardef\mhyphen="2D % Define a "math hyphen"
% Parikh stuff
\newcommand{\ParikhVec}{\ensuremath{p}}
\newcommand{\ParikhMap}{\ensuremath{\hat{p}}}
% Natural numbers
\newcommand{\NatNum}{\ensuremath{\mathbb{N}}}