summaryrefslogtreecommitdiff
path: root/doc/latex/cactus.sty
blob: a1fcbc2d428c2c649ea18fe24b4e642a1c73bf7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
% @version $Header$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}

\def\CA@styledate{\CA@getcvsdate $Date$}
\def\CA@styleversion{\CA@getcvsversion $Revision$}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\CA@getcvsdate    $#1:#2/#3/#4 #5:#6:#7${#2/#3/#4}
\def\CA@getcvsversion $#1:#2${#2}

\IfFileExists{../interface.ccl} % Is this the documentation.tex for a thorn?
{
  \ProvidesPackage{../../../../doc/latex/cactus}[\CA@styledate \CA@styleversion]
}
{
  \IfFileExists{../FAQ} % Is this the UsersGuide or MaintGuide?
  {
    \ProvidesPackage{../latex/cactus}[\CA@styledate \CA@styleversion]
  }
  {
    \IfFileExists{../../../arrangements/README} % Is this the
					 % documentation.tex for an
					 % entire arrangement?
    {
      \ProvidesPackage{../../../doc/latex/cactus}
    }
    {
      \ProvidesPackage{cactus}[\CA@styledate \CA@styleversion]
    }
  }
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Check if we are under pdftex
\newif\ifCA@pdf
\ifx\pdfoutput\undefined
   \CA@pdffalse % we are not running PDFLaTeX
\else
   \pdfoutput=1 % we are running PDFLaTeX
   \CA@pdftrue
   % Add the pdftex option to a subsequent load of graphicx
   \PassOptionsToPackage{pdftex}{graphicx}
\fi


% Load in other packages.

\RequirePackage{graphicx}
\RequirePackage{latexsym}
\RequirePackage{amssymb}
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{hyperref}

\parskip = 2 pt
\oddsidemargin = 0 cm
\textwidth = 16 cm
\topmargin = -1 cm
\textheight = 24 cm

% macros
\def\text#1{{\rm #1}}

% MANPAGE like description setting for options, use as % \begin{Lentry}
%\item[text] text \end{Lentry} \usepackage{ifthen,calc}
\newcommand{\entrylabel}[1]{\mbox{\textsf{#1}}\hfil}
\newenvironment{entry}
  {\begin{list}{}
    {\renewcommand{\makelabel}{\entrylabel}
      \setlength{\labelwidth}{90pt}
      \setlength{\leftmargin}{\labelwidth+\labelsep}
    }
  }
  {\end{list}} \newlength{\Mylen} \newcommand{\Lentrylabel}[1]{%
% Latex doesn't always like spaces -- sometimes it outputs them, and
% then they destroy the layout.  Please don't indent the following,
% nor add spaces, nor remove the percent signs, nor add spaces in
% front of them.
\settowidth{\Mylen}{\textsf{#1}}%
\ifthenelse{\lengthtest{\Mylen > \labelwidth}}%
{\parbox[b]{\labelwidth}% term > labelwidth
{\makebox[0pt][l]{\textsf{#1}}\\}}% {\textsf{#1}}%
\hfil\relax} \newenvironment{Lentry}
  {\renewcommand{\entrylabel}{\Lentrylabel}
   \begin{entry}}
  {\end{entry}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% Alternate environments/macros to define function descriptions
% (can/should be used to replace CCTKFunc environment)
% Jonathan Thornburg, 10 Nov 2001, revised 26 Mar 2002 & 3 Apr 2002
%
% Usage:
%	\begin{FunctionDescription}{name}
%	\label{label}
%	Synopsis for this function			(running text rules)
%
%	\begin{SynopsisSection}
%	\begin{Synopsis}{C}
%	text of C function synopsis			(running text rules)
%	\end{Synopsis}
%	\begin{Synopsis}{Fortran}
%	text of Fortran function synopsis		(running text rules)
%	\end{Synopsis}
%	\end{SynopsisSection}
%
%	\begin{ResultSection}
%	\begin{ResultNote}
%	optional note to go at the beginning of all results
%							(running text rules)
%	\end{ResultNote}
%	\begin{Result}{name or value (automatically in \tt font)}
%	desription of what the result means in general,
%	or of what this particular result value means	(running text rules)
%	\end{Result}
%	\end{ResultSection}
%
%	\begin{ParameterSection}
%	\begin{Parameter}{name (automatically in \tt font)}
%	desription of parameter				(running text rules)
%	\end{Parameter}
%	\begin{Parameter}{name2 (automatically in \tt font)}
%	desription of another parameter			(running text rules)
%	\end{Parameter}
%	\end{ParameterSection}
%
%	\begin{Discussion}
%	(note that there is no "DiscussionSection" environment!)
%	discussion					(running text rules)
%
%	another paragraph of discussion			(running text rules)
%
%	yet another paragraph of discussion		(running text rules)
%	\end{Discussion}
%
%	\begin{SeeAlsoSection}
%	\begin{SeeAlso}{name (automatically in \tt font)
%	cross-references to other function of that name (running text rules)
%	\end{SeeAlso}
%	\begin{SeeAlso}{name2 (automatically in \tt font)
%	cross-references to another function            (running text rules)
%	\end{SeeAlso}
%	\end{SeeAlsoSection}
%
%	\begin{ErrorSection}
%	\begin{Error}{error\_code (automatically in \tt font)}
%	description of what this error code means	(running text rules)
%	\end{Error}
%	\begin{Error}{error\_code2 (automatically in \tt font)}
%	description of what next error code means	(running text rules)
%	\end{Error}
%	\end{ErrorSection}
%
%	\begin{ExampleSection}
%	\begin{Example}{C}
%	example C code					(running text rules)
%	\end{Example}
%	\begin{Example}{Fortran}
%	example Fortran code				(running text rules)
%	\end{Example}
%	\end{ExampleSection}
%
% For arguments which are automatically in \tt font, \tt may be used
% to switch back to normal Roman font (eg for a numerical value), and
% $...$ may be used for math mode (eg  ($\ge 0$)  to mark a result
% which is always non-negative).
%
% Each "running text rules" item is the body of a latex environment,
% so it may include multiple lines or even paragraphs.  Normally
% underscore must be escaped (\_), but  \verb|...|  and/or
%	\begin{verbatim}
%	...
%	\end{verbatim}
% or similar constructs (which can't be used inside a macro argument)
% may also be used (in which case _ { } \ etc need not be escaped).
%
% All the subsections are optional.
%
% Bugs:
% - It would be nice if we could avoid having to escape underscore
%   within arguments.
% - Error checking: if you have to ask, there isn't enough for you! :)
% - There are no controls to prevent a page break falling between the
%   line "C" or "Fortran", and an immediately following example generated
%   by the Example subenvironment.  In fact, LaTeX seems to like doing
%   this. :(
% - It would be nice to have a "...continued" legend at the bottom of
%   all but the last page of a multi-page description.
% - The running header giving the function name, only appears for the
%   first page of a multi-page description.
% - In some ideal world, "See Also" would generate pdf hotlinks.
% - The horizontal spacing is ugly in a ResultNote environment, and it's
%   really *really* ugly if the note spans multiple lines of text. :(
% - There are often unwanted one-horizontal-space indentations at
%   the start of items; I don't know how to get rid of these. :(
%   
\newenvironment{FunctionDescription}[1]
{
\newpage
\noindent{\tt #1}
\vskip1mm
\hrule 
\vskip3mm
%
% We define all the subenvironments inside the main one, so they won't
% interfere with any conflicting global definitions.
%
\newenvironment{FunctionDescriptionEntry}
	       {%%%
	       \begin{list}%%%
		     {}%%%
		     {%%%
		     \renewcommand{\makelabel}{\Lentrylabel}%%%
		     \setlength{\topsep}{0ex}%%%
		     \setlength{\partopsep}{0ex}%%%
		     \setlength{\itemsep}{0ex}%%%
		     \setlength{\labelwidth}{8em}%%%
		     \setlength{\leftmargin}{\labelwidth+\labelsep}%%%
		     \setlength{\itemindent}{0em}%%%
		     \setlength{\listparindent}{0em}%%%
		     }%%%
	       }%%%
	       {\end{list}}%%%
\newenvironment{FunctionDescriptionWideEntry}
	       {%%%
	       \begin{list}%%%
		     {}%%%
		     {%%%
		     \renewcommand{\makelabel}{\Lentrylabel}%%%
		     \setlength{\topsep}{0ex}%%%
		     \setlength{\partopsep}{0ex}%%%
		     \setlength{\itemsep}{0ex}%%%
		     \setlength{\labelwidth}{16em}%%%
		     \setlength{\leftmargin}{\labelwidth+\labelsep}%%%
		     \setlength{\itemindent}{0em}%%%
		     \setlength{\listparindent}{0em}%%%
		     }%%%
	       }%%%
	       {\end{list}}%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{SynopsisSection}
	       {%%%
	       \par\noindent{\bf Synopsis}
               \begin{FunctionDescriptionEntry}
	       }%%%
               {\end{FunctionDescriptionEntry}}
\newenvironment{Synopsis}[1]{\item[\bf{##1}]}{}
%
\newenvironment{ResultSection}
	       {%%%
	       \par\noindent{\bf Result}
               \begin{FunctionDescriptionEntry}
	       }%%%
               {\end{FunctionDescriptionEntry}}
\newenvironment{ResultNote}{\item[]\hskip-\leftmargin{}}{}
\newenvironment{Result}[1]{\item[\tt{##1}]}{}
%
\newenvironment{ParameterSection}
	       {%%%
	       \par\noindent{\bf Parameters}
               \begin{FunctionDescriptionEntry}
	       }%%%
               {\end{FunctionDescriptionEntry}}
\newenvironment{Parameter}[1]{\item[\tt{##1}]}{}
%
\newenvironment{Discussion}%%%
               {%%%
	       \par\noindent{\bf Discussion}
	       \begin{FunctionDescriptionEntry}
               \item[]
               }%%%
               {\end{FunctionDescriptionEntry}}
%
\newenvironment{SeeAlsoSection}
	       {%%%
	       \par\noindent{\bf See Also}
               \begin{FunctionDescriptionWideEntry}
	       }%%%
               {\end{FunctionDescriptionWideEntry}}
\newenvironment{SeeAlso}[1]{\item[\tt{##1}]}{}
%
\newenvironment{ErrorSection}
	       {%%%
	       \par\noindent{\bf Errors}
               \begin{FunctionDescriptionWideEntry}
	       }%%%
               {\end{FunctionDescriptionWideEntry}}
\newenvironment{Error}[1]{\item[\tt{##1}]}{}
%
\newenvironment{ExampleSection}
	       {%%%
	       \par\noindent{\bf Examples}
               \begin{FunctionDescriptionEntry}
	       }%%%
               {\end{FunctionDescriptionEntry}}
\newenvironment{Example}[1]{\item[\bf{##1}]}{}
%
}%%%	% end of \begin{FunctionDescription} expansion
{%%%
}%%%	% \end{FunctionDescription} expansion is empty

\endinput
%%
%% End of cactus.sty