summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/unixman/unixman.sty
blob: 3fffb21e4111f57ff13267ca7ce0d3faa7264038 (plain)
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
%% Unix `man' macros for LaTeX
%% Paul Barton-Davis <pauld@cs.washington.edu> Feb 1989, June 1991

%% v1.2 - removed references to new font switches, tidied up
%%        page dimensions a little.

%% Thanks are due to Dave Kruger (dak@hpauto.aus.hp.com) for suggested changes
%% to page dimensions, suggested fixes to various bugs, and other general
%% suggestions.

\def\@truedocstyle{Document Style `Unix Manual' V1.2 June 4th 1991}
\input{article.sty}

%%
%% --------------- PAGE DIMENSIONS -------------------
%%

\newdimen\sectionindent
\newdimen\subsectionindent
\newdimen\subsubsectionindent

\sectionindent 0.5 true in
\subsectionindent 0.25 true in
\subsubsectionindent 0pt

\oddsidemargin \sectionindent
\evensidemargin \sectionindent

\hoffset -1.35 cm  %% I really don't know why it needs this ...
\textwidth 6 in
\textheight 21.5cm
\headsep 0.5 in
\topmargin -8mm
\topskip 0pt

\footskip 0.5 in
\parindent 0pt
\parskip \baselineskip

%%
%% ------------------- FONTS -------------------
%%


%% Normal troff uses Times Roman for its output. I much prefer
%% this, but many LaTeX users have no access to this. If you
%% want to, you can insert a magic incantation here that will
%% give you Times Roman (I use \input{times.sty}). Otherwise,
%% you'll get cruddy old Computer Modern throughout.

%%
%% ---------------- SECTIONING COMMANDS --------------
%%

\def\section{\@startsection
{section}{1}{-\sectionindent}
{0pt plus .5ex minus -.2ex}{-1sp}{\normalsize\bf}*}

\def\subsection{\@startsection
{subsection}{2}{-\subsectionindent}
{0pt plus .5ex minus -.2ex}{-1sp}{\normalsize\bf}*}

\def\subsubsection{\@startsection
{subsubsection}{3}{\subsubsectionindent}
{0pt plus .5ex minus -.2ex}{-1sp}{\normalsize\it}*}

%%
%% a modified version of \@xsect
%%

%% In this case, if AFTERSKIP is negative, we simply
%% backup by \parskip immediately after the section heading.
%% This has the net effect of leaving no extra vertical space
%% between the heading and any following material. We also set
%% \@nobreaktrue to avoid extra space when putting a \list
%% immediately after such a heading.

\def\@xsect#1{\@tempskipa #1\relax
      \ifdim \@tempskipa>\z@
       \par \nobreak
       \vskip \@tempskipa
       \@afterheading
    \else 
	\global\@nobreaktrue 
	\global\@noskipsectrue
        \everypar{\if@noskipsec \global\@noskipsecfalse
                   \clubpenalty\@M \hskip -\parindent
                   \begingroup \@svsechd \endgroup \unskip
                   \vskip -\parskip
                  \else \clubpenalty \@clubpenalty
                    \everypar{}\fi}%
   \fi
   \ignorespaces}


%%
%% --------------- MISCELLANEOUS MACROS ---------------
%%

\def\command#1#2{{\it #1}\/{\rm (#2)}}%
\def\code#1{{\bf #1}}
\def\>{$>$\ignorespaces}%
\def\<{$<$\ignorespaces}%
\def\tilde{\~{}}%
\def\HOME{\tilde}%
\def\bs{$\backslash$}
\def\file#1{{\bf #1\/}}
\def\prog#1{{\sf #1}}
\def\pipe{{\tt |}}
\def\ltrl#1{{\bf #1}}
\def\arg#1{{\it #1}}

\def\name#1#2{%
\section{NAME}
#1 -- #2}
\def\synopsis{\section{SYNOPSIS}}
\def\description{\section{DESCRIPTION}}
\def\usage{\section{USAGE}}
\def\options{\section{OPTIONS}}
\def\diagnostics{\section{DIAGNOSTICS}}
\def\files{\section{FILES}}
\def\see{\section{SEE ALSO}}

