-
Notifications
You must be signed in to change notification settings - Fork 0
Convert your data files to LaTeX tabular
License
mithodin/csv2tex
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
Convert your data files to LaTeX tabular
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published