-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_macros.tex
85 lines (71 loc) · 2.36 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
\ifx\assmacros\relax\endinput\else\let\assmacros=\relax\fi
\font\titlefont=cmb12 at 24pt
\font\chapterfont=cmb12 at 20pt
\font\chapterit=cmti12 at 20pt
\font\secfont=cmb12 at 16pt
\font\subsecfont=cmb12
\message{Macros,}
\newcount\chapno \chapno=0
\newcount\secno \secno=0
\newcount\subsecno \subsecno=0
%\def\title#1{\line{#1\hss}\hrule\bigskip}
\expandafter\ifx\csname everytitle\endcsname\relax\def\everytitle#1{}\fi
\def\title#1{%
% Order is important: do \everytitle first, in case it \ejects, because we
% would want to hold over \headline in that case.
\everytitle{#1}%
\headline={\vbox{\line{#1\hss}\vskip2pt\hrule}}%
}
\newif\ifgentoc \gentoctrue
\ifx\nogentoc\undefined\else\gentocfalse\fi
\newwrite\toc
\ifgentoc
\message{Write TOC,}\immediate\openout\toc=toc.tex
\else
\message{No TOC,}
\fi
\def\chapter#1{
\global\advance\chapno by1
\global\secno=0
\global\subsecno=0
\vfil\penalty-50\vfilneg\medskip
{\chapterfont Chapter \the\chapno. #1}\bigskip
\xdef\dowrite{\write\toc{\string\tocchap{\the\chapno}{#1}{\noexpand\the\noexpand\count0}}}\ifgentoc\dowrite\fi
}
\def\section#1{
\global\advance\secno by1
\global\subsecno=0
\vfil\penalty-50\vfilneg\medskip % A "smaller" \filbreak
{\secfont Section \the\secno. #1}\medskip
\xdef\dowrite{\write\toc{\string\tocsec{\the\secno}{#1}{\noexpand\the\noexpand\count0}}}\ifgentoc\dowrite\fi
}
\def\subsection#1{
\global\advance\subsecno by1
{\subsecfont Subsection \the\subsecno. #1}\smallskip
}
\def\tocleader{\leaders\hbox to 8pt{\hss.\hss}}
\def\tocpgnum#1{\hbox to 12pt{\hss\ifnum#1<0 \romannumeral-#1\else#1\fi}}
\outer\def\tocchap#1#2#3{\message{Chapter #1,}\medskip\line{{\bf Chapter #1. #2}\tocleader\hfil\tocpgnum{#3}}}
\outer\def\tocsec#1#2#3{\message{Section #1,}\line{\hbox{\qquad Section #1. #2}\tocleader\hfil\tocpgnum{#3}}}
% Tagged semantics
\def\insn#1{{\tt#1}}
\def\code#1{{\tt#1}}
\def\reg#1{{\bf#1}}
% Lists
\def\li{\item{$\bullet$}}
\def\lili{\itemitem{$\bullet$}}
% Blocks
\def\startblock{\bigskip\begingroup\leftskip=4em\rightskip=4em\parindent=0pt\tt\obeylines}
\def\endblock{\endgroup\bigskip}
% Conditional termination
\expandafter\ifx\csname maybye\endcsname\relax\let\maybye=\end\fi
% Commonly-used symbols (for consistency)
\def\ass{{\tt ASS}}
\def\wsi{{\tt W}}
\def\asi{{\tt A}}
\def\isi{{\tt J}}
\def\ist{{\tt S$_J$}}
\def\wst{{\tt S$_W$}}
\def\ins{{\tt I}}
\def\rg#1,#2.{$[#1:#2]$}
\def\ix#1{$[#1]$}