A Dart library to parse an object structure to LaTeX source code for a simple table.
The object structure can be easily generated programmatically.
This work is provided under the terms of the MIT license. Please take a look at the LICENSE file for the full text.
- Supports left aligned, right aligned and centered columns.
- Generates LaTeX sources for a scientific table: If the first row is rule, it
is converted to a
\toprule. If the last row is a rule it is converted to a\bottomrule. Every other rule is converted to a\midrule. - Supports a special table field for values with currency specifications in Euros.
- Returns an error if the LaTeX parser won't compile the LaTeX source,
- Returns warnings if the number of columns differs from the number of fields in a data row.
- And last but not least: Columns are nicely aligned :)
If you need any feature please contact me.
The following Dart record structure
import 'package:latex_table/latex_table.dart';
var table = Table(
columnDefinitions: [LeftAlignedColumn(), LeftAlignedColumn()],
rows: [
Rule(),
DataRow(fields: [Field(value: 'Item'), Field(value: 'Costs')]),
Rule(),
DataRow(fields: [Field(value: 'Food'), EuroField(value: '150.98')]),
DataRow(fields: [Field(value: 'Rent'), EuroField(value: '1223.23')]),
Rule(),
],
);parse(table) returns the LaTeX source code wrapped in a Success object if
the input is valid. It can be unwrapped by getting its value.
Result result = parseTable(table);
if (result is Success) {
print(result.value);
}This prints the following LaTeX source code:
\begin{tabular}{ll}
\toprule
Item & Costs \\
\midrule
Food & \EUR{150.98} \\
Rent & \EUR{1223.23} \\
\bottomrule
\end{tabular}For more advanced usage, see the example/ directory.
If you have any questions just drop a message at mail@centaurus22.de.