-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
88 lines (71 loc) · 3.11 KB
/
README
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
This program takes a data file and converts it into a LaTeX tabular with nice
formatting. The data is loaded using numpy's genfromtxt with no special
configuration whatsoever. This is currently not configurable. Also, right now
only numerical values are supported. All values will be formatted as floating
point numbers (example: 1.1010). Errors are supported and will be formatted
using the \pm macro. This script will generate a full tabular environment
including a column header. The booktabs package is required for the \toprule,
\midrule and \bottomrule commands. Remove those if you do not want to load
booktabs. The script depends on numpy and uses python3 syntax.
Usage: csv2tex [OPTIONS]
-i file, --in=file
read data from file
default: in.dat
-o file, --out=file
write table to file
default: write to stdout
-c file, --conf=file
read configuration from file
default: csv2tex.conf
Config File Format:
The configuration file is split into sections. One section defines one column of
the output LaTeX tabular. A section is started with a title in square brackets:
[Column1]
The title can be followed by configuration items. Each item starts on a new line
and is separated from its value by either a colon (:) or an equals sign (=).
Strings must not be quoted. For strings, LaTeX syntax is supported.
title: <string>
Set <string> as the column header for this column. This is optional. By
default, the colum header is the section title.
column: <integer>
Data for this section is read from this column of the data file. This
option must be specified, there is no default value.
error: <integer>
Errors for this section are read from this column of the data file.
Optional. Each entry is then printed as $%1.<p>f \pm %1.<p>f$ where <p>
is either the specified precision (Decimal places, use negative values
to round to tens, hundreds, etc. Equal for the whole section) or the
most significant digit of the error (on a line-to-line basis) if no
precisions is specified.
precision: <integer>
Number of decimal places to round each value to. Can be negative to
round to tens, hundreds, etc. Optional. If no error is available for
this section, this defaults to 0 (rounding to nearest integer). If
errors are available and precision is unspecified, round to most
significant digit of the error.
scale: <float>
Multiply each data point by this value. Optional.
error_scale: <float>
Multiply each error by this value. Optional. Defaults to scale if scale
is specified.
alignment: <string>
Alignment character to use in tabular definition. Optional. Defaults to
c. While vertical lines (|) are supported, they are highly discouraged.
Read the booktabs documentation on an explanation why.
Example configuration file:
[Diameter]
title: Diameter / nm
column: 1
alignment: r
[Polarisation]
title: Polarisation / $\degree$
column: 2
alignment: c
precision: 1
[Amplitude]
title: Amplitude / \%
column: 3
error: 4
alignment: c
scale: 1
error_scale: 1