-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.tex
266 lines (225 loc) · 7.89 KB
/
macros.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
\makeatletter
\newif\ifsvmono
\@ifclassloaded{svmono}{\svmonotrue}{\svmonofalse}
\usepackage{braket}
\ifsvmono\else
\usepackage[top=6pc, % 1762.2 pc^2 = 508.825 pc^2 more than SV pages
textheight=8.9in, % 53.4 pc
textwidth=33pc,
inner=6pc,
marginparwidth=9pc,
marginparsep=1.5pc]{geometry}
\fi
\usepackage[backend=biber,
hyperref=true,
maxbibnames=100,
sorting=nyt]{biblatex}
\usepackage[12hr,us]{datetime}
\usepackage[inline]{enumitem}
\usepackage{blkarray}
%\usepackage{amsthm,corollaries}
\usepackage{amsthm}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\usepackage{textcomp} % fixes odd symbols siunitx uses...
\usepackage{siunitx}
\usepackage{ifpdf}
\usepackage{cancel}
\usepackage[final]{graphicx}
\usepackage{titlesec}
\ifpdf
%\usepackage{microtype}
\DeclareGraphicsRule{*}{mps}{*}{}
\fi
\usepackage{makeidx}
\usepackage[chapter]{tocbibind}
\usepackage[hidelinks,plainpages=false]{hyperref}
\numberwithin{equation}{chapter}
\ifpdf
\hypersetup{pageanchor=false,
pdfinfo={
Author={Alex Nelson},
Title={Notes on Physics},
CreationDate={D:20140421183832}
}}
\fi
\sisetup{detect-all,
input-digits = 0123456789\pi}
\newcommand\svcr{\ifsvmono\\\else\fi}
%% bibliography related macros
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat{pages}{#1}
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
% \setunit*{\adddot}% DELETED
\setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\renewcommand*{\bibfont}{\small}
\addbibresource{bib/classicalMechanics.bib}
\addbibresource{bib/qg.bib}
\addbibresource{bib/gr.bib}
\addbibresource{bib/qm.bib}
\addbibresource{bib/qft.bib}
\addbibresource{bib/qcd.bib}
\addbibresource{bib/field.bib}
\addbibresource{bib/math.bib}
%% author info
\def\homeurl{\url{https://github.com/pqnelson/physics-notes}}
\ifsvmono\else
\author{Alex Nelson%
\footnote{This is a page from \homeurl\hfil\break%
\indent\;\, Compiled:\enspace\today\ at \currenttime\ (PST)}\\%
\texttt{Email:\enspace\href{mailto:pqnelson@gmail.com}{pqnelson@gmail.com}}}
\fi
% fonts for the sections
\titleformat{\chapter}[display]
{\large\sffamily} % format
{\chaptertitlename\ \thechapter} % label
{20pt} % sep
{\filleft\Large\bfseries} % before
\titlespacing*{\chapter}
{0pt}{4pc}{2pc}
\titleformat*{\section}{\large\bfseries\sffamily}
\titleformat*{\subsection}{\large\bfseries\sffamily}
\titleformat*{\subsubsection}{\bfseries\sffamily}
\ifsvmono
\titlespacing*{\section}{0pt}{2.3ex}{1.8ex}
\titlespacing*{\subsection}{0pt}{1.5ex}{1.05ex}
\titlespacing*{\subsubsection}{0pt}{1.5ex}{1.05ex}
\else
\fi
% bibliography commands
\@ifundefined{bysame}{
\def\bysame{\leavevmode \hbox to3em{\hrulefill }\thinspace}
}{}
% chunking commands
\@ifundefined{@addpunct}{
\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi}
\def\frenchspacing{\sfcode`\.1006\sfcode`\?1005\sfcode`\!1004 \sfcode`\:1003\sfcode`\;1002\sfcode`\,1001 }
}{}
\ifsvmono\frenchspacing\else\fi
\let\oldDelta\Delta
\ifsvmono\let\Delta\varDelta\else\fi
\newcounter{chunk@ctr}
\@ifundefined{chapter}{%
\@addtoreset{chunk@ctr}{section}
}{%
\@addtoreset{chunk@ctr}{chapter}
}
\def\chunkprefix{\@ifundefined{chapter}{%
\ifnum\value{section}>0 \oldstylenums{\arabic{section}}.\else{}\fi
}{%
\ifnum\value{chapter}>0 \oldstylenums{\arabic{chapter}}.\else{}\fi
}}
\renewcommand\thechunk@ctr{\chunkprefix\oldstylenums{\arabic{chunk@ctr}}}
\newcommand\M{\medbreak\noindent%
\refstepcounter{chunk@ctr}%
\textbf{\thechunk@ctr\@addpunct{.}}\quad\ignorespaces}
\def\N{\@ifstar
\NStar%
\NNoStar%
}
\def\NStar#1{\medbreak\noindent\textbf{#1\@addpunct{.}\quad}\ignorespaces}
\def\NNoStar{\@ifnextchar[\NNoStarBracket\NNoStarNoBracket}
\def\NNoStarBracket[#1]#2{\M\textbf{#2}\enspace(#1)\textbf{\@addpunct{.}\quad}\ignorespaces}
\def\NNoStarNoBracket#1{\M\textbf{#1\@addpunct{.}\quad}\ignorespaces}
\def\Mref#1{\@ifundefined{hyperref}%
{\textup{\tagform@{\S\ref{#1}}}}%
{\hyperref[#1]{\textup{(\S\ref*{#1})}}}}
% theorems and whatnot
\newtheoremstyle{thmstyle}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{\itshape} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{1em plus 1pt minus 1pt} % HEADSPACE
{\thmnumber{#2\@addpunct{.}\enspace}\thmname{#1}\thmnote{\enspace\textrm{\normalfont(#3)}}} % CUSTOM-HEAD-SPEC
\newtheoremstyle{defnstyle}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{1em plus 1pt minus 1pt} % HEADSPACE
{\thmnumber{#2\@addpunct{.}\enspace}\thmname{#1}\thmnote{\enspace\textrm{\normalfont(#3)}}} % CUSTOM-HEAD-SPEC
\newtheoremstyle{rmkstyle}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\itshape} % HEADFONT
{.} % HEADPUNCT
{1em plus 1pt minus 1pt} % HEADSPACE
{\thmnumber{#2\@addpunct{.}\enspace}\thmname{#1}\thmnote{\enspace\textrm{\normalfont(#3)}}} % CUSTOM-HEAD-SPEC
% case, conjecture, corollary, definition, example, exercise, lemma, note,
% problem, property, proposition, question, remark, solution, theorem.
\theoremstyle{plain}
\newtheorem{puzzle}{Puzzle}
\theoremstyle{thmstyle}
\newtheorem{theorem}[chunk@ctr]{Theorem}
\newtheorem{lemma}[chunk@ctr]{Lemma}
\newtheorem{proposition}[chunk@ctr]{Proposition}
\newtheorem{corollary}[chunk@ctr]{Corollary}
\let\thm\theorem
\let\endthm\endtheorem
\let\prop\proposition
\let\endprop\endproposition
\theoremstyle{defnstyle}
\newtheorem{xca}[chunk@ctr]{Exercise}
\newtheorem{ex}[chunk@ctr]{Example}
\newtheorem{definition}[chunk@ctr]{Definition}
\let\defn\definition
\let\enddefn\enddefinition
\theoremstyle{rmkstyle}
%\newcorollary{remark}{Remark}[chunk@ctr]
\newtheorem{remark}{Remark}[chunk@ctr]
\let\rmk\remark
\let\endrmk\endremark
\renewcommand\theremark{\thechunk@ctr.\oldstylenums{\arabic{remark}}}
\newenvironment{soln}{\begin{proof}[Solution\@addpunct{.}]}{\end{proof}}
% arXiv links
\def\arXiv{\@ifnextchar[{\@arXivWith}{\@arXivWithout}}
\def\@arXivWith[#1]#2{\texttt{\href{http://arxiv.org/abs/#2}{arXiv:#2} [#1]}}
\def\@arXivWithout#1{\texttt{\href{http://arxiv.org/abs/#1}{arXiv:#1}}}
\def\doi#1{\texttt{\href{http://dx.doi.org/#1}{doi:#1}}}
% dangerous bends
\@ifundefined{dbend}{\font\manual=manfnt %
\def\dbend{{\manual\char127}} % dangerous bend sign
}{}
% Danger, Will Robinson!
\newenvironment{danger}{\medbreak\noindent\hangindent=2pc\hangafter=-2%
\clubpenalty=10000%
\hbox to0pt{\hskip-\hangindent\dbend\hfill}\small\ignorespaces}%
{\medbreak\par}
% Danger! Danger!
\newenvironment{ddanger}{\medbreak\noindent\hangindent=3pc\hangafter=-2%
\clubpenalty=10000%
\hbox to0pt{\hskip-\hangindent\dbend\kern2pt\dbend\hfill}\small\ignorespaces}%
{\medbreak\par}
\def\quoteAuthor#1(#2){\par\nobreak\smallskip\noindent\textup{--- #1\unskip\enspace(#2)}}
\let\oldauthor\author
%\def\quotes
\newenvironment{quotes}{\medbreak\footnotesize\baselineskip 10pt
\raggedleft\parfillskip \z@
\interlinepenalty 10000
%\leftskip \z@ plus 40pc minus \parindent
\sffamily\slshape\obeylines
\let\author\quoteAuthor}%
{\par\let\author\oldauthor}
\def\define#1{``\textbf{#1}''}
\def\workedExamples{\subsection*{\phantomsection\addcontentsline{toc}{subsection}{Worked Examples}Worked Examples}}
\def\TODO#1{\marginpar{\footnotesize TODO:~#1}}
\ifsvmono\else\def\preface{\chapter{Preface}}\fi
\newcommand\IDENTIFY{\textsc{Identify:}\ }
\newcommand\IDandSETUP{\textsc{Identify and Set Up:}\ }
\newcommand\SETUP{\textsc{Set Up:}\ }
\newcommand\EXECUTE{\textsc{Execute:}\ }
\newcommand\EVALUATE{\textsc{Evaluate:}\ }
\makeatother