latex_table 1.0.1 copy "latex_table: ^1.0.1" to clipboard
latex_table: ^1.0.1 copied to clipboard

A Dart library to parse an object structure to LaTeX source code for a simple table.

A Dart library to parse an object structure to LaTeX source code for a simple table.

The object structure can be easily generated programmatically.

License #

This work is provided under the terms of the MIT license. Please take a look at the LICENSE file for the full text.

Features #

  • 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.

Usage #

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.

Contact #

If you have any questions just drop a message at mail@centaurus22.de.

0
likes
160
points
14
downloads

Documentation

API reference

Publisher

verified publishercentaurus22.de

Weekly Downloads

A Dart library to parse an object structure to LaTeX source code for a simple table.

Repository (GitHub)
View/report issues

Topics

#latex #parsing #table #library #scientific

Funding

Consider supporting this project:

www.paypal.com

License

MIT (license)

More

Packages that depend on latex_table