fc75e6666d150058f57664b25a46f3ced6ccfe41
[apps/madmutt.git] / doc / madmutt.sty
1 % this is pseudo-package with some definitions exluded
2 % from madmutt-tex.xsl to madmutt.sty
3 % written for madmutt by:
4 % Rocco Rutte <pdmef@cs.tu-berlin.de>
5
6 % packages
7 \usepackage[american]{babel}
8 \usepackage{ifpdf,makeidx,listings,longtable,textcomp}
9 \usepackage[utf-8]{inputenc}
10
11 \ifpdf
12   % options for pdf output
13   \usepackage[pdftex]{graphicx,thumbpdf}
14   \usepackage{ae,varioref,hyperref}
15   \hypersetup{breaklinks=true}
16   \newcommand{\web}[1]{\href{#1}{\nolinkurl{<#1>}}}
17   \pdfcompresslevel=9
18 \else
19   % options for non-pdf output
20   \usepackage[dvips]{graphicx,hyperref}
21   % we need a clue on breaking URLs here to always work:
22   % - hyperref does it for pdf output
23   % - breakurl does it for non-pdf + non-html output
24   % - don't do it for tex4ht output
25   \makeatletter
26   \@ifpackageloaded{tex4ht}
27     {
28       % when doing tex4ht output, there's no need to
29       % break URLs at all since browsers will do that
30       \newcommand{\web}[1]{\href{#1}{\texttt{<#1>}}}
31     }{
32       % when not producing tex4ht output (i.e. postscript),
33       % use breakurl.sty to break URLs
34       \usepackage{breakurl,varioref}
35       \newcommand{\web}[1]{\texttt{<}\burl{#1}\texttt{>}}
36     }
37   \makeatother
38 \fi
39 \usepackage{makeidx}
40
41 % no variables in toc, please!
42 \setcounter{tocdepth}{1}
43
44 % really call \appendix only once
45 \newcounter{app}
46 \newcommand{\myappendix}[0]{
47   \ifnum\arabic{app}=0
48     \appendix
49   \fi
50   \addtocounter{app}{1}
51 }
52
53 % from here on, these implement the madmutt-doc namespace,
54 % see Hacking Documentation for details
55 % madmutt-tex.xsl passes most of the content as-is so that
56 % we do it here via LaTeX rather than XSL for good reason...
57
58 \newcommand{\uglyesc}[1]{\lstinline[basicstyle=\ttfamily]{#1}}
59
60 \newcommand{\mailto}[1]{\href{mailto:#1}{\texttt{<#1>}}}
61
62 \newcommand{\man}[2][\empty]{\texttt{#2(\ifx#1\empty1\else#1\fi)}\index{#2@\texttt{#2(\ifx#1\empty1\else#1\fi)}}}
63
64 \newcommand{\pat}[2][0]{\ifnum #1=0\texttt{\char126 #2}\else\texttt{\char126 #2/=#2}\fi\index{\char126 #2@\texttt{\char126 #2/=#2}}}
65
66 \newcommand{\var}[1]{\uglyesc{$#1}\index{#1@\uglyesc{$#1}}}
67
68 \newcommand{\envvar}[1]{\var{#1}}
69
70 \newcommand{\hook}[1]{\hyperlink{#1-hook}{\texttt{#1-hook}}\index{#1-hook@\texttt{#1-hook}}}
71
72 \newcommand{\cmddef}[2]{Usage: \uglyesc{#1} #2\hypertarget{cmd:#1}{}\index{#1@\uglyesc{#1}}}
73 \newcommand{\cmdref}[1]{\hyperlink{cmd:#1}{\uglyesc{#1}}\index{#1@\uglyesc{#1}}}
74
75 \newcommand{\funcdef}[2]{\texttt{<#1>} (default: \texttt{#2})\hypertarget{func:#1}{}\index{#1@\uglyesc{<#1>}}}
76 \newcommand{\funcref}[1]{\hyperlink{func:#1}{\texttt{<#1>}}\index{#1@\uglyesc{<#1>}}}
77
78 \newcommand{\vardef}[1]{\subsection{\uglyesc{$#1}}\hypertarget{#1}{}\index{#1@\uglyesc{$#1}}}
79 \newcommand{\varref}[1]{\hyperlink{#1}{\uglyesc{$#1}}\index{#1@\uglyesc{$#1}}}
80
81 \newcommand{\rfc}[1]{\href{http://www.faqs.org/rfcs/rfc#1.html}{RfC #1}\index{RfC!#1}}
82
83 \newcommand{\key}[1]{\texttt{#1}}
84
85 \makeindex