%% Unix `man' macros for LaTeX %% Paul Barton-Davis 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