A file with a latex extension (.tex) is a text-based markup language file created with the typesetting system known as LaTeX which can be used to define type settings for publications, letters, books, and other similar cataloging in various fields. Specifically, for academic publishing, LaTeX (pronounced “LAY-tech”) is a staple.

But what is LaTeX? “…LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standard for the communication and publication of scientific documents…” – Georgia State University Research Guide.

What this means is that you can use LaTeX to create documents with text and formatting that would be difficult in a standard word processor. LaTeX is founded on the belief that it is better to leave document design to document designers, and to let authors focus on authoring documents.

Planning Analytics

But what about publishing documents using IBM Planning Analytics data? I thought it might be fun to set up a parameter driven TurboIntegrator process to format cube data into LaTeX format and as it turns out, it was a pretty simple endeavor.

For this exercise I started with corporate Capital Assets data stored in a cube named “Capital”:

The first step was to create a new TurboIntegrator process an add parameters to allow the selection of an organization, a year, version, and asset type:

Next, I added some simple scripting (in the Prolog section of the process) to perform some housekeeping. For example, I don’t want any “quote characters” showing up in my output given that they may interfere with LaTeX syntax, so I set the DatasourceASCIIQuoteCharacter to an “empty string” so NO quote character would be used:

The ASCIIOUTPUT function is easy enough to use to format and write the selected output in the format I want o a couple of “static” lines are written first to set the document class (article) and then start a table:

There are a number of LaTeX document classes, but articles are typically used for scientific journals, presentations, short reports, and program documentation, so that’s what I chose to use. The next 3 lines build the document caption from the process parameters and then set table column alignments:

Yep, I cheated! I know that there are going to be 7 columns (or measures) so I hard-coded the number of alignments (it would be a trivial task to make that more dynamic) and then I wrote the following loop to write the 7 individual column headings (using element names in the “Capital” dimension):

Since the headings in my output document are set now, I added another loop with some CELLGET function calls to get values from the Capital cube and populate my document table:

Once the data values are written, again I add some simple static statements to close the table and end the document:

TexMaker

When I run the process, it creates a LaTeX formatted text file. To check it, you can open it up using an application like MS Windows notepad, but TexMaker is a free, cross-platform open-source LaTeX editor with an integrated PDF viewer so it’s a better choice. TexMaker supports Linux, macOS and Windows systems and integrates many tools needed to create and edit documents with LaTeX formatting. Below is the generated output file opened in TexMaker:

Converting to Word

A LaTeX formatted document can be converted easily to many different formats and still maintain its specific internal formatting. In my world, a MS Windows world, I most often deliver documents in MS Word format so it would be helpful to automatically convert the output file to a Word document as a final step in the processing. Pandoc is a free and open-source document converter, widely used as a writing tool and as a basis for publishing workflows and we can leverage it here.

In the Epilog section of the process, I added the ExecuteCommand function to run the Pandoc utility to create an MS Word document from our LaTex formatted text file:

Now, after the process completes, we have both the raw LaTeX formatted document as well as a professionally looking MS Word document:

Conclusion

This is a simple example but in concept could be used as the basis for creating a more dynamic and flexible solution. The point is to become aware of the value of using LaTeX formatting to present professionally looking documents. LaTeX tables merely scratch the surface of what is possible with LaTeX. To learn more about the benefits of LaTeX go here.