forked from yochju/general_relativity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlmcommon.sty
542 lines (521 loc) · 27.3 KB
/
lmcommon.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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
% lmcommon.sty
% This is meant to contain code shared by all my books. Stuff that's not applicable to DP and SN
% goes in lmseries.cls. However, not all shared code is in here; some is in
% lmfigs.sty, ... I haven't actually made DP and SN use this yet, and I
% always tried to err on the side of putting too much in here, so there is
% undoubtedly some stuff in here that is actually not appropriate to share with
% SN and DP. In particular, I left a bunch of hw stuff in here (difficulty symbols,...)
% that is not right for SN. Rather then making SN and DP use this, what's turning out
% to be more practical is to take functionality out of this file and put it in small,
% maintainable chunks, which are then used by all the books.
%
% notes on wrapfig:
% wrapfig: for 2 figs in a row, both need to be in same wrapfig
% wrapfig doesn't work in a theorem environment, so can't implement dqs and egs as thms
% do wrapfig just before first line of a para
% I thought it was messing up (positioning too far down) if I used it near a sectioning
% command, but that doesn't seem to be the case. Sometimes works if you put it right
% above the sectioning command. Other times when I thought it was a problem with the
% sectioning command, changing the sectioning command to a styling command didn't help.
%
% example of how to do explanatory text in square brackets to the right of an equation:
% \begin{multline*}
% v_t = \omega r \qquad . \hfill
% \shoveright{\text{[tangential velocity of a point at a}}\\
% \text{distance $r$ from the axis of rotation]}
% \end{multline*}
% For really long notes, use longnoteafterequation environment.
%
% Summary of my sectioning:
% \mychapter{}, all words with initial caps in title
% \mysection{}, all words with initial caps in title; first section in a chapter needs \mysection[0]{}
% \begin{envsubsection}{} or \begin{envsubsection}[x]{}, only first word in title capitalized
% \subsubsection{}, only first in title word capitalized
%
% Notes about design:
% Subsections and subsubsections are not numbered.
% Only capitalize first word of example titles, subsections.
% Subfigures are numbered 1, 2, etc, in 9-point Helv, captions labeled like "1" or "1. blah"
% Figures are numbered within sections. (This could result in high letters,
% but doing subsections leads to incongruous starting over from "a.")
% All figures have to have captions, since otherwise "c/" looks bare.
% Where L&M had a series of panels (a), (b), ..., SN has
% a single letter, but a series of subfigures 1, 2, etc.
% Refer to subfigs as a/1, etc. Subfigs without captions have (1), ... inside the figure.
% Text within figures is 10-point Helvetica, except labels 1, 2, etc. All text within figures
% is upright, even math variables.
% Punctuation after displayed equations: \qquad in between.
% Subscripts are italic, since this is what LaTeX makes it easy for me to do.
% Equation numbers, when used, go on the left, to allow room for notes on the
% right. Equation numbers are in square brackets,
% numbered within sections.
% Problem with equation numbers in examples: not indented, and not in sans.
% page breaks:
% mysection makes a pagebreak by default, but can give it an optional parameter
% to make it less likely to happen.
% subsection environment makes a pagebreak[3] by default, which usually doesn't result
% in a pagebreak, but can use optional argument 4 to force it
% Introducing page breaks always seems to make equations get spaced out a whole
% bunch, which looks stupid. This seems to happen even if I sprinkle
% \myeqnspacing all over the place. The solution is to precede the page
% break with a \vfill.
% Differentials and vectors are upright. Can do bold vectors with \boldmath outside of math mode,
% or \mathbf or \boldsymbol in math mode.
% Paragraph indentation: Turning off paragraph indentation gives a cleaner look, because
% everything on the page is a nice rectangle. However, in the main text, turning it
% off makes the page look scarier: your eye doesn't see any landmarks. Also, if para
% indentation is turned off, your only cues for seeing para divisions is the extra space
% between them, and then equations look like paragraph breaks. Decision: leave 6 mm
% paragraph indentation in main text, but turn it off in most other places (examples,
% self-checks, homework problems, exercises).
% In example title, first letter of first word is capitalized.
% When an example has more than one part, number them (1), (2),...
%
% Figures mostly in Adobe Illustrator 6 EPS. In some cases, I've saved them as
% Illustrator 1 EPS to save space; however, it isn't possible to do this with
% figures that have text in them, because, at least on my MacOS 9/X system,
% Illustrator gets confused about the fonts. (Also, named colors are lost
% in Illustrator 1 EPS.)
%
% I've activated pdflatex's margin kerning feature. For the fonts used in this
% book, I decided that the margins appeared straightest when I modified
% protcode.tex to use half the amount of margin kerning that was supplied by
% default. (One expects this to be completely dependent on the font and size.)
\RequirePackage{mytocloft,titlesec,titletoc,multicol,makeidx,wrapfig,fancyhdr,calc,amssymb,moreverb,ifthen,lmmath,mathrsfs,framed,alphalph,cancel,shaddap,navigator}
% used to include isolatin1, but now that causes error?
\RequirePackage{color}% ---- see pdftex mailing list, 2004 May 22-23
% Notes:
% tocloft -- Using this has the effect, which I want, of suppressing the mandatory clearpage before the table of contents.
\renewcommand{\sfdefault}{phv}
% ... helvetica for sans serif; this has to come before sansmath.sty
\RequirePackage[EULERGREEK]{sansmath}
% ... sansmath.sty by Donald Arseneau, to be released ca. 3/2002.
% The EULERGREEK option is necessary with Helvetica, because otherwise
% there is no uppercase Greek. He actually doesn't recommend using sansmath.sty
% with Helvetica, since some of the symbols match the letters poorly, but
% I had hundreds of preexisting figures with Helvetica in them.
\RequirePackage[leqno]{amsmath}
\usepackage[french,english]{babel}
\RequirePackage[absolute]{textpos}% ---- http://nxg.me.uk/dist/textpos/
% The following line is for margin kerning. There is more stuff
% relating to margin kerning after the begin{document}, and that's
% where to go if I want to turn it off.
\newboolean{wantmarginkerning}
\setboolean{wantmarginkerning}{true}
\newcommand{\inputprotcode}{\ifthenelse{\boolean{wantmarginkerning}}{\input protcode.tex}{}}
\definecolor{shadecolor}{gray}{.9} % for framed.sty
\newcommand{\degfunit}{\degunit\textup{F}}
% ----------------
\newcommand{\zerosizebox}[3]{
\makebox[0mm][l]{%
\hspace{#1}%
\raisebox{0mm}[0mm][0mm]{% used to have #2 as 1st arg, but it went the wrong direction!
\makebox[0mm][l]{%
\begin{minipage}{8.5in}
\vspace{#2}#3
\end{minipage}%
}%
}%
}%
}%
% ----------------
\newcommand{\getreadyforbackmatter}{\nomarginlayout\onecolumn\setlength{\parindent}{0mm}}
%-------------------- counters -------------------
\newcounter{figctr}[chapter] % for my roll-your-own captions
\newcounter{appendixctr}
\newcounter{labctr}[chapter]
\newcounter{labpartctr}[section]
\newcounter{prelabctr}[section]
\renewcommand{\thedqctr}{\Alph{dqctr}}
\renewcommand{\thefigctr}{\alphalph{\value{figctr}}}
\renewcommand{\thelabctr}{\alph{labctr}}
\renewcommand{\thelabpartctr}{\Alph{labpartctr}\quad}
%-------------------- numbered equations ----------------
\newenvironment{numberedequations}{\setcounter{equation}{0}}{}
\newcommand{\photocreditsboilerplate}{%
Except as specifically noted below or in a parenthetical credit in the
caption of a figure, all the illustrations in this book are
under my own copyright, and are copyleft licensed under the same license
as the rest of the book.
In some cases it's clear from the date that the
figure is public domain, but I don't know the name of the artist or photographer; I would
be grateful to anyone who could help me to give proper credit.
I have assumed that images
that come from U.S. government web pages are copyright-free, since products
of federal agencies fall into the public domain.
I've included some
public-domain paintings; photographic reproductions of them are not
copyrightable in the U.S. (Bridgeman Art Library, Ltd. v. Corel Corp.,
36 F. Supp. 2d 191, S.D.N.Y. 1999).
When ``PSSC Physics'' is given as a credit, it indicates that the figure
is from the first edition of the textbook entitled Physics, by the
Physical Science Study Committee.
The early editions of these books never had their copyrights renewed, and
are now therefore in the public domain. There is also
a blanket permission given in the later PSSC College Physics edition, which states
on the copyright page that ``The materials taken from the original and second
editions and the Advanced Topics of PSSC PHYSICS included in this text
will be available to all publishers for use in English after December 31, 1970,
and in translations after December 31, 1975.''
Credits to Millikan and Gale refer to the textbooks Practical Physics (1920) and
Elements of Physics (1927). Both are public domain. (The 1927 version did not have
its copyright renewed.) Since it is possible that some of the illustrations in
the 1927 version had their copyrights renewed and are still under copyright, I
have only used them when it was clear that they were originally taken from public
domain sources.
In a few cases, I have made use of images under the fair use doctrine. However,
I am not a lawyer, and the laws on fair use are vague, so you should not assume
that it's legal for you to use these images. In particular, fair use law may
give you less leeway than it gives me, because I'm using the images for
educational purposes, and giving the book away for free. Likewise, if the
photo credit says ``courtesy of ...,'' that means the copyright owner gave
me permission to use it, but that doesn't mean you have permission to use it.}
%
\newcommand{\dedication}[1]{\zerosizebox{0mm}{140mm}{#1}}
%========================= sans serif math stuff =========================
% sansmath.sty takes care of it. The following is just to get back to normal
% math mode:
\newcommand{\lmserifmath}{\mathversion{normal}\everymath{}\everydisplay{}}
%========================= design =========================
\definecolor{secnumgray}{gray}{.55}
\newcommand{\showsecnum}[1]{\color{secnumgray}#1}
\titlespacing*{\chapter}{0mm}{4mm}{6mm}
\titlespacing*{\section}{0mm}{4mm}{0mm}
\titlespacing{\subsection}{0mm}{1mm}{-0.5mm}
\titlespacing{\subsubsection}{0mm}{1mm}{-0.5mm}
\newcommand{\formatlikechapter}[1]{\huge{\bfseries{\sffamily{#1}}}\normalsize\normalfont}
\newcommand{\formatlikesection}[1]{\vspace{2.5mm}\Large{\bfseries{\sffamily{#1}}}\normalsize\normalfont}
\newcommand{\formatlikesubsection}[1]{\bfseries{\sffamily{#1}}\normalsize\normalfont}
\newcommand{\formatlikesubsubsection}[1]{\textsl{#1}\normalsize\normalfont}
\newcommand{\startscanswers}[1]{\pagebreak[4]\noindent\formatlikesection{\langscansch{} \ref{#1}}\nopagebreak\par}
\newcommand{\dqheaderformat}[1]{\pagebreak[1]\noindent\formatlikesubsection{#1}\nopagebreak\par}
\newcommand{\startdq}{\dqheaderformat{\langdq}}
\newcommand{\startdqs}{\dqheaderformat{\langdqs}}
\newcommand{\startdqswithintro}[1]%
{\pagebreak[1]\noindent\formatlikesubsection{\langdqs}\nopagebreak\noindent{\small\sffamily\nopagebreak\\*\noindent #1}}
\newenvironment{dq}{%
\refstepcounter{dqctr}\noindent\small\sffamily\textbf{\thedqctr}\myeqnspacing\protect\sansmath%
\setlength{\parindent}{0mm}%undone by normalparafmt
}%
{%
\normalparafmt
\lmserifmath\par\myeqnspacing
}
%Summary appendix:
\newcommand{\summarych}[2]{\noindent\formatlikesection{Chapter \ref{#1}, #2, page \pageref{#1}}\label{summary#1}\\}
\newcommand{\sumem}[1]{\emph{#1}}
\newcommand{\hwanssection}[1]{\vspace{4mm}\noindent\formatlikesection{#1}}
\newcommand{\beginsolutions}[1]{\pagebreak[3]\vspace{2mm}\noindent\formatlikesubsection{\langsolforch{} #1}\\*}%Solutions for Chapter
\newcommand{\beginscanswers}[1]{\pagebreak[3]\vspace{2mm}\noindent\formatlikesubsection{\langscansch{} #1}\\*}%Answers to Self-Checks for Chapter
\newcommand{\hwsolnhdr}[1]{\noindent\textbf{\langpage{} \pageref{hw:#1}, \langprob{} \ref{hw:#1}:}\ \label{soln:#1}}% Page xxx, problem yyy.
\newcommand{\scanshdr}[1]{\noindent\textbf{\langpage{} \pageref{sc:#1}, \langselfcheck{} \ref{sc:#1}:}\ \label{scans:#1}}%Page xxx, self check yyy.
%-------------------- summary -------------------------
\newcommand{\summaryleaders}{\leaders\hbox to 0.7 em{\hss.\hss}\hfill}% TeXBook, p. 223
\newcommand{\summarysubsectionheader}[1]{\noindent\formatlikesubsection{#1}}
\newenvironment{summarysubsectiontab}[1]{\summarysubsectionheader{#1}\\*\begin{tabular}{p{30mm}p{77mm}}}{\end{tabular}}
% ...............................................................................If I change it so the sum isn't 30+77, have to change all
% ............................................................................... summarysectiontabw and vocabw macros, too.
\newenvironment{summarysubsectiontabw}[3]{\summarysubsectionheader{#1}\\*\begin{tabular}{p{#2}p{#3}}}{\end{tabular}}
% The summary section is supposed to be like any other section, but not numbered.
% addtocontents: see Lamport, p. 176
\newenvironment{summary}{
\vfill % in last section, on previous page
\setcounter{secnumdepth}{0} % Don't number this section.
\renewcommand{\printthesection}{} % Footers should read ``Summary,'' not ``Section X.Y Summary''
\mysection{\langsummary} % Has the side-effect of generating a page break.
\setcounter{secnumdepth}{2} % Start numbering sections again.
% The \setcounter{secnumdepth} stuff is the way the author of titlesec suggests doing
% this. Using section* messes up footers & toc.
}%
{\vfill}
%
\newenvironment{vocab}{\begin{summarysubsectiontab}{\langselvocab}}{\end{summarysubsectiontab}}
\newenvironment{vocabw}[2]{\begin{summarysubsectiontabw}{\langselvocab}{#1}{#2}}{\end{summarysubsectiontabw}}
\newcommand{\vocabitem}[2]{#1\summaryleaders {} & #2\\}
\newenvironment{notation}{\begin{summarysubsectiontab}{\langnotation}}{\end{summarysubsectiontab}}
\newenvironment{othernotation}{\begin{summarysubsectiontab}{\langothernotation}}{\end{summarysubsectiontab}}
\newcommand{\notationitem}[2]{#1\summaryleaders {} & #2\\}
\newenvironment{summarytext}[1][Summary]{\ifthenelse{\equal{#1}{}}{}{\summarysubsectionheader{#1}}}{}
%...use \begin{summarytext}[] as in ch. 8 of NP, where we don't want Summary twice in a row
\newenvironment{exploring}{\summarysubsectionheader{\langexploring}\par}{}
\newenvironment{reading}[2]{\noindent {\textbf{#1}}, #2. }{\par}
%---------------------------------------------------------------------------------------------------------------------------------------
%-------------------- fancyhdr -------------------
\newcommand{\yesiwantarabic}{\renewcommand{\thepage}{\arabic{page}}}
\renewcommand{\headrulewidth}{0mm}
\renewcommand{\footrulewidth}{0mm}
%\setlength{\headrulewidth}{0mm}
\newcommand{\printthesection}{Section\ \thesection} % for titlesec, hw environment
% LaTeX companion, p. 96
% Force headings outward, so they're not confined to text column:
\setlength{\headwidth}{\textwidth}
\addtolength{\headwidth}{\marginfigoverhang}
\newlength{\myfooterspace}
\setlength{\myfooterspace}{5mm}
\newlength{\myfooterspacep}
\setlength{\myfooterspacep}{19mm}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]%
{\markboth{\textsf{Chapter\ \thechapter\hspace{\myfooterspace}#1}}{}}
\newcommand{\blankchaptermarks}{
\renewcommand{\chaptermark}[1]%
{\markboth{}{}}
}
\newcommand{\startoptionalchapters}{%
\setcounter{chapter}{0}%
\renewcommand{\thechapter}{\Alph{chapter}}%
\renewcommand{\thesection}{\Alph{chapter}.\arabic{section}}%
}
\renewcommand{\thepart}{\Roman{part}}
\newcommand{\optionalchapternote}[1]{\emph{#1}}
\renewcommand{\sectionmark}[1]%
{\markright{\textsf{\printthesection\hspace{\myfooterspace}#1}}{}}
\newcommand{\myheadertext}{}
\lhead[\myheadertext]{}
\chead[]{}
\rhead[]{\myheadertext}
\lfoot[\textbf{\textsf{\thepage}} \hspace{\myfooterspacep} \nouppercase{\textsf{\leftmark}}]{}
\cfoot[]{}
\rfoot[]{\nouppercase{\textsf{\rightmark}} \hspace{\myfooterspacep} \textbf{\textsf{\thepage}}}
\fancypagestyle{plain}{%
\fancyfoot{} %
%\fancyfoot[R]{\textbf{\textsf{\thepage}}}%
}
%-------------------- preface
\newenvironment{preface}{%
\renewcommand{\thesection}{\hspace{-2mm}} % kludge!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\renewcommand{\printthesection}{} % Footers should read ``Preface,'' not ``Section Preface''
}
{%
\renewcommand{\printthesection}{Section\ \thesection} % for titlesec, hw environment
}
\newcommand{\wugga}{\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}}
%-------------------- epigraph commands -------------------
\newcommand{\epigraphlong}[2]{
\noindent{}\myindented{10mm}{\textsf{#1}}\par
\noindent{}\hfill \textsf{\textit{#2}}
}
\newcommand{\epigraphlongfitbyline}[2]{
\noindent{}\myindented{10mm}{\textsf{#1} \hfill \textsf{\textit{#2}}}
}
\newcommand{\epigraphnobyline}[2]{
\noindent{}\myindented{10mm}{\textsf{#1}}
}
\newcommand{\epigraph}[2]{
\noindent{}#1 \hspace*{\fill}\nolinebreak[1]\hspace*{\fill}\textit{#2}
}
%...based on an example on p. 443 of LaTeX Companion
%-------------------- oneofaseriesofpoints -----------------------------------------------------------
% The following is basically like an item in the description environment, but the stuff in bold can
% be more than one line:
\newcommand{\oneofaseriesofpoints}[2]{\myindented{\egindent}{\noindent\textbf{#1}\ {#2}}\par}
%-------------------- homework remark -------------------
\newcommand{\hwremark}[1]{\par\noindent\footnotesize{\textit{Remark:\/} #1}}
%-------------------- photo credit command -------------------
\newcommand{\photocredit}[1]{\footnotesize{(\textit{#1})}}% for use in captions
% for use in photo credits appendix:
\newcommand{\barecred}[2]{ \emph{#1:} #2.\quad}
\newcommand{\docred}[3]{\textbf{#1} \emph{#2:} #3.\quad}
\newcommand{\cred}[3]{\docred{\pageref{fig:#1}}{#2}{#3}}
\newcommand{\credtwo}[4]{\docred{\pageref{fig:#1},\pageref{fig:#2}}{#3}{#4}}
\newcommand{\credthree}[5]{\docred{\pageref{fig:#1},\pageref{fig:#2},\pageref{fig:#3}}{#4}{#5}}
%-------------------- theorem header -------------------
\newcommand{\mythmhdr}[1]{\noindent\textbf{#1:}}
%-------------------- equation numbering -------------------
\numberwithin{equation}{section}
% Equation numbers have square brackets:
% Original code from amsmath.sty:
% \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
% Change it as follows:
\renewcommand{\tagform@}[1]{\maketag@@@{[\ignorespaces#1\unskip\@@italiccorr]}}
% Use \eqref to refer to an equation.
%\renewcommand{\theequation}{\ensuremath{\fnsymbol{equation}}} % used to use symbols...
\renewcommand{\theequation}{\ensuremath{\arabic{equation}}} % ... now using numbers
%-------------------- tuning placement of floating figures -------------------
% The following three numbers are to make TeX more likely to put figures on the
% same page rather than on a separate figures page. Can tinker with these, but
% make sure floatpagefraction<topfraction.
% Values recommended by the web page I found were 0.85, 0.1, 0.75
\renewcommand{\topfraction}{0.99}
\renewcommand{\textfraction}{0.01}
\renewcommand{\floatpagefraction}{0.98}
%-------------------- hw section & hw problem environments-------------------
\newcommand{\hwdifficulty}{0}
% ... This needs to be a global variable because I only display the symbol in \end{hw},
% which doesn't have access to #1.
\newsavebox{\hwtrailingstuff}
% There is also a boolean register, hwhavetrailing, defined under AtBeginDocument.
%
% The homework problem section is supposed to be like any other section, but not numbered.
% addtocontents: see Lamport, p. 176
\newcommand{\displayhwdifficulty}[1]{\ifthenelse{\equal{#1}{2}}{$\star$}{}}
\newcommand{\hwtopboilerplate}{%
\noindent\formatlikesubsection{\langkey}\\*
The notation \hwcheckmark indicates that a computerized answer check is available online.
}
\newenvironment{hwsection}[1][Problems]{
\setcounter{secnumdepth}{0} % Don't number this section.
\renewcommand{\printthesection}{} % Footers should read ``Problems,'' not ``Section X.Y Problems''
\hwcaptions % figures in hw section don't have a, b, c, labels
\setcounter{figure}{0} %
\begingroup
\renewcommand{\addcontentsline}[3]{}% temporarily disable \addcontentsline
\mysection{#1} % Has the side-effect of generating a page break.
\endgroup
\setcounter{secnumdepth}{2} % Start numbering sections again.
% The \setcounter{secnumdepth} stuff is the way the author of titlesec suggests doing
% this. Using section* messes up footers & toc.
\setlength{\parindent}{0mm}%undone by normalparafmt
%\hwtopboilerplate\par% not used in genrel
}%
{%
\vfill
\normalparafmt
}
%
\newcommand{\hwnote}[1]{\noindent\emph{#1}}
\newcommand{\currenthwlabel}{}
\newcommand{\calccrud}{}
\newenvironment{homework}[3]
{%
\refstepcounter{hwctr}%
\begin{homeworkforcelabel}{#1}{#2}{#3}{\thehwctr}
}%
{%
\end{homeworkforcelabel}
}
%
\newenvironment{homeworkforcelabel}[4]
{\renewcommand{\@currentlabel}{#4}\label{hw:#1}\noindent\textbf{#4}%
\renewcommand{\hwdifficulty}{#2}%
\hwcleartrailingstuff
\renewcommand{\currenthwlabel}{#1}
\quad%
\renewcommand{\calccrud}{}
\ifthenelse{\equal{#3}{1}}{\renewcommand{\calccrud}{\hwaddtrailingstuff{$\int$}}}{}
}
{%
\calccrud
\hwaddtrailingstuff{%
\displayhwdifficulty{\hwdifficulty}
}%
\hwflushtrailingstuff\par%
}
%
\newcommand{\hwendpart}[1][3]{\hwflushtrailingstuff[#1]\\}
% The optional argument ends up being passed to \nolinebreak. It defaults to 3, but
% you can make it 2 or 4 if it seems to be making the wrong decision.
% If there is only one part to the problem, or if you're fiddling with the very last
% part of a multipart problem, I think you can add a gratuitous \hwendpart, but
% except in this situation, don't do \hwendpart after the last part, because sometimes
% it causes extra blank lines to appear.
%
\newcommand{\hwhint}[1]{\hwaddtrailingstuff{\hwtriangle\ Hint, p. \pageref{#1}}}
\newcommand{\hwans}[1]{\hwaddtrailingstuff{\hwtriangle\ Answer, p. \pageref{#1}}}
\newcommand{\hwsoln}{\hwaddtrailingstuff{\hwtriangle\ Solution, p. \pageref{soln:\currenthwlabel}}}
\newcommand{\answercheck}{\hwaddtrailingstuff{\hwcheckmark}}
%
\newcommand{\hwtriangle}{$\triangleright$}
\newcommand{\hwcheckmark}{\scriptsize\raisebox{1mm}{$\surd$}\normalsize}
%
\newcommand{\hwflushtrailingstuff}[1][3]{\ifthenelse{\boolean{hwhavetrailing}}{\hwfill{#1}\usebox{\hwtrailingstuff}\hwcleartrailingstuff}{}}
%
\newcommand{\hwcleartrailingstuff}{\sbox{\hwtrailingstuff}{}\setboolean{hwhavetrailing}{false}}
%
\newcommand{\hwaddtrailingstuff}[1]{\sbox{\hwtrailingstuff}{\usebox{\hwtrailingstuff}\quad{}#1}%
\setboolean{hwhavetrailing}{true}}
%
\newcommand{\hwfill}[1]{\hspace*{\fill}\nolinebreak[#1]\nopagebreak[1]\hspace*{\fill}}
% ... cf LaTeX Companion, p. 443
%
%
\newcommand{\scans}[1]{$\triangleright$\ Answer, p. \pageref{scans:#1}}
\newcommand{\noetherimplies}{\ensuremath{\Rightarrow}}
\newenvironment{noethertable}{%
\noindent\hspace{5mm}\begin{tabular}{|p{40mm}cp{40mm}|}
\hline
\textbf{symmetry} & & \textbf{conserved quantity} \\
}%
{
\hline
\end{tabular}
}
%=========================
\newcommand{\eqquad}{}
% I used to have flying punctuation after displayed math, e.g.,
% x=7 \qquad .
% I decided that looked bad, so I replaced the qquads with this do-nothing macro.
\newcommand{\mynormaltype}{\normalsize\normalfont\myeqnspacing}
\newcommand{\myeqnspacing}{
\setlength{\abovedisplayskip}{4mm plus 1mm minus 3mm}
\setlength{\belowdisplayskip}{4mm plus 1mm minus 3mm}
\setlength{\abovedisplayshortskip}{0mm plus 1mm}
\setlength{\belowdisplayshortskip}{2mm plus 1mm minus 1mm}
}
%==============================toc==================================
\newcommand{\link}[2]{\protect\jumplink{anchor-#1}{\textcolor{blue}{#2}}} % navigator package
\newcommand{\brieftocentry}[3][\quad]% #1=\hfill (LM and Me.) or \quad (other books), #2=label, #3=title,
{\ref{#2} & #3 #1 \pageref{#2}}
\newcommand{\brieftocentrywithlink}[3][\quad]% #1=\hfill (LM and Me.) or \quad (other books), #2=label, #3=title,
{\link{#2}{\ref{#2}} & \link{#2}{#3} #1 \link{#2}{\pageref{#2}}}
\newcommand{\toclinewithlink}[4]% #1=subsection, etc., #2=label, #3=title, #4=\thesubsection, etc.
{%
\addcontentsline{toc}{#1}{\protect\numberline{#4}\link{#2}{#3}}%
}
\newcommand{\toclinewithoutlink}[4]% #1=subsection, etc., #2=label, #3=title, #4=\thesubsection, etc.
{%
\addcontentsline{toc}{#1}{\protect\numberline{#4}#3}%
}
%For the following, see the documentation for tocloft.sty:
\renewcommand{\contentsname}{}
\setlength{\cftbeforetoctitleskip}{0mm}
\setlength{\cftaftertoctitleskip}{0mm}
%titletoc stuff:
\renewcommand{\cftchapfont}{\bfseries\sffamily\Large}
\renewcommand{\cftchappagefont}{\bfseries\sffamily\Large}% has no effect?
\newcommand{\formatchtoc}[3]{%
\titlecontents{chapter}[0mm]{\addvspace{#3}\sffamily}%
{\contentsmargin{0mm}#1\thecontentslabel\enspace#1}%
{\contentsmargin{0mm}#1}{#2}[]%
}
\contentsmargin{6mm}
\titlecontents{part}[0mm]{\addvspace{5mm}\sffamily\bfseries}
{\contentsmargin{0mm}\bfseries\Large{}\thecontentslabel\Large}
{\contentsmargin{0mm}\Large}{}[\addvspace{2mm}]
\titlecontents{section}[0mm]{\sffamily}
{\contentsmargin{0mm}\thecontentslabel\enspace}
{}{\titlerule*[4mm]{.}\contentspage}
% In the following, titlecontents* is titletoc's way of saying I want subsections listed in a single paragraph.
\titlecontents*{subsection}[1.5em]{\small}{}%
{}{, \thecontentspage}[.---][.]
\titlecontents{subsubsection}[]{}{}{}{}[]
% Brief contents:
\titlecontents{briefchapter}[0mm]{\Large\sffamily{}}
{}{}
{}
%========================= detect bug in titlesec package=========================
% https://bugs.launchpad.net/ubuntu/+source/texlive-extra/+bug/1574052/comments/11
\@ifpackagelater{titlesec}{2016/03/21}{%
% Package titlesec is on version 2.10.2 or higher, nothing to do %
}{%
% Check if package titlesec is on version 2.10.1 %
\@ifpackagelater{titlesec}{2016/03/15}{%
\PackageError{lmcommon}{You're using broken version 2.10.1 of titlesec. Replace titlesec.sty on your system with the file fixed_titlesec.sty that was packaged with this book.}{}
}{%
% Package titlsecon is on version 2.10.0 or lower, nothing to do %
}%
}
%========================= graphicx package=========================
\usepackage{graphicx}
%========================= AtBeginDocument stuff=========================
\AtBeginDocument{
\newboolean{hwhavetrailing}
\DeclareGraphicsExtensions{.pdf,.jpg,.png}
\newcommand{\chapdir}{glub}
%------------------------------- equation spacing
\myeqnspacing
% This gets reset any time I do normalsize, so have to do it after preamble,
% and have to use \mynormaltype rather than \normalsize
}
%============= preamble commands such as includeonly, controllable from makefile ==============
%\input{makefilepreamble}