summaryrefslogtreecommitdiff
path: root/web/webfiles/xwebdoc.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/webfiles/xwebdoc.sty
Initial commit
Diffstat (limited to 'web/webfiles/xwebdoc.sty')
-rw-r--r--web/webfiles/xwebdoc.sty300
1 files changed, 300 insertions, 0 deletions
diff --git a/web/webfiles/xwebdoc.sty b/web/webfiles/xwebdoc.sty
new file mode 100644
index 0000000000..9d4bd4566b
--- /dev/null
+++ b/web/webfiles/xwebdoc.sty
@@ -0,0 +1,300 @@
+%
+% LaTeX style option xwebdoc for documentation of webfiles package
+%
+%
+% (customized version of progltx.doc and cwebdoc.sty, combined
+% with webdoc.sty)
+%
+
+\chardef\uscode=\catcode`\_
+\catcode`\_=11 % letter
+
+
+%%% In addition to the normal \LaTeX{} structuring markups we will
+%%% provide a markup for a layout of the document that is like in
+%%% \WEB{}. This can be done easily. All sections are numbered, the
+%%% number of the next section is stored in the counter |section|. We
+%%% distinguish between main sections which start a group of sections
+%%% and between normal sections within a group.
+
+%%% The main sections are started with the macro |\chap|. It has one
+%%% parameter, the title of the section group. This parameter must be
+%%% terminated by a dot. We start a new page, typeset the title in
+%%% bold face and separate it from the section text with a |\medskip|.
+%%% This text, the documentation part of the section, is formatted
+%%% without paragraph indentation.
+
+%%% If the \WEB{}-like macros are used every section number should be
+%%% output with a following dot. We want to establish this when we use the
+%%% |\chap| or the |\sect| macro the first time. Furthermore the new page
+%%% at the begin of a main section should not be started at the first
+%%% |\chap| because a title may precede it (and the title should not
+%%% be on a seperate page unless explicitely requested). Instead a
+%%% skip of (approximately) 2~pica should be set. To achieve
+%%% both goals a macro |\chap_intro| is defined that defines |\thesection|
+%%% appropriately, skips the 2~pica, and redefines itself to
+%%% |\newpage|---we then just have to call |\chap_intro| at the beginning
+%%% of |\chap|. The same applies to |\sect_intro|.
+
+\newskip\pre_sect_skip \pre_sect_skip=2pc plus 1pc minus 6pt
+
+\def\chap_intro{%
+ \gdef\thesection{\arabic{section}.}%
+ \gdef\chap_intro{\newpage}%
+ \addvspace{\pre_sect_skip}%
+ }
+
+\def\sect_intro{%
+ \gdef\thesection{\arabic{section}}%
+ \global\let\sect_intro\relax
+ }
+
+
+%%% \sect Now we will have a look at the {\it wonderful\/} internal
+%%% interface of \LaTeX{}\@. With ``wonderful'' I mean that I'm always
+%%% full of wonder why it was designed in this way. E.g., if anybody
+%%% can explain to me why the coding of the non-indentation of the first
+%%% line in the following paragraph was combined with the coding of
+%%% the skip which will come in front of the section---I will be thankful
+%%% for the rest of my life. Such different things should be kept
+%%% different, i.e., the suppression of the indentation should not be
+%%% hidden in the sign of a skip! The same comment applies to the combined
+%%% coding of the skip below the section heading resp.\ to the right
+%%% of a run-in heading.
+
+%%% \begin{quote} \it
+%%% I want the following layout: no indentation in the following
+%%% paragraph\/ {\rm but no} space in front of the section heading.
+%%% How do I code a value of\/ $\sl -0 pt$?
+%%% \end{quote}
+%%% %
+%%% Well, a work-around is to use a value of $\rm -1\,sp$ because the
+%%% reader will not see this distance---but in my opinions this is no
+%%% good programming style. In this special case I have luck, too:
+%%% the skip is not set anyway, either it is discarded by the preceding
+%%% |\newpage| or it is not added by |\addvspace| because of the preceding
+%%% |\pre_sect_skip|.
+
+\def\chap#1.{%
+ \chap_intro
+ \@startsection{section}{1}%
+ {\z@}%
+ {\m@ne sp}%
+ {\medskipamount}%
+ {\normalsize\bf}%
+ {#1.}%
+ }
+
+
+%%% \sect Normal sections are started with |\sect|. This macro has no
+%%% parameter. Between two paragraphs we skip |\pre_sect_skip|.
+%%% Between the section number and the text one quad of space is set.
+%%% We have to take care for empty documentation parts where the
+%%% program part (i.e.\ |\beginprog|) will follow immediately. Then
+%%% the program part should begin on a new line and not behind the
+%%% section number. So we provide |\null| as an empty documentation
+%%% part in every case.
+
+%%% Now again the design of |\@startsection| comes in hand: \LaTeX{}
+%%% always leaves a quad after the section number (by the way,
+%%% this is not mentioned in the documentation---you have to look
+%%% in the macros to figure this out). Because our section header
+%%% consists only of the number we have to code a value of $\rm
+%%% -0\,pt$\,\dots
+
+\def\sect{%
+ \sect_intro
+ \@startsection{subsection}{2}%
+ {\z@}%
+ {\pre_sect_skip}%
+ {\m@ne sp}%
+ {\normalsize\bf}%
+ {\null}%
+ }
+
+
+%%% \sect We are finished and just have to restore the category code.
+\catcode`\_=\uscode
+
+
+
+
+
+%
+% logos
+%
+\def\cweb{{\tt CWEB\/}}
+\def\ctangle{{\tt CTANGLE\/}}
+\def\cweave{{\tt CWEAVE\/}}
+\def\C++{C\raise .4ex\hbox{$\scriptstyle +\!+$}}
+
+
+%
+% new elements
+%
+\font\manfnt=manfnt % with the dangerous bend sign
+\chardef\bend="7F % I like the non-S curve ;-)
+\newenvironment{fixme}{%
+ \trivlist
+ \hangindent 2em
+ \hangafter -2
+ \item[\hbox to 0pt{\hss \manfnt \bend}]%
+ \ignorespaces
+ }{%
+ \endtrivlist
+ }
+
+
+\newenvironment{cseqtab}{%
+ \quote
+ \obeycr
+ \tabular{lrl}%
+ \@gobblecr % eat following newline
+ }{%
+ \endtabular
+ \endquote
+ }
+
+
+%
+% new tags
+%
+\def\arg#1{{\sl Arg.~#1\/}:}
+
+
+%
+% change of LaTeX parameters, for layout etc.
+%
+
+% figure
+\def\textfraction{0.1} % must be at least 10% text on page
+\def\topfraction{0.9} % rest may be top insertion
+\def\floatpagefraction{0.8} % float pages only if the float is larger than 80%
+
+
+%
+% from webdoc.sty:
+%
+\oddsidemargin=10mm
+\evensidemargin=0mm
+\textwidth=16cm
+\textheight=24cm
+\topmargin=-4mm
+\headsep=8mm
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \let\@evenfoot\@empty
+ \def\@evenhead{{\textup{\thepage}\hfil\footnotesize\leftmark}}%
+ \def\@oddhead{{\footnotesize\rightmark}\hfil\textup{\thepage}}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markboth%
+ {\uppercase{\ifnum \c@secnumdepth >\z@
+ \S\thesection\hskip 1em\relax\fi ##1}}%
+ {\uppercase{\ifnum \c@secnumdepth >\z@
+ \S\thesection\hskip 1em\relax\fi ##1}}
+ }
+ \def\subsectionmark##1{}%
+ }
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{{\footnotesize\rightmark}\hfil\textbf{\thepage}}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markright{\uppercase{\ifnum \c@secnumdepth >\m@ne
+ \S\thesection\hskip 1em\relax \fi
+ ##1}}}
+ \def\subsectionmark##1{}%
+ }
+\fi
+
+
+%
+% from logos.sty:
+%
+\font\bigfatrm=cmbx10 scaled\magstep5
+\let\bfitself\bf
+\newif\ifboldface
+\def\bf{\boldfacetrue\bfitself}
+\font\ninerm=cmr9
+\font\ninebold=cmbx9
+\font\mflogofont=logo10
+
+%
+% MATLAB:
+%
+\newcommand{\matlab}{%
+ \mbox{M{\ifboldface\ninebold\else\ninerm\fi%
+ \kern-.05emA\kern-.15emT\kern-.05emL\kern-.05emA\kern-.05emB%
+ \spacefactor1000}}}
+
+%
+% Maplab en Maplib:
+%
+% maplab in ems (evenredig met de fontgrootte) --> werkt in alle
+% fontgroottes.
+%
+\def\Maplab{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
+ \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{A}\kern-.1emB}
+\def\MAPLAB{{\bigfatrm\Maplab}}
+\def\maplab{%
+ {\ifboldface\ninebold\else\ninerm\fi\Maplab}%
+ \index{Maplab@ {\ninerm\protect\Maplab}}}
+%
+% idem voor MapLib:
+%
+\def\Maplib{M\kern-.05emA\kern-.20em\raise.6ex\hbox{P}\kern-.30em
+ \lower.6ex\hbox{L}\kern-.2em\raise.2ex\hbox{i}\kern0emB}
+\def\MAPLIB{{\bigfatrm\Maplib}}
+\def\maplib{%
+ {\ifboldface\ninebold\else\ninerm\fi\Maplib}%
+ \index{Maplib@ {\ninerm\protect\Maplib}}}
+
+
+%
+% Computertalen:
+%
+\def\cee{{\ninerm C\spacefactor1000}}
+\def\fortran{{\ninerm FORTRAN}}
+%%\def\cee{{C}}
+
+%
+% WEB's, WEAVEs en TANGLEs:
+%
+\def\web{{\tt WEB}}
+\def\cweb{{\tt CWEB}}
+\def\mweb{{\tt MWEB}}
+\def\nuweb{{\tt nuweb}}
+\def\ceeweb{{\tt ceeweb}}
+
+\def\weave{{\tt weave}}
+\def\cweave{{\tt cweave}}
+\def\ceeweave{{\tt ceeweave}}
+\def\mweave{{\tt mweave}}
+
+\def\tangle{{\tt tangle}}
+\def\ctangle{{\tt ctangle}}
+\def\ceetangle{{\tt ceetangle}}
+\def\mtangle{{\tt mtangle}}
+
+\def\spider{{\rm Spider}}
+
+
+%
+% Tools
+%
+\def\MakeIndex{{\it MakeIndex\/{}}}
+
+%
+% diversen
+%
+\def\C++{\cee\raise .4ex\hbox{$\scriptstyle +\!+$}}
+\def\unix{{\ninerm U\kern-.05emNIX\spacefactor1000}}
+\def\uvalogo{\center\parbox{0mm}{\input{UvA}\box\graph\hss\vss}}
+\def\metafont{{\mflogofont METAFONT}}
+\def\metapost{{\mflogofont METAPOST}}
+\def\BibTeX{{\sc Bib}{\rm\TeX}}
+\def\MakeIndex{{\it MakeIndex}}
+