% super speedy font switching

\def\I #1 {{\it #1}\ }
\def\R #1 {{\rm #1}\ }
\def\B #1 {{\bf #1}\ }
\def\T #1 {{\tt #1}\ }
\def\S #1 {{\sf #1}\ }

\def\BI #1 #2 {{\bf #1}\ {\it #2}\ }
\def\BR #1 #2 {{\bf #1}\ {\rm #2}\ }
\def\RB #1 #2 {{\rm #1}\ {\bf #2}\ }
\def\RI #1 #2 {{\rm #1}\ {\it #2}\ }
\def\IB #1 #2 {{\it #1}\ {\bf #2}\ }
\def\IR #1 #2 {{\it #1}\ {\rm #2}\ }


%%
%% ---------------- HEADERS AND FOOTERS ------------------
%%

%% first we define `thing' to expand to the name of whatever this
%% manpage is about. Then, we case on #2 and define the manual section
%% that this fits under. It is in this section that we have some
%% local specialities - sections numbered above 8 define local
%% manual sections.

%% Here is a map -

%%   9 - Operations
%%  10 - Communications
%%  11 - Checklists
%%  12 - Procedures
%%  13 - Standards
%%  14 - Devices

%%
%% page numbering
%%
%% This allows us to have selected `extra pages' in the style
%% of some of the newer troff filters - Pages normally numbered
%% with a pagenumber after \@xpgstart are subsequently numbered

%%        \@xpgstart{a,b,c ...}

%% where \@xpgstart is (hopefully obviously) a number !

\newcount\@xpgstart
\newcounter{@xpg}
\setcounter{@xpg}{1}
\newif\ifxpg \xpgfalse

\def\startpage#1{\setcounter{page}{#1}}
\def\extrapagesfrom#1{\@xpgstart #1 \xpgtrue}

%%
%% now define the header and footer
%%

%%%%%%%%%%%%%%%%%%%%%%% threepart.sty inlined %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% Three part head and foot macros. 1/87
% Lance Berc
% Olsen & Associates	mcvax!unizh!olsen!lance@seismo.css.gov
% Seefeldstrasse 233
% CH-8008 Zurich

% How users can set the head and foot text.
\def\lhead#1{\gdef\@lhead{#1}} \def\lfoot#1{\gdef\@lfoot{#1}}
\def\chead#1{\gdef\@chead{#1}} \def\cfoot#1{\gdef\@cfoot{#1}}
\def\rhead#1{\gdef\@rhead{#1}} \def\rfoot#1{\gdef\@rfoot{#1}}

% Initialization of the head and foot text.
% By default the page number is at the center of the foot and everything
% else is empty.
\def\@lhead{} \def\@lfoot{}
\def\@chead{} \def\@cfoot{{\rm \thepage}}
\def\@rhead{} \def\@rfoot{}

% Put together a three part header or footer given the left, center and
% right text. The \lap commands put the text into an hbox of zero size,
% so overlapping text is not detected (it just overlaps).
\def\@threepart#1#2#3{\rlap{#1} \hfil {#2} \hfil \llap{#3}}

% Swap the notices on odd and even pages when twosided.
\def\ps@threepartheadings
    {
    \def\@oddhead{\@threepart{\@lhead}{\@chead}{\@rhead}}
    \def\@oddfoot{\@threepart{\@lfoot}{\@cfoot}{\@rfoot}}

    \if@twoside
	\def\@evenhead{\@threepart{\@rhead}{\@chead}{\@lhead}}
	\def\@evenfoot{\@threepart{\@rfoot}{\@cfoot}{\@lfoot}}
    \else
	\def\@evenhead{\@threepart{\@lhead}{\@chead}{\@rhead}}
	\def\@evenfoot{\@threepart{\@lfoot}{\@cfoot}{\@rfoot}}
    \fi
    }

% Default page style
\ps@threepartheadings

% Default footers
\cfoot{\thepage}

%%%%%%%%%%%%%%%%% end of threepart.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\@foottxt{\hbox to 0pt{\hfill}}
\def\@date{\hbox to 0pt{\hfill}}

