-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpaper.tex
426 lines (349 loc) · 14.1 KB
/
paper.tex
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
\documentclass{ansarticle}
\title{Preparing articles for submission to the \\
Archive of Numerical Software}
\author[1]{Editor O. Archive\thanks{Additional thanks to my neighbor's dog
for waking me up on time to work on this style file}}
\author[2]{Author O. Software}
\affil[1]{The Archive of Numerical Software}
\affil[2]{The Worlds Best Place for Numerical Software}
\runningtitle{Preparing articles for ANS}
\runningauthor{Archive Editors}
%------------------------------------------------------------------------------
\begin{document}
\maketitle
\begin{abstract}
This document describes the general structure of the
\emp{ansarticle} document class and serves as an example for its
usage. The \emp{ansarticle} document class is based on the standard
\LaTeX{} \emp{article} document class and a few other standard
packages. It fixes style parameters to the preferred style of the
Archive of Numerical Software (ANS).
\end{abstract}
%------------------------------------------------------------------------------
\section{Requirements}
To write an article for ANS, you need to download the following files
from the ANS web page:
\begin{itemize}
\item
\emp{paper.tex}, the source file for this document and a template for
authors;
\item
\emp{ansarticle.cls}, the ANS document class file;
\item
\emp{anslistings.sty}, the ANS style file for typesetting of code;
\item
\emp{bibliography.bib}, a bibliography with some important
references;
\item
\emp{Makefile}, useful for building your document.
\end{itemize}
These files are all included in the tarball \emp{ansarticle.tgz}.
The file \emp{ansarticle.cls} loads the standard LaTeX
\emp{article.cls} and some additional packages. It also sets up the
layout. Hardly any of the options of the packages are available to the
author, in order to keep the journal style consistent.
Upon loading, \emp{ansarticle.cls} requires the following packages:
\emp{a4wide},
%\emp{anslistings},
\emp{algorithm}, \emp{algorithmicx}, \emp{algpseudocode},
\emp{authblk},
\emp{amsmath}, \emp{amssymb},
\emp{booktabs},
\emp{fancyhdr},
\emp{graphicx},
\emp{hyperref},
\emp{lastpage},
\emp{listings},
\emp{todonotes}.
These packages are part of standard \LaTeX{} distributions and should
not cause any difficulties.
%------------------------------------------------------------------------------
\section{Usage}
\subsection{Building the document}
Use this file (\emp{paper.tex}) as a template for your article. Then
simply type \emp{make} to build your article. This will call
\emp{pdflatex} to generate the PDF file \emp{paper.pdf}. To also call
\emp{bibtex}, type \emp{make final}.
\subsection{Typesetting mathematical formul\ae}
The ANS document class uses the \emp{amsmath} and \emp{amssymb}
packages for improved typesetting of mathematical formul\ae like,
e.g., this one:
\begin{equation}
\cfrac{1}{\sqrt{2}+
\cfrac{1}{\sqrt{2}+
\cfrac{1}{\sqrt{2}+\dotsb
}}}.
\end{equation}
Make sure that you familiarize yourself with the \emp{amsmath}
environments \emp{multline}, \emp{align} and \emp{split} (and know the
differences between them). Avoid home-made splitting using
\emp{\{array\}\{rcl\}}. For details, refer to the \emp{amsmath}
documentation.
\subsection{Typesetting tables}
Use the commands provided by the \emp{booktabs} package for better
looking typesetting of tables, as illustrated in
Table~\ref{tab:tableexample}.
\begin{table}
\begin{center}
\begin{tabular}{lcc}
\toprule
Entity & Dimension & Codimension \\
\hline
Vertex & $0$ & $D$ \\
Edge & $1$ & $D-1$ \\
Face & $2$ & $D-2$ \\
& & \\
Facet & $D-1$ & $1$ \\
Cell & $D$ & $0$ \\
\bottomrule
\end{tabular}
\end{center}
\caption{Mesh entities and their dimensions/codimensions.}
\label{tab:tableexample}
\end{table}
\subsection{Typesetting algorithms}
Use the functionality provided by the packages \emp{algorithm},
\emp{algorithmic} and \emp{algpseudocode}, automatically included by
the \emp{ansarticle} document class, to typeset algorithms. This is
illustrated in Algorithm~\ref{alg:algorithmexample}.
\begin{algorithm}
\begin{algorithmic}
\State $D^{0,0}(x,y) := 1$
\State $D^{1,0}(x,y) := \frac{1+2x+y}{2}$
\For{$p \gets 1$, $d-1$}
\State $D^{p+1,0}(x,y) := \left( \frac{2p+1}{p+1} \right)
\left( \frac{1 + 2x + y}{2} \right) D^{p,0}(x,y)
- \left( \frac{p}{p+1} \right) \left( \frac{1-y}{2} \right)^2
D^{p-1,0}(x,y)$
\EndFor
\For{$p \gets 0,d-1$}
\State $D^{p,1}(x,y) := D^{p,0}(x,y) \left( \frac{1+2p+(3+2p) y}{2} \right)$
\EndFor
\For{$p \gets 0,d-1$}
\For{$q \gets 1,d-p-1$}
\State $D^{p,q+1}(x,y) :=
\left( a_{q}^{2p+1,0} y + b_q^{2p+1,0} \right) D^{p,q}(x,y)
- c_q^{2p+1,0} D^{p,q-1}(x,y)$
\EndFor
\EndFor
\end{algorithmic}
\caption{Compute all triangular orthogonal polynomials up to degree
$d$ by recurrence}
\label{alg:algorithmexample}
\end{algorithm}
\subsection{Typesetting code}
All code listings are based on the \emp{listings}
package~\citep{HeinzMoses07}. The package \emp{anslistings},
automatically included by \emp{ansarticle} document class, provides
standard styles for a variety of common programming
languages. Changing any style parameters for this package is not
encouraged and may lead to unexpected outcomes in the final
publication.
Below, we provide samples of listings for the some of the languages
available. If a language is missing, please contact the managing
editor for an updated style file.
\subsubsection{C++}
Code should be compliant with the current C++ standard. Two commands
are provided to prettyprint C++ code. First, an environment to put C++
code into the LaTeX file, namely
\begin{latexcode}
\begin{c++}
// Your C++ code here
\end{c++}
\end{latexcode}
Alternatively, it is possible to use
\lstinline[language=TeX]!\inputcpp{file.cc}! to print the C++ code in
a file. Here is an example of typesetting of C++ code:
\begin{c++}
// Get dimensions of local mesh_data
const unsigned int num_local_cells = mesh_data.cell_vertices.size();
assert(global_cell_indices.size() == num_local_cells);
const unsigned int num_cell_vertices = mesh_data.cell_vertices[0].size();
// Build array of cell-vertex connectivity and partition vector
std::vector<unsigned int> cell_vertices;
std::vector<unsigned int> cell_vertices_partition;
const unsigned int size = num_local_cells*(num_cell_vertices + 1);
cell_vertices.reserve(size);
cell_vertices_partition.reserve(size);
for (unsigned int i = 0; i < num_local_cells; i++)
{
cell_vertices.push_back(global_cell_indices[i]);
cell_vertices_partition.push_back(cell_partition[i]);
for (unsigned int j = 0; j < num_cell_vertices; j++)
{
cell_vertices.push_back(mesh_data.cell_vertices[i][j]);
cell_vertices_partition.push_back(cell_partition[i]);
}
}
// Distribute cell-vertex connectivity
MPI::distribute(cell_vertices, cell_vertices_partition);
assert(cell_vertices.size());
cell_vertices_partition.clear();
\end{c++}
\subsubsection{Python}
The following illustrates typesetting of Python code:
\begin{python}
# Time-stepping
t = dt
while t < T:
# Compute tentative velocity step
b1 = assemble(L1)
[bc.apply(A1, b1) for bc in bcu]
solve(A1, u1.vector(), b1, "gmres", "ilu")
# Pressure correction
b2 = assemble(L2)
[bc.apply(A2, b2) for bc in bcp]
solve(A2, p1.vector(), b2, "gmres", "amg_hypre")
# Velocity correction
b3 = assemble(L3)
[bc.apply(A3, b3) for bc in bcu]
solve(A3, u1.vector(), b3, "gmres", "ilu")
# Plot solution
plot(p1, title="Pressure", rescale=True)
plot(u1, title="Velocity", rescale=True)
# Save to file
ufile << u1
pfile << p1
# Move to next time step
u0.assign(u1)
t += dt
\end{python}
\subsection{Handling supplementary material}
Additional material which is not part of the article text, but part of
the submission, for instance setup scripts or video output, can be
linked from the article, using the \emp{hyperref} commands
(\emp{hyperref} is automaticly included by
\emp{ansarticle}). URLs to such material should start with the
filename. A suitable prefix will be added to the links in the
editorial process.
\subsection{Citations}
The \emp{ansarticle} document class imports the \emp{natbib} package,
which provides the commands \emp{\textbackslash{}citet\{\}} and
\emp{\textbackslash{}citep\{\}}. These should be used in place of the
regular \emp{\textbackslash{}cite\{\}} command as illustrated by the
following passage: It was found by \citet{Wittgenstein1921} that what
we cannot speak about we must pass over in silence, contrary to common
belief~\citep{Newton1687}.
\subsection{Other}
The \emp{ansarticle} document class provides a number of useful
notation macros which you can find by browsing through the file
\emp{ansarticle.cls}.
\subsection{Checklist}
Before submitting your manuscript to ANS, please review the following
checklist:
\begin{enumerate}
\item
Have you run a spell checker on your manuscript (using an American English
dictionary)?
\item
Have you referenced all libraries you have been using and the
appropriate versions and descriptive publications?
\item
Have you referred to all figures and tables (callouts)?
\item
Have you used a scalable vector graphics format for all images where
possible?
\end{enumerate}
Before submitting your source code to ANS, please review the following
checklist:
\begin{enumerate}
\item Does a simple 'make' or similar build and run the program in a
default configuration?
\item Did you include all configuration information necessary?
\item Did you include instructions on how to reproduce the examples in
the text?
\end{enumerate}
%------------------------------------------------------------------------------
\section{Production after article was accepted}
\subsection{The manuscript}
Once the article is accepted, the editor will send you a file
\emp{ansinfo.tex} in the same directory. The file contains macros
defining the publication information like in the following listing:
\inputlatex{ansinfo.tex}
Please copy this file where \LaTeX{} can find it and recompile your
manuscript to produce the finale version of the PDF.
\subsection{The source code}
If necessary, clean up the source code directory. Make sure you
include only the files readers should download with the source (see
the next subsection on media files). Make sure, a simple 'make' or
similar will run a first example. Assert that the data in the
manuscript can be reproduced.
\subsection{The media directory}
Every article comes with a media directory. This directory contains a
file \texttt{index.html} which is linked from the article page and
should serve as an entry point to your media files. The minimum
requirement on this file is the following head:
\begin{lstlisting}[language=html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ANS V(N) Authors: Title</title>
<link rel="stylesheet" type="text/css" href="/ans.css"/>
</head>
<body>
<h2>Archive of Numerical Software V(N)</h2>
<h1>Title</h1>
<h2>Authors</h2>
Text and links
</body>
</html>
\end{lstlisting}
The occurences of \lstinline[language=html]!V(N)! should be replaced
by the assigned volume and number of the publication,
\lstinline[language=html]!Title! and
\lstinline[language=html]!Authors! accordingly. You are welcome to
use image tags in this file.
Add your image files and movies to this directory, not to the source
code!
%------------------------------------------------------------------------------
\section{Philosophi\ae{} Naturalis Principia Mathematica}
\fixme{Also add main references for all libraries listed on the ANS
web page.}
As an example text, we present an excerpt from~\citet{Newton1687}.
\subsection{Definitiones}
\subsubsection{Def. I}
Quantitas Materi\ae{} est mensura ejusdem orta ex illius Densitate \&
Magnitudine conjunctim.
\paragraph{Aer} duplo densior in duplo spatio quadruplus est. Idem
intellige de Nive et Pulveribus per compressionem vel liquefactionem
condensatis. Et par est ratio corporum omnium, qu\ae{} per causas
quascunq; diversimode condensantur. Medii interea, si quod fuerit,
interstitia partium libere pervadentis, hic nullam rationem
habeo. Hanc autem quantitatem sub nomine corporis vel Mass\ae{} in
sequentibus passim intelligo. Innotescit ea per corporis cujusq;
pondus. Nam ponderi proportionalem esse reperi per experimenta
pendulorum accuratissime instituta, uti posthac docebitur.
\subsubsection{Def. II}
Quantitas motus est mensura ejusdem orta ex Velocitate et quantitate
Materi\ae{} conjunctim.
\paragraph{Motus}
totius est summa motuum in partibus singulis, adeoq; in corpore duplo
majore \ae{}quali cum Velocitate duplus est, et dupla cum Velocitate
quadruplus.
\subsubsection{Def. III}
Materi\ae{} vis insita est potentia resistendi, qua corpus unumquodq;,
quantum in se est, perseverat in statu suo vel quiescendi vel movendi
uniformiter in directum.
\paragraph{H\ae{}c}
semper proportionalis est suo corpori, neq; differt quicquam ab
inertia Mass\ae{}, nisi in modo concipiendi. Per inertiam materi\ae{} fit ut
corpus omne de statu suo vel quiescendi vel movendi difficulter
deturbetur. Unde etiam vis insita nomine significantissimo vis inerti\ae{}
dici possit. Exercet vero corpus hanc vim solummodo in mutatione
status sui per vim aliam in se impressam facta, estq; exercitium ejus
sub diverso respectu et Resistentia et Impetus: Resistentia quatenus
corpus ad conservandum statum suum reluctatur vi impress\ae{}; Impetus
quatenus corpus idem, vi resistentis obstaculi difficulter cedendo,
conatur statum ejus mutare. Vulgus Resistentiam quiescentibus et
Impetum moventibus tribuit; sed motus et quies, uti vulgo
concipiuntur, respectu solo distinguuntur ab invicem, neq; semper vere
quiescunt qu\ae{} vulgo tanquam quiescentia spectantur.
\subparagraph{A subparagraph} If you really want to nest that deeply, go
ahead! But, while you might have enjoyed
reading~\citet{Wittgenstein1921,Wittgenstein1981}, you are encouraged to
question the applicability to a publication on a thing as profane as
software.
\bibliographystyle{abbrvnat}
\bibliography{submitting}
\end{document}