-
Notifications
You must be signed in to change notification settings - Fork 0
/
nap.sty
191 lines (162 loc) · 5.44 KB
/
nap.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
%%
%% Header file for use with NAP books
%%
\NeedsTeXFormat{LaTeX2e}[1995/05/16]
\ProvidesPackage{nap}
[2004/4/14 v1.0 package for formatting books in the Network Agent Press style]
%\paperwidth = 6in
%\paperheight = 9in
\paperwidth = 7.44in
\paperheight=9.68in
\voffset = -1in
\hoffset = -1in
% space on top before any text
\topmargin = 0.75in
% space on left side of text on odd numbered pages
\oddsidemargin = 22mm
% space on left side of text on even numbered pages
\evensidemargin = 20mm
% space allowed for header
\headheight = 1.5ex
% space between header and body of text
\headsep = 4ex
% width of the main text body
%\textwidth = 110mm
\textwidth=147mm
% the heigth of the main text body
%\textheight = 178mm
\textheight=195mm
%\textheight=225mm
% how much room to leave before the footer
%\footskip 0.5in
% space for any callouts
\marginparsep = 0.5in
% size of a callout
\marginparwidth = 2in
%\parskip = 1 ex
%\parindent = 0.0in
\marginparwidth 1.25in
\marginparsep 0.1in
\newcommand{\sidenote}[1]{\marginpar{\footnotesize{}#1}}
\newcommand{\function}[1]{\mbox{\tt #1}}
\newcommand{\constant}[1]{{\tt #1}}
\newcommand{\type}[1]{{\tt #1}}
\long\def\firstterm#1#2{\emph{#1}\nomenclature{\bf#1}{#2}}
\newcommand{\application}[1]{{\bf #1}}
\newcommand{\dotspace}{{\tt.\char`\ }\xspace}
\newcommand{\spce}{\tt{\char`\ }}
\newcommand{\bslash}{{\tt \char'134}}
\newcommand{\bsl}{{\tt \char'134}}
\newcommand{\vbar}{{\tt \char`|}\xspace}
\newcommand{\pcent}{{\char`\%}}
\newcommand{\tilda}{\sub{\textstyle\tt\char`~}\xspace}
\newcommand{\tlda}{\sub{\textstyle\tt\char`~}}
\newcommand{\uphat}{{\tt \char`^}\xspace}
\newcommand{\upht}{{\tt \char`^}}
\newcommand{\nasf}{{\tt \bsl+}\xspace}
\newcommand{\hash}{{\tt \#}}
\newcommand{\param}[1]{{\mbox{\rm\em #1}}}
\newcommand{\pling}{{\tt \char'041}\xspace}
\newcommand{\q}[1]{{\protect\texorpdfstring{\mbox{\tt #1}}{#1}}}
\newcommand{\qx}[1]{{\protect\texorpdfstring{\mbox{\tt<#1/>}}{<#1>}}}
\newcommand{\qe}[1]{{\q{\emph{#1}}}}
\newcommand{\qs}[1]{\mbox{\tt"#1"}}
\newcommand{\ui}[1]{\mbox{\tt"#1"}}
\newcommand{\code}[1]{\mbox{\tt #1}}
\newcommand{\literal}[1]{\mbox{``#1''}}
\newcommand{\meta}[1]{\mbox{\q{\emph{#1}}}}
\newcommand{\keycap}[1]{{\tt#1}}
\newcommand{\subsume}{\ensuremath{\sqsubseteq_{t}}}
\newcommand{\equivt}{\ensuremath{\equiv_{t}}}
\newcommand{\tinfers}{\mbox{$\vdash_{t}$}}
\newcommand{\infers}{\mbox{$\vdash$}}
\newcommand{\minsert}[1]{{\ifmmode{{#1}}\else{\mbox{${#1}$}}\fi}}
\newcommand{\typeprd}[3]{\ensuremath{\emph{#1}~\tinfers{}\,#2:#3}}
\newcommand{\safeinf}{\ensuremath{\vdash_{safe}}}
\newcommand{\typesafe}[2]{\ensuremath{\emph{#1}~\safeinf\emph{#2}}}
\newcommand{\satinf}{\ensuremath{\vdash_{sat}}}
\newcommand{\typesat}[2]{\ensuremath{\emph{#1}~\satinf\emph{#2}}}
\newcommand{\entail}[2]{\ensuremath{#1~\infers~#2}}
\newcommand{\tm}{\ensuremath{^{\mbox{\scriptsize{TM}}}}}
\newcommand{\return}{\ensuremath{\hookleftarrow}\xspace}
% a command for embedding a picture
\newcommand{\snap}[1]{\begin{center}\vspace{1ex}\includegraphics{#1}\end{center}}
% a command for subscripting
\newcommand{\sub}[1]{\minsert{{_{#1}}}}
\newcommand{\subn}{\minsert{{_{n}}}}
\newcommand{\subi}{\minsert{{_{i}}}}
\newcommand{\super}[1]{\minsert{{^{#1}}}}
\newcommand{\superth}{\minsert{{^{th}}}}
\newcommand{\superi}{\minsert{{^{i}}}}
% An environment for introducing asides
\newenvironment{aside}[1][\dbend]{\begin{itemize}\item[#1]}{\end{itemize}}
% define a note as a footnote
\newcommand{\note}[1]{\footnote{#1}}
% From TeXMaG Volume 2, Number 6
% Don Hosek <[email protected]>
%
\long\def\epigram#1{% We use \long\def to allow the argument
% to span several paragraphs.
\bigskip % extra space above.
\setbox0=\hbox{#1} % put the text into a box
\ifdim\wd0>\critwidth %check the length
\centerline{\vtop{\hsize=\episize\noindent#1}}
% If the length is greater than
% the critical length, make a
% displayed paragraph
\else % otherwise, we just center the text.
\centerline{\box0}
\fi
\smallskip % extra space for the end.
}
\newdimen\critwidth \critwidth=.75\hsize
\newdimen\episize \episize=.6\hsize
\newfont{\scaledfont}{cmr10 scaled 4000}
\renewcommand\thechapter{\arabic{chapter}}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{10\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\par\nobreak
\vskip 0\p@
\fi
\fi
\interlinepenalty\@M
\parbox[b]{0.75\textwidth}{\raggedright\huge \textbf{#1}}\ %
\if@mainmatter
\hfill\scaledfont\thechapter\par\normalsize%
\fi
\color{skyBlue}{\rule{\textwidth}{1pt}}% <--- the rule
\nobreak
\vskip 15\p@
}%
}
\def\@makeschapterhead#1{%
\vspace*{10\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\par\nobreak
\vskip 0\p@
\fi
\fi
\interlinepenalty\@M
\parbox[b]{0.75\textwidth}{\raggedright\huge \textbf{#1}}\ %
\color{skyBlue}\rule{\textwidth}{1pt}% <--- the rule
\nobreak
\vskip 15\p@
}%
}
% Add draft to each page ..
%\AddToShipoutPicture{%
% \setlength{\@tempdimb}{.5\paperwidth}%
% \setlength{\@tempdimc}{.5\paperheight}%
% \setlength{\unitlength}{1pt}%
% \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
% \makebox(90,0){\rotatebox{45}{\textcolor[gray]{0.85}%
% {\tt\fontsize{6cm}{6cm}\selectfont{DRAFT}}}}%
% }%
%}
\makeatother