]> git.decadent.org.uk Git - ion3-doc.git/blob - macros.tex
[svn-upgrade] Integrating new upstream version, ion3 (20070318)
[ion3-doc.git] / macros.tex
1 \usepackage{babel}
2 \usepackage[latin1]{inputenc}
3 \usepackage[dvipdfm]{hyperref}
4 \usepackage{ae}
5 \usepackage{url}
6 \usepackage{html}
7 %\usepackage{graphicx}
8 %\usepackage{color}
9 \usepackage{makeidx}
10 \usepackage{tabularx}
11 \usepackage{textcomp}
12 \usepackage[nottoc]{tocbibind}
13 \usepackage{enumerate} % GNU FDL needs this
14 \usepackage[a4paper]{geometry}
15 \usepackage{calc}
16
17 % URL settings
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19
20 \urlstyle{rm}
21 \newcommand{\centerurl}[1]{\begin{center}\url{#1}\end{center}}
22
23 % listings package
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25
26 %begin{latexonly}
27 \usepackage{listings}
28
29 \lstset{
30   extendedchars=true,
31   breaklines=true,
32   basicstyle=\tt,
33   alsoletter={",},
34   alsoother={\_},
35 }
36 %end{latexonly}
37
38 % Some markup
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40
41 \newcommand{\note}[1]{\color{red}**#1**}
42 \newcommand{\file}[1]{\emph{#1}}
43 \newcommand{\type}[1]{#1}
44 \newcommand{\spec}[1]{#1}
45 \newcommand{\indextype}[1]{\index{#1@\type{#1}}}
46
47 %begin{latexonly}
48 \newcommand{\key}[1]{\mbox{\textbf{#1}}}
49 \newcommand{\code}[1]{\lstinline!#1!}
50 \newcommand{\var}[1]{\lstinline!#1!}
51 \newcommand{\command}[1]{\lstinline!#1!}
52
53 \newcommand{\hyperlabel}[1]{\hypertarget{#1}{}\label{#1}}
54 \newcommand{\fnrefx}[2]{\hyperlink{fn:#1.#2}{\code{#2}}}
55 \newcommand{\fnref}[1]{\hyperlink{fn:#1}{\code{#1}}}
56 \newcommand{\myhref}[2]{\hyperlink{#1}{#2}}
57
58 %end{latexonly}
59 \begin{htmlonly}
60     
61 \newcommand{\key}[1]{\textbf{#1}}
62 \newcommand{\code}[1]{\texttt{#1}}
63 \newcommand{\var}[1]{\texttt{#1}}
64 \newcommand{\command}[1]{\texttt{#1}}
65
66 \newcommand{\hyperlabel}[1]{\label{#1}}
67 \newcommand{\fnref}[1]{\htmlref{\texttt{#1}}{fn:#1}}
68 \newcommand{\fnrefx}[2]{\htmlref{\texttt{#2}}{fn:#1.#2}}
69 \newcommand{\myhref}[2]{\htmlref{#2}{#1}}
70
71 \end{htmlonly}
72
73 \newcommand{\tabhead}[1]{\hline #1 \\ \hline}
74
75 % function tables
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77
78 %begin{latexonly}
79
80 \newcommand{\funclistlabel}[1]{#1\hfill}
81 \newenvironment{function}{
82   \pagebreak[3]
83   \begin{list}{}{
84         \settowidth{\labelwidth}{Description:}
85         \setlength{\leftmargin}{\labelwidth}
86         \addtolength{\leftmargin}{0.5em}
87         \setlength{\labelsep}{0.5em}
88         \setlength{\itemsep}{0pt}
89         \setlength\parsep{0pt}
90         \setlength\topsep{0pt}
91         %\setlength{\itemsep}{-\parskip}
92         %\addtolength{\itemsep}{\lineskip}
93         \let\makelabel\funclistlabel
94   }
95 }{
96   \end{list}
97 }
98
99 %end{latexonly}
100 \begin{htmlonly}
101
102 \newenvironment{function}{
103   \begin{description}
104 }{
105   \end{description}
106 }
107
108 \end{htmlonly}
109
110
111 \newcommand{\synopsis}[1]{
112   \item[Synopsis:] \code{#1}
113 }
114 \newcommand{\funcname}[1]{
115   \item[Function:] \code{#1}
116 }
117 \newcommand{\hookname}[1]{
118   \item[Hook name:] \hyperlabel{#1}\code{#1}
119 }
120 \newcommand{\hookparams}[1]{
121   \item[Parameters:] \code{#1}
122 }
123 \newenvironment{funcdesc}{
124   \item[Description:]
125 }{}
126
127
128 % While rapport3/artikel3 are otherwise nice classes, 
129 % itemize looks awful.
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %begin{latexonly}
132 \makeatletter
133 \renewenvironment{itemize}{%
134   \ifnum \@itemdepth >3
135     \@toodeep
136   \else
137     \advance\@itemdepth \@ne
138     \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
139     \list{\csname\@itemitem\endcsname}%
140          {%
141             \if@revlabel
142               \def\makelabel##1{\hskip .5\unitindent{\hfil ##1}}\else
143                                                     %^^^^^^^^^ Changed
144               \def\makelabel##1{\hfil ##1}
145                                %^^^^^^^^^ Changed
146             \fi
147           }%
148   \fi}
149  {\global\@ignoretrue \endlist}
150 \makeatletter
151 %end{latexonly}