LaTeX
The integrations-latex add-on writes records as a table inside a complete LaTeX document, ready to compile with
pdflatex or any other standard engine. It turns pipeline output into typeset tables for reports and papers: field names become the
column headings, every value is escaped so LaTeX's special characters cannot break the document, and the result is a plain-text .tex file
you can edit further.
Add the LaTeX Dependency
Add the add-on alongside your DataPipeline edition (see Getting Started). It brings in no third-party libraries of its own.
Maven<dependency> <groupId>com.northconcepts</groupId> <artifactId>northconcepts-datapipeline-integrations-latex</artifactId> <version>11.0.0</version> </dependency>Gradle
implementation 'com.northconcepts:northconcepts-datapipeline-integrations-latex:11.0.0'
Writing a LaTeX Table
LatexWriter is an ordinary DataWriter: construct it with a
File or a java.io.Writer and run a job into it.
The writer produces an article document with UTF-8 input encoding, a centered tabular with one left-aligned column per field, and a horizontal rule after every row:
Call setFieldNamesInFirstRow(false) to leave out the heading row. Compile the file with pdflatex product-catalog.tex to produce a PDF.
Escaping and Schema Rules
- Special characters are escaped in headings and values alike:
&,%,$,#,_,{, and}gain a backslash, while\,^, and~become\textbackslash{},\textasciicircum{}, and\textasciitilde{}. Tabs and line breaks inside a value are replaced with a space so each record stays on one table row. - The first record defines the columns. Later records may leave fields out, in which case those cells are empty, but a record that introduces a field the first one did not have fails the job with a
DataException. Give records a consistent set of fields first, for example withSelectFieldsor a transformer that adds the missing ones. - Values are written as text using each field's string form: numbers and dates in their default format, booleans as
trueandfalse, and nulls as empty cells. Format values upstream, for example withBasicFieldTransformer, when you need a particular rendering.
LaTeX Pipeline Output
In DataPipeline Foundations, LatexPipelineOutput makes LaTeX available as a pipeline output next to CSV, Excel, JSON, and the other formats.
Give it a FileSink and, optionally, setFieldNamesInFirstRow(false). Like every pipeline output it serializes to JSON and XML and takes part in the pipeline's generated Java code.
See the Write a LaTeX File example for a complete program, and the LaTeX Javadocs for the API.
