scieee AI-readable full text Open interactive document viewer

Best Practice Award: Pipeline for automated LaTeX plot generation using GitLab CI/CD

Thönes, Jacob Peter

Abstract

LATEX is increasingly being used as the tool of choice for journal articles or academic theses, posters, conference presentations, and many other applications [1]. The popularity of LATEX in academia is based on its elegant ability to use predefined templates, its robustness in implementing complex notation and mathematics, and its capacity to neatly format any type of content, including sections, text, and figures [2]. One of the most powerful packages for creating high-quality vector graphics within LATEX is TikZ. However, despite its powerful capabilities, creating plots using TikZ often remains a time-consuming task due to its extensive syntax and numerous configuration possibilities. This white paper introduces a GitLab pipeline that uses continuous integration (CI) and continuous deployment (CD) to streamline the generation of vector graphics and LATEX code from CSV data and JSON configuration files. By automating this process, this approach reduces the overhead associated with manual TikZ plot creation, while improving reproducibility and enhancing collaborative scientific workflows.

Full text

Forschungsdatenmanagement Best Practice Award: Pipeline for automated L A T EX plot generation using GitLab CI/CD Jacob P. Th¨ones Institute of Communications Engineering, University of Rostock, Germany [email protected] Abstract L A T EX is increasingly being used as the tool of choice for journal articles or academic theses, posters, conference presentations, and many other applications [1]. The popularity of L A T EX in academia is based on its elegant ability to use predefined templates, its robustness in implementing complex notation and mathematics, and its capacity to neatly format any type of content, including sections, text, and figures [2]. One of the most powerful packages for creating high-quality vector graphics within L A T EX is TikZ. However, despite its powerful capabilities, creating plots using TikZ often remains a time-consuming task due to its extensive syntax and numerous configuration possibilities. This white paper introduces a GitLab pipeline that uses continuous integration (CI) and continuous deployment (CD) to streamline the generation of vector graphics and L A T EX code from CSV data and JSON configuration files. By automating this process, this approach reduces the overhead associated with manual TikZ plot creation, while improving reproducibility and enhancing collaborative scientific workflows. 1 Introduction At best, graphics are vector graphics to ensure the highest possible quality. They can, for example, be created in L A T EX using packages such as TikZ [3]. However, creating plots can be very time-consuming. This is due to the many options and extensive syntax required to create a felicitous TikZ plot. 1 2 Problem statement L A T EX , particularly the TikZ package, offers a high level of control over graphical content creation. Users can define custom styles, manage precise positioning, implement complex layering, and utilize an extensive library of shapes, lines, and patterns. This flexibility makes it very powerful for producing high-quality technical diagrams, mathematical illustrations, and data visualizations. However, these benefits come with notable challenges. Mastering TikZ requires knowledge of its declarative syntax, which can be unintuitive, especially for users without a programming background. Furthermore, the creation of complex graphics often demands significant time and effort, particularly when debugging layout issues or fine-tuning visual elements. Performance can also become a concern for large or intricate diagrams, as compilation times may increase substantially. In summary, while TikZ provides unmatched control and quality for graphical content within L A T EX documents, it also introduces the following key challenges. •Syntax Complexity: TikZ requires precise command structure and often involves nesting of graphical commands, which can be frustrating for new users. •Time Consumption: Creating plots manually involves repetitive tasks such as data import, axis configuration, and styling, which can be particularly tedious for multi-plot documents. •Reproducibility Concerns: When plots are generated manually, tracking changes and maintaining consistency becomes increasingly difficult in collaborative environments (this argument does not necessarily apply to environments like Overleaf). •Integration Overhead: Aligning plots visually and thematically with the rest of the L A T EX document often demands fine-tuning of TikZ parameters, which further increases development time. These limitations motivate and underscore the advantage of an efficient and standardized workflow for generating and integrating plots into L A T EX documents. 3 Problem solution A GitLab repository was created that addresses the mentioned challenges by introducing a fully automated pipeline for the generation of L A T EX code and creation of vector graphics files by leveraging GitLab’s CI. To start the processing pipeline, the following files are required or optional. 2 •CSV data input: Users provide raw data in comma-separated values (CSV) format. This is a commonly used and easily generated format compatible with most measurement and data analysis tools. •JSON layout: A configuration file in JSON format defines the border, font size, axis labels, width, and height of the plot. This modular approach enables high customizability while keeping the configuration easy to understand. •JSON config: A configuration file in JSON format that defines plot type, data path, save path, and save name of the plot. It is necessary to fork the repository to your own GitLab account. An advantage is, that you can turn the visibility settings to private. Is is also possible to fork the repository to an organization, which enables parallel and collaborative work, e.g. on different branches. The provided, forward, easy-tolearn data processing pipeline can also support and motivate the introduction to L A T EX. 3.1 Example Imagine a work group has finished a study that documents the sales of Apples, Bananas, and Cherries, and stored the results in a CSV file. Category Sales Apples 345 Bananas 234 Cherries 512 Table 1: bar data.csv The CSV table is stored in the data directory, which is a required step. In general, for the current state of the provided pipeline, the data must be pushed to the repository for the plot generation. This could be a security concern, but the repository can be set to private. Furthermore, the data will be present in the corresponding commit, which is an advantage for reproducibility. The group decided to use a bar plot to visualize the sales numbers. Therefore, they optimize the config JSON file plot type to BarPlot. To access the data, the data path must also be adjusted. The variable save name will be the name of the output of the pipeline, see Listing 1. An optional configuration can be set in the layout JSON file. For publishing the results, the work group decided to set x,y labels, and because of the layout of a two-column paper, they want to have a figure width of 5 cm and a figure height of 3 cm, see Listing 2. To use the pipeline, the changes of the repository must be added, committed, and pushed to the repository. After pushing the changes to GitLab, the pipeline is triggered and runs different pipeline stages to create the plot and the L A T EX code inside the Artefacts directory. The output PDF figure is visualized in Fig. 1. 3 1{ 2"plot_type":"BarPlot", 3"data_path":"data/bar_data.csv", 4"save_path":"output/", 5"save_name":"bar_plot" 6} Listing 1: config.json 1{ 2"border":"10pt", 3"font_size":"footnotesize", 4"ylabel":"Sales", 5"xlabel":"Fruits", 6"width":"5cm", 7"height":"3cm" 8} Listing 2: layout.json Apples Bananas Cherries 300 400 500 Fruits Sales Figure 1: bar plot.pdf For recreating this plot, these three types of files can but must not be modified. When committing changes to the GitLab repository, the pipeline is triggered, processes the input data again, applies the configurations or changes adapted to the configuration, layout, or CSV files, and generates the new cor4 responding TikZ code and PDF graphics. A new output artifact will include the updated PDF figure, ready to be included in any L A T EX document, and optionally, the raw TikZ code, allowing for further manual customization if desired. In total, three different examples are provided in the repository [4]. 3.2 Details The system is designed for adaptability, allowing users to define boundary layout styles with minimal effort. Moreover, it supports a range of plot types, including line plots, scatter plots, bar charts, and more advanced visualizations. This automated workflow offers numerous advantages that significantly enhance the usability and efficiency of L A T EX-based plotting: 1. Accelerated Development: Automating the data-to-plot workflow significantly reduces the time required to generate high-quality visualizations. 2. Consistent Styling: Standardized templates and JSON-based configurations ensure uniform visual appearance across documents, publications, and presentation slides. 3. Integrated Version Control: Full integration with GitLab enables seamless tracking of changes to data and configuration files, which is ideal for collaborative projects involving multiple contributors. 4. Guaranteed Reproducibility: Automated pipelines ensure that figures can be reliably regenerated at any time, meeting the reproducibility standards of modern scientific research. Before introducing the GitLab CI pipeline, a self-implemented Python package must be mentioned. The self-implemented plotLaTeX package has been developed and extended during the past years, and already provides the possibility to create Barplots, Boxplots, Histograms, Lineplots, and Stemplots [5]. The idea behind this package was to export data directly from Python to L A T EX. This package was adapted to the LaTeX-plot-CI package, working in the background. The pipeline is built inside GitLab’s CI/CD functionality and Docker containers to ensure reproducibility. The CI/CD pipeline stages are: •Environmental setup: Ensures the JSON configuration and CSV files are syntactically correct. •Data processing: Reads and processes the CSV data based on the specifications. •Plot generation: Creates the plot using the defined style and settings. •TikZ code export: Converts the plot into TikZ-compatible code. •PDF compilation: Compiles the L A T EX file to generate a final vectorbased graphic. 5 •Artifact storage: Saves the resulting PDFs and code snippets for download. The pipeline monitoring directly extracted from GitLab is visualized in Fig. 2. Figure 2: GitLab CI/CD pipeline. Users interact with the system primarily by pushing updates to the Git repository. The automation behind the scenes handles everything else. Researchers publishing journal articles or theses benefit from the reproducibility and visual consistency provided by this pipeline. Multidisciplinary research teams can utilize GitLab’s collaborative features to manage and share plot configurations and visual styles, streamlining contributions from various stakeholders. 4 Limitations and Future Work While the current workflow offers a solid foundation, there are several areas where improvements could enhance both functionality and usability. Currently, the supported plot types are limited. Extensions to more advanced visualizations, layout parameter selection, and 3D plots would be beneficial. Extending support to include these and other specialized formats would broaden the tool’s applicability to several areas. Another area for improvement is the user configuration process, which currently relies on JSON files. For users without a programming background, this can present a barrier to using this workflow. Introducing a graphical user interface accessible through a locally hosted web server could lower this barrier and make the tool more approachable for a wider audience. In terms of data protection and security, it would be useful to change the process of pushing a CSV to the repository to a different data handling approach. Furthermore, handling different data types would also be beneficial for using this GitLab pipeline. Integration with external platforms also holds significant potential. Enabling compatibility with systems like GitHub Actions or GitLab Pages could facilitate automated workflows and make the tool more accessible in collaborative environments. Furthermore, adding a preview feature that reflects plot adjustments instantly would significantly enhance the user experience. 6 5 Conclusion The time consumption and increasing demand for high-quality, reproducible, and customizable visualizations in scientific documents have highlighted the limitations of manual Tikz plot creation in L A T EX. By leveraging the provided GitLab’s CI/CD pipelines, the presented system automates the process of converting CSV data into vector graphics, significantly improving efficiency, consistency, and collaboration. The use of standardized JSON configurations and version-controlled workflows ensures that plots remain adaptable and traceable throughout the lifecycle of a project. This approach empowers researchers and professionals to produce publication-ready figures with minimal effort, allowing them to concentrate on their core work while maintaining full control over the aesthetic and structural qualities of their documents. By simply pushing data in CSV format and configuring JSON files to specify plot types and layout settings to the provided GitLab repository, users can trigger an automated CI/CD pipeline that processes the data, outputs the corresponding L A T EX code, and generates the PDF graphic. The resulting PDF file can be included in any L A T EX document, ensuring a consistent appearance. Otherwise, the L A T EX code for the creation of this TikZ figure can be pasted into the final document and modified for more specific needs. The system is designed to prioritize adaptability and ease of use, allowing users to customize boundary layouts and other settings to fulfill a variety of use cases. Integration with GitLab’s version control capabilities further enhances the workflow by providing a comprehensive commit history, allowing users to track changes and maintain a consistent plotting style across an entire project. By leveraging the power of GitLab’s CI/CD pipelines, the repository establishes an automated, reproducible, and collaborative environment. It effectively simplifies the process from data acquisition to result generation, ensuring that users can focus on their work without being held down by the technical complexities of plotting in L A T EX. References [1] A. Q. Philips, “Latex: A brief introduction,” 2016. [2] P. Jansson, “Scientific writing with latex,” 2016. [3] T. Tantau, “Graph drawing in tikz,” in International Symposium on Graph Drawing, pp. 517–528, Springer, 2012. [4] J. P. Th¨ones, “LaTeX-plot-CI,” in https://gitlab.uni-rostock.de/jt292/latexplot-ci, 2025. [5] J. P. Th¨ones, “plotLaTeX,” in https://github.com/JacobTh98/plotLaTeX, 2025. 7