Debian Codegraph @

documentation/userguide/macros.tex

raw
1 % customizations used in the User's Guide
2
3
4 % Description-like environment for documenting functions/APIs.
5 % puts the description label in a minipage with a large hanging
6 % indent.
7 % Good christ this took a long time to develop.
8 % hanging indent trick stolen from Peter Wilson's hanging.sty @CTAN
9 % minipage allows multi-line label, and puts item on next line.
10 % customized list inspired by Kopka/Daly _Guide to LaTeX_ p.213
11 % SRE, Wed Dec 27 11:37:18 2000
12 %
13 \newenvironment{sreapi}{%
14 \begin{list}{}{%
15 \renewcommand{\makelabel}[1]{%
16 \begin{minipage}{\textwidth}%
17 \hangindent10em\hangafter1\noindent%
18 {\bfseries\texttt{##1}\vspace{0.8em}}%
19 \end{minipage}%
20 }}}%
21 {\end{list}}
22
23
24 % Description-like environment for producing lists like:
25 %
26 % label stuff, stuff, stuff
27 %
28 % label2 more stuff, more stuff,
29 % more stuff.
30 % \begin{sreitems}{Longest label} \item[label] stuff, ... \end{sreitems}
31 % SRE, Wed Dec 27 11:59:43 2000
32 %
33 \newenvironment{sreitems}[1]{%
34 \begin{list}{}{%
35 \settowidth{\labelwidth}{#1}%
36 \setlength{\leftmargin}{\labelwidth}%
37 \addtolength{\leftmargin}{\labelsep}%
38 }}
39 {\end{list}}
40
41 \DefineVerbatimEnvironment{sreoutput}{Verbatim}{fontsize=\scriptsize,xleftmargin=2.0\parindent}%
42 \DefineVerbatimEnvironment{widesreoutput}{Verbatim}{fontsize=\scriptsize,xleftmargin=0.0\parindent}%
43 \DefineVerbatimEnvironment{tinysreoutput}{Verbatim}{fontsize=\tiny,xleftmargin=2.0\parindent}%
44
45 \makeatletter
46 \newcommand{\listoffaqs}{\@starttoc{faq}}
47 \newenvironment{srefaq}[1]
48 {\addcontentsline{faq}{faq}{#1}\begin{sloppypar}\noindent\slshape\small\begin{quote}\textbf{$\triangleright$ #1}}
49 {\end{quote}\end{sloppypar}}
50 \newcommand{\l@faq}[2]{\@dottedtocline{0}{0pt}{0pt}{#1}{#2}}
51 \makeatother
52
53
54 % Consistent font styles
55 % \software{} for the name of a software package
56 % \database{} for the name of a database
57 % \prog{} for a program or file name
58 % \emprog{} for an emphasized program or file name
59 % \user{} for a typed user command
60 % \scriptuser{} scriptsize typed user command
61 % \response{} for an output line following a \user command
62 % \ccode{} for an inlined C code phrase
63 % \otext{} text output from a program
64 %\newcommand{\software}[1]{\textsc{#1}} NOT CURRENTLY USED
65 %\newcommand{\database}[1]{\textsc{#1}} NOT CURRENTLY USED
66 \newcommand{\prog}[1]{{\small\texttt{#1}}}
67 \newcommand{\emprog}[1]{{\small\bfseries\texttt{#1}}}
68 \newcommand{\user}[1]{\indent\indent{\small\bfseries\texttt{> #1}}}
69 \newcommand{\scriptuser}[1]{\indent\indent{\scriptsize\bfseries\texttt{> #1}}}
70 \newcommand{\response}[1]{\indent\indent{\small\bfseries\texttt{#1}}}
71 \newcommand{\ccode}[1]{{\small\texttt{#1}}}
72 \newcommand{\otext}[1]{{\small\texttt{#1}}}
73
74 \DefineVerbatimEnvironment{cchunk}{Verbatim}{fontsize=\scriptsize,xleftmargin=2.0\parindent}%
75
76 % The ``wideitem'' environment is mostly obsolete, but
77 % it gets used in converted manpages.
78 %
79 \newenvironment{wideitem}{\begin{list}
80 {}
81 { \setlength{\labelwidth}{2in}\setlength{\leftmargin}{1.5in}}}
82 {\end{list}}
83
84
85 % The following are used as temp vars in how man pages are
86 % converted into LaTeX w/ rman; see ``make manpages'' in Makefile.
87 \newlength{\sresavei}
88 \newlength{\sresaves}
89
90 \def\argmax{\mathop{\mathrm{argmax}}\limits}
91 \def\argmin{\mathop{\mathrm{argmin}}\limits}
92
93 % The sidebar environment, for inserting ``asides''.
94 % Requires the ``fancybox'' package.
95 % Example:
96 % \usepackage{fancybox}
97 % ...
98 % \begin{sidebar}
99 % \sidebarhead{An aside on string theory.}
100 % String theory is not mentioned in this document.
101 % \end{sidebar}
102 %
103 % SRE, Sun Nov 6 14:45:32 2005
104 %
105 \newenvironment{sidebar}%
106 {\begin{Sbox}\begin{minipage}{\textwidth}\setlength{\parskip}{0.5em}}%
107 {\end{minipage}\end{Sbox}%
108 \begin{figure}[htp]\shadowbox{\TheSbox}\end{figure}%
109 \setlength{\parskip}{0em}}
110 \newcommand{\sidebarhead}[1]{{\bfseries{#1}}\vspace{0.3em}}