%%\version{VERSION-NUMBER}{DATE}

\def\version#1#2{%
	\def\@foottxt{#1}
	\def\@date{#2}}

%%\header{NAME}{SECTION}[HEADER][FOOTER]

\newif\if@userhead 

\def\header#1#2{
	\@userheadfalse
	\def\@mansecnum{#2}	
	\@ifnextchar[%
	   {\@bhead{#1}{#2}}
	   {\@head{#1}{#2}}}

\def\@bhead#1#2[#3]{%
	\def\@mansect{\uppercase{#3}}%
	\@ifnextchar[%
		{\@chead{#1}{0}}
		{\@head{#1}{0}}}

\def\@chead#1#2[#3]{\def\@foottxt{#3}
	\@head{#1}{#2}}


\def\@head#1#2{%
\def\this{{\bf #1}}
\ifcase #2
	  \relax
	\or
	  \def\@mansect{USER COMMANDS}
	\or
	  \def\@mansect{SYSTEM CALLS}
   	\or
	  \def\@mansect{LIBRARY FUNCTIONS}
	\or
	  \def\@mansect{SPECIAL FILES}
	\or
	  \def\@mansect{FILE FORMATS}
	\or
	  \def\@mansect{GAMES AND DEMOS}
	\or
	  \def\@mansect{TABLES}
	\or
	  \def\@mansect{MAINTAINANCE COMMANDS}
	\or
	  \def\@mansect{OPERATIONS}
	\or
	  \def\@mansect{COMMUNCIATIONS}
	\or
	  \def\@mansect{PROCEDURES}
	\or
	  \def\@mansect{STANDARDS}
	\or
	  \def\@mansect{DEVICES}
\fi
%%
%% head line
%%
\rhead{\normalsize\uppercase{#1\/(\@mansecnum)}}
\chead{\normalsize\@mansect}
\lhead{\normalsize\uppercase{#1(\@mansecnum)}}
%%
%% footline
%%
\rfoot{\ifxpg%
	  \ifnum \thepage < \@xpgstart%
	     \normalsize\thepage
 	  \else%
	     \normalsize\the\@xpgstart\alph{@xpg}%
	     \addtocounter{@xpg}{1}
	  \fi
	\else
	     \normalsize\thepage
	\fi}
\cfoot{\normalsize Last change: \@date}
\lfoot{\normalsize Version: \@foottxt}}

%% redefine outputpage so as to ensure that the headline and
%% the footline cover the sectional headings as well.

\def\@outputpage{\begingroup\catcode`\ =10 \if@specialpage 
  \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
  \if@twoside 
    \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
      \let\@themargin\oddsidemargin
    \else
      \let\@thehead\@evenhead \let\@thefoot\@evenfoot
      \let\@themargin\evensidemargin
  \fi\fi
  \@tempdima \textwidth %% calculate total page width
  \advance\@tempdima \sectionindent
  \shipout
  \vbox{\normalsize \baselineskip\z@ \lineskip\z@
        \vskip \topmargin \moveright\@themargin
        \vbox{\setbox\@tempboxa
              \vbox to\headheight{\hbox to\@tempdima{\strut\@thehead}
				  \vfil}%
              \box\@tempboxa
              \vskip \headsep
              \hbox to\@tempdima{\hss\box\@outputbox}
              \baselineskip\footskip
              \hbox to\@tempdima{\@thefoot}}}%
  \global\@colht\textheight\endgroup
  \stepcounter{page}\let\firstmark\botmark}


%%   --------------- ENVIRONMENTS --------------------

%% a kludge to get correct spacing of a list environment 
%% immediately after a section name (used within given environments)

\newdimen\@ughamount 
\@ughamount -14pt %% Don't ask ...

\def\@ugh{\vskip \@ughamount}

\def\@item[#1]{%
  \if@noparitem \@donoparitem 
  \else
         \if@inlabel \indent \par \fi
         \ifhmode \unskip\unskip \par \fi 
         \if@newlist 
		\if@nobreak 
			\@nbitem 
	 	\else
                        \addpenalty\@beginparpenalty
                        \addvspace\@topsep \addvspace{-\parskip}
		\fi
           \else \addpenalty\@itempenalty \addvspace\itemsep 
          \fi 
    \global\@inlabeltrue 
  \fi
\everypar{\global\@minipagefalse\global\@newlistfalse 
          \if@inlabel\global\@inlabelfalse \hskip -\parindent \box\@labels
             \penalty\z@ \fi
          \everypar{}}\global\@nobreakfalse
\if@noitemarg \@noitemargfalse \if@nmbrlist \refstepcounter{\@listctr}\fi \fi
\setbox\@tempboxa\hbox{\makelabel{#1}}%
\global\setbox\@labels
 \hbox{\unhbox\@labels \hskip \itemindent
       \hskip -\labelwidth \hskip -\labelsep 
       \ifdim \wd\@tempboxa >\labelwidth 
                \box\@tempboxa
          \else \hbox to\labelwidth {\makelabel{#1}}\fi
       \hskip \labelsep}\ignorespaces}

%% A new makelabel command that attempts to set
%% the item label flushleft in a box of width \labelwdith.
%% If the label is too wide, then we throw in an additional hbox
%% the end, so that the item text is on a new line (kludge-y !)
%% This matches the conventional method of displaying options
%% in the Unix manuals.

\def\flmakelabel#1{\setbox\@tempboxa\hbox{#1}%
		   \ifdim \wd\@tempboxa > \labelwidth%
			 \hbox to \labelwidth{%
				\vbox{%
				    \hbox to 0pt{#1\hss}%
				    \hbox to 0pt{\hfil}}%
			    \hfil}%
		    \else%
			 #1\hfil\relax
		    \fi}
%%
%% Options environment
%%

%% \opt{OPTION} option text ...
%% \optarg{OPTION}{ARGUMENT} option text ...

\def\opt#1{\item[{\bf #1}]}
\def\optarg#1#2{%
	 \def\arg{{\it #2}\ }%
	 \item[{\bf #1}\ {\it #2}]}

\newdimen\optionwidth
\optionwidth\sectionindent

\def\options{%
\list{}{%
\leftmargin \optionwidth
\rightmargin 0pt
\labelwidth \optionwidth
\topsep -\parskip
\partopsep -\parskip
\labelsep 0pt
\let\@nbitem=\@ugh
\let\makelabel=\flmakelabel}}

\let\endoptions=\endlist

%%
%% file lists
%%

\newdimen\filenamewidth
\filenamewidth 2.0in
\let\filelistfont=\bf

\def\filelist{%
\list{}{%
\leftmargin \filenamewidth
\rightmargin 0pt
\labelwidth \filenamewidth
\topsep -\parskip
\partopsep -\parskip
\itemsep 0pt
\parsep 0pt
\labelsep 0pt
\let\@nbitem=\@ugh
\let\makelabel=\flmakelabel}}

\let\endfilelist=\endlist

%% \fileref{FILENAME} description ...

\def\fileref#1{\item[{\filelistfont #1}]\relax}

%% description

\newdimen\descriptionwidth
\descriptionwidth 1.5 in

\def\descriptionlabel#1{\flmakelabel{\bf #1}}

\def\description{\list{}{%
\labelwidth \descriptionwidth
\leftmargin \descriptionwidth
\rightmargin 0pt
\topsep 0pt plus 1pt
\partopsep 0pt plus 1pt
\labelsep 0pt
\let\makelabel=\descriptionlabel}}

\let\enddescription=\endlist

%% a kludge for use immediately after a section heading:

\def\sdescription{\list{}{%
\labelwidth \descriptionwidth
\leftmargin \descriptionwidth
\rightmargin 0pt
\topsep 0pt plus 1pt
\partopsep 0pt plus 1pt
\labelsep 0pt
\let\@nbitem=@ugh
\let\makelabel=\descriptionlabel}}

\let\endsdescription=\endlist

%% examples

\let\examplefont=\tt

\def\example{\list{}{%
\leftmargin 1cm
\rightmargin 1cm
\topsep 0pt
\partopsep 0pt
\examplefont}
\item[]}

\let\endexample=\endlist