-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpreamble.sty
359 lines (335 loc) · 12 KB
/
preamble.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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
\ProvidesPackage{preamble}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage[americanresistors,americaninductors]{circuitikz}
\usepackage{ifthen}
\usepackage{amsmath}
\usepackage[top=10mm, bottom=10mm, left=25.4mm, right=25.4mm,includehead,includefoot]{geometry}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{physics}
\usepackage{siunitx}
\usepackage{float}
\usepackage{scalerel}
\usepackage{ltxtable}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage{filecontents}
\usepackage{mathtools}
\usepackage{ltxtable}
\usepackage{array}
\usepackage{fancyhdr}
\usepackage{pgfplots}
\usepackage{mhchem}
\newcommand{\defined}{\overset{\underset{\mathrm{def}}{}}{=}}
\DeclareMathOperator{\di}{d\!}
\newcommand*\Eval[3]{\left.#1\right\rvert_{#2}^{#3}}
\usepackage{amsthm}
\usepackage{stackengine}
\newcommand\momentL[1]{\stackengine{-.3ex}{#1}{\CAL}{0}{c}{F}{F}{L}}
\newcommand\CAL{\scalebox{2}{\rotatebox[origin=center]{90}{$\circlearrowleft$}}}
\newcommand\momentR[1]{\stackengine{-.3ex}{#1}{\CAR}{0}{c}{F}{F}{L}}
\newcommand\CAR{\scalebox{2}{\rotatebox[origin=center]{90}{$\circlearrowright$}}}
\stackMath
\sisetup{range-phrase=-,range-units=single}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\pgfplotsset{height=10cm,width=10cm,compat=1.14}
\usetikzlibrary{circuits.ee.IEC}
\tikzset{circuit declare symbol = ac current source}
\tikzset{
ac current source IEC graphic/.style={
circuit symbol lines,
circuit symbol size = width 2 height 2,
shape = generic circle IEC,
/pgf/generic circle IEC/before background={
\pgfpathmoveto{\pgfpoint{-0.8pt}{0pt}}
\pgfpathsine{\pgfpoint{0.4pt}{0.4pt}}
\pgfpathcosine{\pgfpoint{0.4pt}{-0.4pt}}
\pgfpathsine{\pgfpoint{0.4pt}{-0.4pt}}
\pgfpathcosine{\pgfpoint{0.4pt}{0.4pt}}
\pgfusepath{stroke}
},
transform shape
}
}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\cis}{\mathrm{cis}}
\newcommand{\vi}{\vec{\imath}}
\newcommand{\vj}{\vec{\jmath}}
\newcommand{\vk}{\vec{k}}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage[framed, numbered]{matlab-prettifier}
\usepackage{fancyhdr}
\usepackage{amsthm}
\usepackage[shortlabels]{enumitem}
\usepackage{pgfplotstable}
\usepackage[]{graphics}
\DeclareMathOperator{\sinc}{sinc}
\DeclareMathOperator{\cosc}{cosc}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\tikzset{
% style to apply some styles to each segment of a path
on each segment/.style={
decorate,
decoration={
show path construction,
moveto code={},
lineto code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
},
curveto code={
\path [#1] (\tikzinputsegmentfirst)
.. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
..
(\tikzinputsegmentlast);
},
closepath code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
},
},
},
% style to add an arrow in the middle of a path
mid arrow/.style={postaction={decorate,decoration={
markings,
mark=at position .5 with {\arrow[#1]{stealth}}
}}},
}
\DeclareSIUnit\grates{grates}
\newcommand{\defi}{\overset{\underset{\mathrm{def}}{}}{=}}
\newcommand{\findmax}[1]{
\pgfplotsforeachungrouped \table in {#1} {%
\pgfplotstablevertcat{\concatenated}{\table}%
}%
\pgfplotstablesort[sort key={1},sort cmp={float >}]{\sorted}{\concatenated}%
\pgfplotstablegetelem{0}{1}\of{\sorted}%
\let\ymax=\pgfplotsretval%
}
\newcommand{\findmin}[1]{
\pgfplotsforeachungrouped \table in {#1} {%
\pgfplotstablevertcat{\concatenated}{\table}%
}%
\pgfplotstablesort[sort key={1},sort cmp={float <}]{\sorted}{\concatenated}%
\pgfplotstablegetelem{0}{1}\of{\sorted}%
\let\ymin=\pgfplotsretval%
}
\makeatletter \renewcommand\d[1]{\ensuremath{%
\;\mathrm{d}#1\@ifnextchar\d{\!}{}}}
\makeatother
\colorlet{Tangent}{blue!75!black}
\usetikzlibrary{
calc,
intersections,
math,
}
\makeatletter
\def\parsenode[#1]#2\pgf@nil{%
\tikzset{label node/.style={#1}}
\def\nodetext{#2}
}
\tikzset{
% define style for the points
Point/.style={
shape=circle,
inner sep=0pt,
minimum size=3pt,
},
add node at x/.style 2 args={
name path global=plot line,
/pgfplots/execute at end plot visualization/.append={
\begingroup
\@ifnextchar[{\parsenode}{\parsenode[]}#2\pgf@nil
\path [name path global = position line #1-1]
({axis cs:#1,0}|-{rel axis cs:0,0}) --
({axis cs:#1,0}|-{rel axis cs:0,1});
\path [xshift=1pt, name path global = position line #1-2]
({axis cs:#1,0}|-{rel axis cs:0,0}) --
({axis cs:#1,0}|-{rel axis cs:0,1});
\path [
name intersections={
of={plot line and position line #1-1},
name=left intersection
},
name intersections={
of={plot line and position line #1-2},
name=right intersection
},
label node/.append style={pos=1}
] (left intersection-1) -- (right intersection-1)
node [label node]{\nodetext};
% ---------------------------------------------------------
% draw the tangent line from a bit right of the point on
% the curve to the intersection with the ordinate
% and draw the corresponding points
\draw [Tangent] let
\p1=($ (left intersection-1) - (right intersection-1) $),
\p2=($ (left intersection-1)!sign(#1)*5mm!(right intersection-1) $),
\p3=($ ({axis cs:0,0}) - (\p2) $),
\n1={\x3/\x1}
in
(\p2) -- +($ {\n1}*(\x1,\y1) $)
% node [Point,fill=Tangent] (origin intersection) {}
% node [Point,fill=Curve] at (left intersection-1) {}
;
% % ----------
% % draw the horizontal line at the curve intersection point
% % plus the label above/below the line
% \tikzmath{
% coordinate \c1;
% \c1=(left intersection-1) - (right intersection-1);
% \slope=\cy1/\cx1*sign(#1);
% }
% \pgfmathsetmacro{\AboveBelow}{ \slope>0 ? "above" : "below" }
% \draw [dotted]
% ([xshift=sign(#1)*2.5mm] left intersection-1) --
% (left intersection-1) --
% node [\AboveBelow,node font=\scriptsize] {$f(x)$}
% (left intersection-1 -| origin intersection) --
% +($ sign(#1)*(-2.5mm,0) $)
% coordinate [pos=0.5] (a)
% ;
% % draw the horizontal line at the ordinate intersection point
% \draw [dotted] (origin intersection)
% +($ sign(#1)*(-2.5mm,0) $) --
% (origin intersection);
% % draw vertical line left/right of the ordinate
% \pgfmathsetmacro{\LeftRight}{ #1<0 ? "right" : "left" }
% \draw [stealth-stealth] (origin intersection)
% +($ sign(#1)*(-1.25mm,0) $) -- (a)
% node [midway,\LeftRight,node font=\scriptsize] {$p$}
% ;
% % ---------------------------------------------------------
\endgroup
},
},
}
\makeatother
\makeatletter
\pgfplotsset{
/tikz/max node/.style={,
anchor=south west,
},
/tikz/min node/.style={
anchor=north,
name=minimum
},
mark min/.style={
point meta rel=per plot,
visualization depends on={x \as \xvalue},
scatter/@pre marker code/.code={%
\ifx\pgfplotspointmeta\pgfplots@metamin
\def\markopts{}%
\coordinate (minimum);
\node [min node] {
(\pgfmathprintnumber[fixed]{\xvalue},%
\pgfmathprintnumber[fixed]{\pgfplotspointmeta})
};
\else
\def\markopts{mark=none}
\fi
\expandafter\scope\expandafter[\markopts,every node near coord/.style=green]
},%
scatter/@post marker code/.code={%
\endscope
},
scatter,
},
mark max/.style={
point meta rel=per plot,
visualization depends on={x \as \xvalue},
scatter/@pre marker code/.code={%
\ifx\pgfplotspointmeta\pgfplots@metamax
\def\markopts{}%
\coordinate (maximum);
\node [max node] {
(\pgfmathprintnumber[fixed]{\xvalue},%
\pgfmathprintnumber[fixed]{\pgfplotspointmeta})
};
\else
\def\markopts{mark=none}
\fi
\expandafter\scope\expandafter[\markopts]
},%
scatter/@post marker code/.code={%
\endscope
},
scatter
}
}
\makeatother
\newenvironment{polynomial}
{\par\vspace{\abovedisplayskip}%
\setlength{\leftskip}{\parindent}%
\setlength{\rightskip}{\leftskip}%
\medmuskip=4mu plus 2mu minus 2mu
\binoppenalty=0
\noindent$\displaystyle}
{$\par\vspace{\belowdisplayskip}}
\usepackage{hyperref}
\makeatletter
\newcommand\appendix@section[1]{%
\refstepcounter{section}%
\orig@section*{Appendix \@Alph\c@section: #1}%
\addcontentsline{toc}{section}{Appendix \@Alph\c@section: #1}%
}
\let\orig@section\section
\g@addto@macro\appendix{\let\section\appendix@section}
\makeatother
\usepackage{array}
%\usepackage{minted}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\tikzset{
% style to apply some styles to each segment of a path
on each segment/.style={
decorate,
decoration={
show path construction,
moveto code={},
lineto code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
},
curveto code={
\path [#1] (\tikzinputsegmentfirst)
.. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
..
(\tikzinputsegmentlast);
},
closepath code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
},
},
},
% style to add an arrow in the middle of a path
mid arrow/.style={postaction={decorate,decoration={
markings,
mark=at position .5 with {\arrow[#1]{stealth}}
}}},
}
\usepackage{url}
\usepackage[square,numbers]{natbib}
\bibliographystyle{abbrvnat}
\usepackage[nottoc]{tocbibind}
\usepackage{pdfpages}
\usepackage{sectsty}
\usepackage{gensymb}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\newcommand{\notetoself}[1]{\color{red}\Large{\textbf{\textit{TODO: #1}}}\normalsize\color{black}} % make temporary text inclusions big and red