1 |
% $Id$ |
2 |
|
3 |
\usepackage{epsfig} |
4 |
\usepackage{graphicx,color} |
5 |
\usepackage{makeidx} % handle the index properly |
6 |
\usepackage{xspace} % handle spaces after commands more nicely |
7 |
% use the ams math stuff, as it makes the maths easier to code, and |
8 |
% nicer output than the standard LaTeX stuff |
9 |
\usepackage{amsmath,amsfonts,amssymb} % this is handy for mathematicians and physicists |
10 |
% see http://www.ams.org/tex/amslatex.html |
11 |
\usepackage{alltt} % handy verbatim stuff |
12 |
|
13 |
|
14 |
% define some handy commands for escript stuff |
15 |
\newcommand{\ESyS}{\module{esys}\xspace} |
16 |
\newcommand{\escript}{\module{esys.escript}\xspace} |
17 |
\newcommand{\finley}{\module{esys.finley}\xspace} |
18 |
\newcommand{\linearPDEsPack}{\module{esys.linearPDEs}\xspace} |
19 |
\newcommand{\LinearPDE}{\class{LinearPDE}\xspace} |
20 |
\newcommand{\AdvectivePDE}{\class{AdvectivePDE}\xspace} |
21 |
\newcommand{\Poisson}{\class{Poisson}\xspace} |
22 |
\newcommand{\Data}{\class{Data}\xspace} |
23 |
\newcommand{\EmptyData}{empty \class{Data} \index{empty Data}\xspace} |
24 |
\newcommand{\Domain}{\class{Domain}\xspace} |
25 |
\newcommand{\OpenDX}{{\it OpenDX}\xspace} |
26 |
\newcommand{\finleyelement}[1]{{\it #1}\index{finley!#1}} |
27 |
\newcommand{\False}{\constant{False}\xspace} |
28 |
\newcommand{\True}{\constant{True}\xspace} |
29 |
\newcommand{\PCG}{\constant{PCG}\index{linear solver!PCG}\index{PCG}} |
30 |
\newcommand{\BiCGStab}{\constant{BICGSTAB}\index{linear solver!BiCGStab}\index{BiCGStab}} |
31 |
\newcommand{\Direct}{\constant{DIRECT}\index{linear solver!Direct}\index{Direct solver}} |
32 |
\newcommand{\GMRES}{\constant{GMRES}\index{linear solver!GMRES}\index{GMRES}} |
33 |
\newcommand{\PRESTWENTY}{\constant{PRES20}\index{linear solver!PRES20}\index{PRES20}} |
34 |
|
35 |
\newcommand{\FunctionSpace}{\class{FunctionSpace}\xspace} |
36 |
\newcommand{\Operator}{\class{Operator}\xspace} |
37 |
\newcommand{\SolutionFS}{solution \class{FunctionSpace}\index{solution}\xspace} |
38 |
\newcommand{\ReducedSolutionFS}{reduced solution \class{FunctionSpace}\index{solution!reduced}\xspace} |
39 |
\newcommand{\FunctionOnBoundary}{boundary \class{FunctionSpace}\xspace} |
40 |
\newcommand{\Function}{general \class{FunctionSpace}\xspace} |
41 |
\newcommand{\FunctionOnContactZero}{contact \class{FunctionSpace} on side 0\xspace} |
42 |
\newcommand{\FunctionOnContactOne}{contact \class{FunctionSpace} on side 1\xspace} |
43 |
\newcommand{\ContinuousFunction}{continuous \class{FunctionSpace}\xspace} |
44 |
\newcommand{\RankTwo}{{rank-2 \Data object}\xspace} |
45 |
\newcommand{\RankOne}{{rank-1 \Data object}\xspace} |
46 |
\newcommand{\RankThree}{{rank-3 \Data object}\xspace} |
47 |
\newcommand{\RankFour}{{rank-4 \Data object}\xspace} |
48 |
\newcommand{\Scalar}{{scalar \Data object}\xspace} |
49 |
\newcommand{\DataSample}{{data sample} \index{data sample}\xspace} |
50 |
\newcommand{\DataSamplePoints}{{data sample points} \index{data sample!points}\xspace} |
51 |
\newcommand{\numarray}{\module{numarray}\xspace} |
52 |
\newcommand{\Shape}{shape\xspace\index{shape}} |
53 |
\newcommand{\ExampleDirectory}{example directory\xspace} |
54 |
|
55 |
|
56 |
|
57 |
% default width for figures |
58 |
\newcommand{\figwidth}{100mm} |
59 |
% commands useful in cross-referencing |
60 |
\newcommand {\Ref}[1] {Reference~\cite{#1}} |
61 |
\newcommand {\Sec}[1] {Section~\ref{#1}} |
62 |
\newcommand {\App}[1] {Appendix~\ref{#1}} |
63 |
\newcommand {\Chap}[1] {Chapter~\ref{#1}} |
64 |
\newcommand {\etal} {\emph{~et~al.}} |
65 |
\newcommand {\fig}[1] {Figure~\ref{#1}} |
66 |
\newcommand {\eqn}[1] {Equation~(\ref{#1})} |
67 |
\newcommand {\tab}[1] {Table~\ref{#1}} |
68 |
|
69 |
% this stops one figure taking up a whole page and lets more text onto |
70 |
% the one page when a figure exists |
71 |
\renewcommand{\floatpagefraction}{0.8} % Default = 0.5 |
72 |
|
73 |
% improved version of caption handling |
74 |
\usepackage{ccaption} |
75 |
\captionnamefont{\scshape} |
76 |
\captionstyle{} |
77 |
\makeatletter |
78 |
\renewcommand{\fnum@figure}[1]{\quad\small\textsc{\figurename~\thefigure}:} |
79 |
\renewcommand{\@makecaption}[2]{% |
80 |
\vskip\abovecaptionskip |
81 |
\sbox\@tempboxa{#1: #2}% |
82 |
\ifdim \wd\@tempboxa >\hsize |
83 |
\def\baselinestretch{1}\@normalsize |
84 |
#1: #2\par |
85 |
\def\baselinestretch{1.5}\@normalsize |
86 |
\else |
87 |
\global \@minipagefalse |
88 |
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% |
89 |
\fi |
90 |
\vskip\belowcaptionskip} |
91 |
\makeatother |
92 |
|
93 |
\usepackage{fancyvrb} % fancy verbatim stuff. Needed so code below goes |
94 |
%%% this code grabbed from the PyScript docs |
95 |
%%% pyscript.sourceforge.net |
96 |
|
97 |
% -------------------------------------------------------------- |
98 |
% Code format within \Verb |
99 |
% -------------------------------------------------------------- |
100 |
|
101 |
\definecolor{pycolor}{rgb}{0,0.4,0} |
102 |
|
103 |
%% \DefineVerbatimEnvironment{python}{Verbatim} |
104 |
%% {frame=leftline,framerule=.5mm,rulecolor=\color{pycolor}, |
105 |
%% formatcom=\color{pycolor}\small,fontshape=rm} |
106 |
|
107 |
%\DefineShortVerb[formatcom=\color{dgreen}\small,fontshape=sl]{\|} |
108 |
|
109 |
\RecustomVerbatimCommand{\Verb}{Verb}{formatcom=\color{pycolor}\small,fontshape=rm} |
110 |
|
111 |
%%% end of grabbed code |
112 |
|
113 |
% this is for when one uses pdflatex and therefore needs to load pdf |
114 |
% figures into \includegraphics |
115 |
\ifpdf |
116 |
\DeclareGraphicsExtensions{.pdf} % this command defined in graphicx |
117 |
\pdfcompresslevel=9 % 0: no compression, 9: highest compression |
118 |
% or, set compress_level 9 in file pdftex.cfg |
119 |
\else |
120 |
\DeclareGraphicsExtensions{.eps} |
121 |
\fi |
122 |
|
123 |
% defines the colour for the background of code examples |
124 |
\definecolor{LightGrey}{gray}{0.9} |
125 |
|
126 |
% add the listings package to pretty print the code output |
127 |
\usepackage{listings} |
128 |
|
129 |
\lstdefinestyle{myC++}{% |
130 |
%\lstset{% |
131 |
language=C++, |
132 |
showstringspaces=false, |
133 |
basicstyle=\small\ttfamily, |
134 |
commentstyle=\color[named]{BrickRed}\ttfamily, |
135 |
keywordstyle=\color[named]{Purple}\ttfamily, |
136 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
137 |
%functionstyle=\color[named]{Blue}\ttfamily, |
138 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
139 |
stringstyle=\color[named]{Tan}\ttfamily,% |
140 |
morekeywords={,complex,}% |
141 |
frame=none,% |
142 |
backgroundcolor=\color{LightGrey}% |
143 |
} |
144 |
|
145 |
\lstdefinestyle{myMatlab}{% |
146 |
%\lstset{% |
147 |
language=Matlab, |
148 |
showstringspaces=false, |
149 |
basicstyle=\small\ttfamily, |
150 |
commentstyle=\color[named]{BrickRed}\ttfamily, |
151 |
keywordstyle=\color[named]{Purple}\ttfamily, |
152 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
153 |
%functionstyle=\color[named]{Blue}\ttfamily, |
154 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
155 |
stringstyle=\color[named]{Tan}\ttfamily,% |
156 |
frame=none,% |
157 |
backgroundcolor=\color{LightGrey}% |
158 |
} |
159 |
|
160 |
\lstdefinestyle{myScilab}{% |
161 |
%\lstset{% |
162 |
language=Scilab, |
163 |
showstringspaces=false, |
164 |
basicstyle=\small\ttfamily, |
165 |
commentstyle=\color[named]{BrickRed}\ttfamily, |
166 |
keywordstyle=\color[named]{Purple}\ttfamily, |
167 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
168 |
%functionstyle=\color[named]{Blue}\ttfamily, |
169 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
170 |
stringstyle=\color[named]{Tan}\ttfamily,% |
171 |
frame=none,% |
172 |
backgroundcolor=\color{LightGrey}% |
173 |
} |
174 |
|
175 |
\lstdefinestyle{myShell}{% |
176 |
%\lstset{% |
177 |
language=ksh, |
178 |
showstringspaces=false, |
179 |
basicstyle=\small\ttfamily, |
180 |
commentstyle=\color[named]{Black}\ttfamily, |
181 |
keywordstyle=\color[named]{Black}\ttfamily, |
182 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
183 |
%functionstyle=\color[named]{Blue}\ttfamily, |
184 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
185 |
stringstyle=\color[named]{Black}\ttfamily,% |
186 |
frame=none,% |
187 |
backgroundcolor=\color{LightGrey}% |
188 |
} |
189 |
|
190 |
\lstdefinestyle{myPython}{% |
191 |
%\lstset{% |
192 |
language=python, |
193 |
showstringspaces=false, |
194 |
basicstyle=\small\ttfamily, |
195 |
commentstyle=\color[named]{BrickRed}\ttfamily, |
196 |
keywordstyle=\color[named]{Purple}\ttfamily, |
197 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
198 |
%functionstyle=\color[named]{Blue}\ttfamily, |
199 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
200 |
stringstyle=\color[named]{Tan}\ttfamily,% |
201 |
frame=none,% |
202 |
%backgroundcolor=\color{LightGrey}% |
203 |
} |
204 |
|
205 |
\lstdefinestyle{myhtml}{% |
206 |
%\lstset{% |
207 |
language=xml, |
208 |
showstringspaces=false, |
209 |
basicstyle=\small\ttfamily, |
210 |
commentstyle=\color[named]{BrickRed}\ttfamily, |
211 |
keywordstyle=\color[named]{Purple}\ttfamily, |
212 |
%identifierstyle=\color[named]{Blue}\ttfamily, |
213 |
%functionstyle=\color[named]{Blue}\ttfamily, |
214 |
%typestyle=\color[named]{ForestGreen}\ttfamily, |
215 |
stringstyle=\color[named]{Tan}\ttfamily, |
216 |
morekeywords={,simulation,prop_dim,error_check,stochastic,% |
217 |
globals,field,dimensions,lattice,domains,samples,vector,% |
218 |
components,fourier_space,sequence,integrate,algorithm,% |
219 |
interval,k_operators,constant,operator_names,vectors,% |
220 |
output,filename,group,sampling,moments,benchmark,use_double,% |
221 |
use_wisdom,use_prefs,binary_output,cycles,filter,post_propagation,% |
222 |
default_value,argv,arg,iterations,cross_propagation,% |
223 |
use_mpi,paths,seed,noises,author,description,name,type,% |
224 |
} |
225 |
frame=none,% |
226 |
%framerule=2pt,% |
227 |
backgroundcolor=\color{LightGrey}% |
228 |
} |
229 |
|
230 |
% this implements producing nice code blocks |
231 |
% it also saves time, typing and |
232 |
% *should* reduce errors in the text by removing doubling up of code |
233 |
\lstnewenvironment{xmdsCode}[1][]{\lstset{style=myhtml}\lstset{#1}}{} |
234 |
|
235 |
% this implements nicely formatted shell code |
236 |
\lstnewenvironment{shellCode}[1][]{\lstset{style=myShell}\lstset{#1}}{} |
237 |
|
238 |
% this implements nicely formatted Perl code |
239 |
\lstnewenvironment{perlCode}[1][]{\lstset{style=myPerl}\lstset{#1}}{} |
240 |
|
241 |
% this implements nicely formatted Python code |
242 |
\lstnewenvironment{python}[1][]{\lstset{style=myPython}\lstset{#1}}{} |
243 |
|
244 |
% this implements nicely formatted C++ code |
245 |
\lstnewenvironment{CCode}{\lstset{style=myC++}}{} |
246 |
|
247 |
% this implements nicely formatted matlab code |
248 |
\lstnewenvironment{matlabCode}{\lstset{style=myMatlab}}{} |
249 |
|
250 |
% this implements nicely formatted scilab code |
251 |
\lstnewenvironment{scilabCode}{\lstset{style=myScilab}}{} |
252 |
|