Debian Codegraph @

texmf-dist/doc/generic/mfpic/mfpdoc.sty

raw
1 % File: mfpdoc.sty
2 % A part of mfpic 1.10 2012/12/03
3 %
4 \ProvidesPackage{mfpdoc}[2012/12/03 v1.10 macros for mfpic documentation]
5 \newcommand\mfpversion{1.10}
6 \newcommand\mfpicversion{110}
7 \newcommand\mfpfiledate {2012/12/03}
8 \newif\if@chapters
9 \@chaptersfalse
10 \DeclareOption{chapters}{\@chapterstrue}
11
12 \newif\if@stupidlogos
13 \@stupidlogostrue
14 \DeclareOption{nologos}{\@stupidlogosfalse}
15 \ProcessOptions
16
17 \IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}}
18 {\csname newif\expandafter\endcsname\csname ifpdf\endcsname \pdffalse
19 \ifx\pdfoutput\undefined
20 \else\ifx\pdfoutput\relax
21 \else\ifnum0=\pdfoutput
22 \else
23 \pdftrue
24 \fi\fi\fi}
25
26
27 %% Text size:
28
29 \textwidth 5.5in
30 \textheight 8.0in
31 \oddsidemargin 0.5in
32 \evensidemargin\oddsidemargin
33 \topmargin 0.5in
34 \advance\topmargin-\headheight
35 \advance\topmargin-\headsep
36
37 \ifpdf
38 % These two are now defaults in TeX Live:
39 % \pdfminorversion 5
40 % \pdfobjcompresslevel 2
41 \pdfpageheight\paperheight
42 \pdfpagewidth\paperwidth
43 \def\mfpHyOpts{%
44 pdftex,colorlinks,pdfpagemode=UseNone,%
45 pdfstartview={XYZ null null null},%
46 plainpages=false,hypertexnames=true}
47 \def\mfpHyDisable{%
48 \let\opt\@firstofone\let\prog\@firstofone}
49 \else % dvi output could be for dvipdfm or dvips
50 \ifx\mfpdvipdfm\UndEfInEd
51 \special{papersize=\the\paperwidth,\the\paperheight}
52 \else
53 \special{pdf: pagesize width \the\paperwidth\space height \the\paperheight}
54 \fi
55 \fi
56 \renewcommand\section{\@startsection{section}{1}{\z@}%
57 {-2.4ex \@plus -.5ex \@minus -.1ex}%
58 {1.0ex \@plus.1ex}%
59 {\normalfont\large\bfseries}}
60 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
61 {-1.8ex\@plus -.4ex \@minus -.1ex}%
62 {.75ex \@plus .1ex}%
63 {\normalfont\bfseries}}
64 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
65 {-1.5ex\@plus -.3ex \@minus -.1ex}%
66 {.5ex \@plus .1ex}%
67 {\normalfont\scshape\raggedright}}
68 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
69 {-1ex\@plus -.2ex \@minus -.1ex}%
70 {.4ex \@plus .1ex}%
71 {\normalfont\itshape\raggedright}}
72 %
73 % To allow \chapter command in article class, load this package with
74 % [chapters] option
75 \if@chapters
76 \let\chapter\section
77 \let\section\subsection
78 \let\subsection\subsubsection
79 \let\subsubsection\paragraph
80 \fi
81
82 \def\mfpicversiontext{\prog{Mfpic} version: \mfpversion.}
83
84 \def\@maketitle{%
85 \newpage\vspace*{-2\baselineskip}
86 \ifx\mfpicversiontext\relax
87 \else
88 {\let\p@footnote\relax\let\@thempfn\relax
89 \footnotetext{\mfpicversiontext}}%
90 \fi
91 {\centering%
92 {\Large \@title \par}%
93 \vskip 1em%
94 {\large \lineskip .5em%
95 \begin{tabular}[t]{c}%
96 \@author
97 \end{tabular}\par}%
98 \vskip .7em%
99 {\normalsize \@date}%
100 \par
101 }%
102 \vskip 1em\relax}
103
104 \def\@listi{\leftmargin\leftmargini
105 \parsep \z@ \@plus\p@ \@minus\z@
106 \topsep 1ex \@plus.2ex \@minus 1ex
107 \itemsep\parsep}
108 \let\@listI\@listi \@listi
109 \renewcommand\labelitemi{\normalfont\bfseries \textendash}
110 \renewcommand\labelitemii{\textasteriskcentered}
111 \renewcommand\labelitemiii{\textperiodcentered}
112 \leftmargini 1.5\parindent
113
114 % Index stuff
115 \def\mfpindexheading{}
116 \def\mfpindexpagemarks{}
117
118 % If lcheadings.ist or ucheadings.ist is used we need these:
119 \def\headingprefix#1{\textbf{#1}}
120 \def\headingsuffix{\par\nobreak\smallskip}
121
122 \renewenvironment{theindex}
123 {%
124 \@restonecoltrue
125 \columnseprule \z@
126 \columnsep 35\p@
127 \twocolumn[\mfpindexheading%
128 \vspace{1ex}]%
129 \mfpindexpagemarks
130 \parindent\z@
131 \parskip\z@ \@plus .3\p@\relax
132 \let\item\@idxitem
133 }
134 {\clearpage}
135
136
137 %% Because \pageref doesn't link to the actual page:
138 \newcommand\pagelabel{\ifpdf \phantomsection \fi\label}
139
140 %% Displays %%%%%%%%%%%
141 %% command descriptions (cd):
142 \newenvironment{cd}
143 {\par\addvspace{1.75ex plus .3ex minus .1ex}
144 \parindent0pt
145 \vbox\bgroup\hsize\textwidth
146 \def\ {\leavevmode\null\quad}% small space at beginning of line
147 }
148 {\unskip\strut\egroup\@ignoretrue
149 \aftergroup\@afterindenttrue\aftergroup\@afterheading
150 \nobreak\vskip.75ex plus .3ex minus .1ex}
151
152 %% examples (ex):
153 \newenvironment{ex}
154 {\par\addvspace{1ex plus.2ex minus.1ex}%
155 \parindent0pt
156 \vbox\bgroup\hsize\textwidth
157 \leftskip\leftmargini
158 \def\ {\leavevmode\null\quad}}
159 {\unskip \strut \egroup \vskip 1ex plus.2ex minus.1ex
160 \@ignoretrue\@endpetrue}
161
162 %% verbatim:
163 \RequirePackage{verbatim}
164 \def\verbatim@processline{\hspace{\leftmargini}\the\verbatim@line\par}
165 \addto@hook\every@verbatim{\predisplaypenalty\@M}
166
167 %% displayed text:
168 \newenvironment{display}{\list{}{}\item[]}{\endlist}
169 %% end displays %%%%%%%
170
171 %% Logos %%%%%%%%%%%%%%
172 \if@stupidlogos
173 \def\TeX{T\kern-.1667em\lower.4ex\hbox{E}\kern-.125emX}
174 \def\pdfTeX{pdf\kern.04em\TeX}
175 \def\pdfLaTeX{pdf\kern.06em\LaTeX}
176 \def\ConTeXt{Con\kern-.16em \TeX \kern-0.06em t}
177 \def\eTeX{e\kern-.10em \TeX}
178 \def\LMcal{\fontencoding{OMS}\fontfamily{lmsy}\selectfont}
179 \def\CMcal{\fontencoding{OMS}\fontfamily{cmsy}\selectfont}
180 %
181 % Use CM mathcal for AMS logo
182 % \def\AmSTeX{{\CMcal A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}-\TeX}
183 %
184 % Use whatever is default for \mathcal:
185 % \def\AmSTeX{%
186 % $\mathcal{A}\kern-.1667em
187 % \lower.5ex
188 % \hbox{$\mathcal{M}$}\kern-.125em
189 % \mathcal{S}$-\TeX}
190 %
191 % Use LM mathcal for AMS logo
192 \def\AmSTeX{{\LMcal A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}-\TeX}
193 \def\PiCTeX{P\kern-.06em\lower.4ex\hbox{I}\kern-.075emC\kern-.06em\TeX}
194 \else
195 \def\TeX {\textsc{TeX}}
196 \def\LaTeX {\textsc{LaTeX}}
197 \def\pdfTeX {\textsc{pdfTeX}}
198 \def\pdfLaTeX{\textsc{pdfLaTeX}}
199 \def\ConTeXt {\textsc{ConTeXt}}
200 \def\eTeX {\textsc{eTeX}}
201 \def\AmSTeX {\textsc{$AMS$-TeX}}
202 \def\PiCTeX {\textsc{PiCTeX}}
203 \fi
204 %% end Logos %%%%%%%%%%
205
206 \hyphenation{meta-font meta-post Post-Script Ghost-script}
207
208 %% Special words %%%%%%%%%%
209 \def\MF{\prog{metafont}}
210 \def\CMF{\prog{Metafont}}
211 \def\MP{\prog{metapost}}
212 \def\CMP{\prog{Metapost}}
213 \def\PS{\prog{PostScript}}
214 \def\GS{\prog{Ghostscript}}
215 \def\EPS{\prog{EPS}\null}
216 \def\mfp{\prog{mfpic}}
217 \def\Mfp{\prog{Mfpic}}
218 \def\grafbase{\prog{grafbase}}
219 \def\Grafbase{\prog{Grafbase}}
220
221 %% font commands
222 \def\mytt#1{\relax
223 \ifmmode
224 \mathtt{#1}%
225 \else
226 {\upshape\ttfamily#1}%
227 \fi
228 }
229 \def\mfc{% % Metafont/Post code
230 \begingroup
231 \ttfamily\catcode`\_=12 \grabit
232 }
233 \def\grabit#1{#1\endgroup}
234 % like \mfc, but no line breaks
235 \def\codebox{%
236 \hbox\bgroup
237 \ttfamily\catcode`\_=12 \boxgrabit
238 }
239 \def\boxgrabit#1{#1\egroup}
240 \def\_{\mytt{\char`\_}}
241 \def\prog#1{{\mdseries\scshape#1}} % programs, packages
242 \let\file\mytt % filenames
243 \def\opt#1{{\upshape\sffamily#1}} % package options
244 \let\gbc \mfc % grafbase code
245 \let\env \file % LaTeX environment names
246 \let\email\file % email addresses
247 \let\mail \file % (ditto)
248 \let\dim \file % TeX and Metafont dimensions
249 \let\kw \opt % MF key word like numeric
250
251 %% TeX code %%%%%%%%%%%%%%%
252 {
253 \escapechar`\\
254 \xdef\otherbsbs{\string\\}
255 \escapechar-1
256 \xdef\otherbackslash{\string\\}
257 }
258 \DeclareRobustCommand\cs[1]{%
259 \texorpdfstring{\leavevmode\mytt{\otherbackslash#1}}{\textbackslash#1}}
260 \def\bbsl{\mytt{\otherbsbs}}% prints "\\"
261 \DeclareRobustCommand\meta[1]{%
262 \ensuremath{\langle\mbox{\rmfamily\itshape#1\/}\rangle}}
263 \providecommand\marg[1]{\mytt{\char`\{#1\char`\}}}
264 \providecommand\oarg[1]{\mytt{[#1]}}
265 \providecommand\parg[1]{\mytt{(#1)}}
266
267 %% page style %%%%%%%%%%%%%%%
268 \def\ps@mfpdoc{%
269 \let\@oddfoot\@empty\let\@evenfoot\@empty
270 \def\@oddhead{\small{\scshape\rightmark}\hfil\thepage}%
271 \let\@evenhead\@oddhead
272 \let\@mkboth\markboth
273 \def\sectionmark##1{\thispagestyle{plain}}
274 \def\subsectionmark##1{%
275 \markright {\thesubsection\enspace##1}}%
276 \def\subsubsectionmark##1{}}
277
278 \if@chapters
279 \renewcommand\tableofcontents{\pagenumbering{roman}%
280 \chapter*{\contentsname
281 \@mkboth{\scshape\contentsname}{\scshape\contentsname}}%
282 \@starttoc{toc}\clearpage\pagenumbering{arabic}}
283 \fi
284
285 %% figures:
286 \@fptop=-\@fpsep
287 \@addtoreset{figure}{section}
288
289 %% misc:
290 \def\tallstrut{\vbox to 10pt{}}
291 \def\deepstrut{\vtop to 5pt{}}
292
293 \frenchspacing
294 \endinput