scieee Science in your language
[en] (orig)

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

Author: Thönes, Jacob Peter
Publisher: Zenodo
DOI: 10.5281/zenodo.17276990
Source: https://zenodo.org/records/17276990/files/Forschungsdatenmanagement_Best_Practice_Award__Pipeline_for_automated_LaTeX.pdf
Fo schungsda enmanagemen Bes P ac ice
Awa d: Pipeline o au oma ed L
A
T
EX plo
gene a ion using Gi Lab CI/CD
Jacob P. Th¨ones
Ins i u e o Communica ions Enginee ing, Uni e si y o Ros ock, Ge many
jacob. hoenes@uni- os ock.de
Abs ac
L
A
T
EX is inc easingly being used as he ool o choice o jou nal a icles
o academic heses, pos e s, con e ence p esen a ions, and many o he
applica ions [1]. The popula i y o L
A
T
EX in academia is based on i s
elegan abili y o use p ede ined empla es, i s obus ness in implemen ing
complex no a ion and ma hema ics, and i s capaci y o nea ly o ma any
ype o con en , including sec ions, ex , and igu es [2]. One o he mos
powe ul packages o c ea ing high-quali y ec o g aphics wi hin L
A
T
EX
is TikZ. Howe e , despi e i s powe ul capabili ies, c ea ing plo s using
TikZ o en emains a ime-consuming ask due o i s ex ensi e syn ax
and nume ous con igu a ion possibili ies.
This whi e pape in oduces a Gi Lab pipeline ha uses con inuous
in eg a ion (CI) and con inuous deploymen (CD) o s eamline he gen-
e a ion o ec o g aphics and L
A
T
EX code om CSV da a and JSON
con igu a ion iles. By au oma ing his p ocess, his app oach educes
he o e head associa ed wi h manual TikZ plo c ea ion, while imp o ing
ep oducibili y and enhancing collabo a i e scien i ic wo k lows.
1 In oduc ion
A bes , g aphics a e ec o g aphics o ensu e he highes possible quali y.
They can, o example, be c ea ed in L
A
T
EX using packages such as TikZ [3].
Howe e , c ea ing plo s can be e y ime-consuming. This is due o he many
op ions and ex ensi e syn ax equi ed o c ea e a elici ous TikZ plo .
1
2 P oblem s a emen
L
A
T
EX , pa icula ly he TikZ package, o e s a high le el o con ol o e g aphi-
cal con en c ea ion. Use s can de ine cus om s yles, manage p ecise posi ioning,
implemen complex laye ing, and u ilize an ex ensi e lib a y o shapes, lines,
and pa e ns. This lexibili y makes i e y powe ul o p oducing high-quali y
echnical diag ams, ma hema ical illus a ions, and da a isualiza ions.
Howe e , hese bene i s come wi h no able challenges. Mas e ing TikZ e-
qui es knowledge o i s decla a i e syn ax, which can be unin ui i e, especially
o use s wi hou a p og amming backg ound. Fu he mo e, he c ea ion o
complex g aphics o en demands signi ican ime and e o , pa icula ly when
debugging layou issues o ine- uning isual elemen s. Pe o mance can also
become a conce n o la ge o in ica e diag ams, as compila ion imes may
inc ease subs an ially.
In summa y, while TikZ p o ides unma ched con ol and quali y o g aph-
ical con en wi hin L
A
T
EX documen s, i also in oduces he ollowing key chal-
lenges.
•Syn ax Complexi y: TikZ equi es p ecise command s uc u e and o -
en in ol es nes ing o g aphical commands, which can be us a ing o
new use s.
•Time Consump ion: C ea ing plo s manually in ol es epe i i e asks
such as da a impo , axis con igu a ion, and s yling, which can be pa ic-
ula ly edious o mul i-plo documen s.
•Rep oducibili y Conce ns: When plo s a e gene a ed manually, ack-
ing changes and main aining consis ency becomes inc easingly di icul in
collabo a i e en i onmen s ( his a gumen does no necessa ily apply o
en i onmen s like O e lea ).
•In eg a ion O e head: Aligning plo s isually and hema ically wi h
he es o he L
A
T
EX documen o en demands ine- uning o TikZ pa-
ame e s, which u he inc eases de elopmen ime.
These limi a ions mo i a e and unde sco e he ad an age o an e icien and
s anda dized wo k low o gene a ing and in eg a ing plo s in o L
A
T
EX docu-
men s.
3 P oblem solu ion
A Gi Lab eposi o y was c ea ed ha add esses he men ioned challenges by
in oducing a ully au oma ed pipeline o he gene a ion o L
A
T
EX code and
c ea ion o ec o g aphics iles by le e aging Gi Lab’s CI. To s a he p ocess-
ing pipeline, he ollowing iles a e equi ed o op ional.
2
•CSV da a inpu : Use s p o ide aw da a in comma-sepa a ed alues
(CSV) o ma . This is a commonly used and easily gene a ed o ma
compa ible wi h mos measu emen and da a analysis ools.
•JSON layou : A con igu a ion ile in JSON o ma de ines he bo de ,
on size, axis labels, wid h, and heigh o he plo . This modula ap-
p oach enables high cus omizabili y while keeping he con igu a ion easy
o unde s and.
•JSON con ig: A con igu a ion ile in JSON o ma ha de ines plo ype,
da a pa h, sa e pa h, and sa e name o he plo .
I is necessa y o o k he eposi o y o you own Gi Lab accoun . An
ad an age is, ha you can u n he isibili y se ings o p i a e. Is is also
possible o o k he eposi o y o an o ganiza ion, which enables pa allel and
collabo a i e wo k, e.g. on di e en b anches. The p o ided, o wa d, easy- o-
lea n da a p ocessing pipeline can also suppo and mo i a e he in oduc ion
o L
A
T
EX.
3.1 Example
Imagine a wo k g oup has inished a s udy ha documen s he sales o Apples,
Bananas, and Che ies, and s o ed he esul s in a CSV ile.
Ca ego y Sales
Apples 345
Bananas 234
Che ies 512
Table 1: ba da a.cs
The CSV able is s o ed in he da a di ec o y, which is a equi ed s ep. In
gene al, o he cu en s a e o he p o ided pipeline, he da a mus be pushed
o he eposi o y o he plo gene a ion. This could be a secu i y conce n, bu
he eposi o y can be se o p i a e. Fu he mo e, he da a will be p esen in
he co esponding commi , which is an ad an age o ep oducibili y.
The g oup decided o use a ba plo o isualize he sales numbe s. The e o e,
hey op imize he con ig JSON ile plo ype o Ba Plo . To access he da a,
he da a pa h mus also be adjus ed. The a iable sa e name will be he name
o he ou pu o he pipeline, see Lis ing 1.
An op ional con igu a ion can be se in he layou JSON ile. Fo publishing
he esul s, he wo k g oup decided o se x,y labels, and because o he layou
o a wo-column pape , hey wan o ha e a igu e wid h o 5 cm and a igu e
heigh o 3 cm, see Lis ing 2. To use he pipeline, he changes o he eposi o y
mus be added, commi ed, and pushed o he eposi o y. A e pushing he
changes o Gi Lab, he pipeline is igge ed and uns di e en pipeline s ages o
c ea e he plo and he L
A
T
EX code inside he A e ac s di ec o y. The ou pu
PDF igu e is isualized in Fig. 1.
3
1{
2"plo _ ype":"Ba Plo ",
3"da a_pa h":"da a/ba _da a.cs ",
4"sa e_pa h":"ou pu /",
5"sa e_name":"ba _plo "
6}
Lis ing 1: con ig.json
1{
2"bo de ":"10p ",
3" on _size":" oo no esize",
4"ylabel":"Sales",
5"xlabel":"F ui s",
6"wid h":"5cm",
7"heigh ":"3cm"
8}
Lis ing 2: layou .json
Apples Bananas Che ies
300
400
500
F ui s
Sales
Figu e 1: ba plo .pd
Fo ec ea ing his plo , hese h ee ypes o iles can bu mus no be mod-
i ied. When commi ing changes o he Gi Lab eposi o y, he pipeline is ig-
ge ed, p ocesses he inpu da a again, applies he con igu a ions o changes
adap ed o he con igu a ion, layou , o CSV iles, and gene a es he new co -
4
esponding TikZ code and PDF g aphics. A new ou pu a i ac will include
he upda ed PDF igu e, eady o be included in any L
A
T
EX documen , and
op ionally, he aw TikZ code, allowing o u he manual cus omiza ion i
desi ed.
In o al, h ee di e en examples a e p o ided in he eposi o y [4].
3.2 De ails
The sys em is designed o adap abili y, allowing use s o de ine bounda y layou
s yles wi h minimal e o . Mo eo e , i suppo s a ange o plo ypes, including
line plo s, sca e plo s, ba cha s, and mo e ad anced isualiza ions.
This au oma ed wo k low o e s nume ous ad an ages ha signi ican ly en-
hance he usabili y and e iciency o L
A
T
EX-based plo ing:
1. Accele a ed De elopmen : Au oma ing he da a- o-plo wo k low sig-
ni ican ly educes he ime equi ed o gene a e high-quali y isualiza ions.
2. Consis en S yling: S anda dized empla es and JSON-based con igu-
a ions ensu e uni o m isual appea ance ac oss documen s, publica ions,
and p esen a ion slides.
3. In eg a ed Ve sion Con ol: Full in eg a ion wi h Gi Lab enables
seamless acking o changes o da a and con igu a ion iles, which is ideal
o collabo a i e p ojec s in ol ing mul iple con ibu o s.
4. Gua an eed Rep oducibili y: Au oma ed pipelines ensu e ha igu es
can be eliably egene a ed a any ime, mee ing he ep oducibili y s an-
da ds o mode n scien i ic esea ch.
Be o e in oducing he Gi Lab CI pipeline, a sel -implemen ed Py hon pack-
age mus be men ioned. The sel -implemen ed plo LaTeX package has been
de eloped and ex ended du ing he pas yea s, and al eady p o ides he pos-
sibili y o c ea e Ba plo s, Boxplo s, His og ams, Lineplo s, and S emplo s [5].
The idea behind his package was o expo da a di ec ly om Py hon o L
A
T
EX.
This package was adap ed o he LaTeX-plo -CI package, wo king in he back-
g ound. The pipeline is buil inside Gi Lab’s CI/CD unc ionali y and Docke
con aine s o ensu e ep oducibili y. The CI/CD pipeline s ages a e:
•En i onmen al se up: Ensu es he JSON con igu a ion and CSV iles
a e syn ac ically co ec .
•Da a p ocessing: Reads and p ocesses he CSV da a based on he spec-
i ica ions.
•Plo gene a ion: C ea es he plo using he de ined s yle and se ings.
•TikZ code expo : Con e s he plo in o TikZ-compa ible code.
•PDF compila ion: Compiles he L
A
T
EX ile o gene a e a inal ec o -
based g aphic.
5

•A i ac s o age: Sa es he esul ing PDFs and code snippe s o down-
load.
The pipeline moni o ing di ec ly ex ac ed om Gi Lab is isualized in
Fig. 2.
Figu e 2: Gi Lab CI/CD pipeline.
Use s in e ac wi h he sys em p ima ily by pushing upda es o he Gi
eposi o y. The au oma ion behind he scenes handles e e y hing else. Re-
sea che s publishing jou nal a icles o heses bene i om he ep oducibili y
and isual consis ency p o ided by his pipeline.
Mul idisciplina y esea ch eams can u ilize Gi Lab’s collabo a i e ea u es
o manage and sha e plo con igu a ions and isual s yles, s eamlining con i-
bu ions om a ious s akeholde s.
4 Limi a ions and Fu u e Wo k
While he cu en wo k low o e s a solid ounda ion, he e a e se e al a eas
whe e imp o emen s could enhance bo h unc ionali y and usabili y. Cu en ly,
he suppo ed plo ypes a e limi ed. Ex ensions o mo e ad anced isualiza-
ions, layou pa ame e selec ion, and 3D plo s would be bene icial. Ex ending
suppo o include hese and o he specialized o ma s would b oaden he ool’s
applicabili y o se e al a eas.
Ano he a ea o imp o emen is he use con igu a ion p ocess, which cu -
en ly elies on JSON iles. Fo use s wi hou a p og amming backg ound, his
can p esen a ba ie o using his wo k low. In oducing a g aphical use in e -
ace accessible h ough a locally hos ed web se e could lowe his ba ie and
make he ool mo e app oachable o a wide audience.
In e ms o da a p o ec ion and secu i y, i would be use ul o change he
p ocess o pushing a CSV o he eposi o y o a di e en da a handling app oach.
Fu he mo e, handling di e en da a ypes would also be bene icial o using his
Gi Lab pipeline.
In eg a ion wi h ex e nal pla o ms also holds signi ican po en ial. Enabling
compa ibili y wi h sys ems like Gi Hub Ac ions o Gi Lab Pages could acili a e
au oma ed wo k lows and make he ool mo e accessible in collabo a i e en i-
onmen s. Fu he mo e, adding a p e iew ea u e ha e lec s plo adjus men s
ins an ly would signi ican ly enhance he use expe ience.
6
5 Conclusion
The ime consump ion and inc easing demand o high-quali y, ep oducible,
and cus omizable isualiza ions in scien i ic documen s ha e highligh ed he
limi a ions o manual Tikz plo c ea ion in L
A
T
EX. By le e aging he p o-
ided Gi Lab’s CI/CD pipelines, he p esen ed sys em au oma es he p ocess
o con e ing CSV da a in o ec o g aphics, signi ican ly imp o ing e iciency,
consis ency, and collabo a ion. The use o s anda dized JSON con igu a ions
and e sion-con olled wo k lows ensu es ha plo s emain adap able and ace-
able h oughou he li ecycle o a p ojec . This app oach empowe s esea che s
and p o essionals o p oduce publica ion- eady igu es wi h minimal e o , al-
lowing hem o concen a e on hei co e wo k while main aining ull con ol
o e he aes he ic and s uc u al quali ies o hei documen s.
By simply pushing da a in CSV o ma and con igu ing JSON iles o spec-
i y plo ypes and layou se ings o he p o ided Gi Lab eposi o y, use s can
igge an au oma ed CI/CD pipeline ha p ocesses he da a, ou pu s he co -
esponding L
A
T
EX code, and gene a es he PDF g aphic. The esul ing PDF
ile can be included in any L
A
T
EX documen , ensu ing a consis en appea ance.
O he wise, he L
A
T
EX code o he c ea ion o his TikZ igu e can be pas ed
in o he inal documen and modi ied o mo e speci ic needs. The sys em is
designed o p io i ize adap abili y and ease o use, allowing use s o cus omize
bounda y layou s and o he se ings o ul ill a a ie y o use cases. In eg a-
ion wi h Gi Lab’s e sion con ol capabili ies u he enhances he wo k low by
p o iding a comp ehensi e commi his o y, allowing use s o ack changes and
main ain a consis en plo ing s yle ac oss an en i e p ojec .
By le e aging he powe o Gi Lab’s CI/CD pipelines, he eposi o y es ab-
lishes an au oma ed, ep oducible, and collabo a i e en i onmen . I e ec i ely
simpli ies he p ocess om da a acquisi ion o esul gene a ion, ensu ing ha
use s can ocus on hei wo k wi hou being held down by he echnical com-
plexi ies o plo ing in L
A
T
EX.
Re e ences
[1] A. Q. Philips, “La ex: A b ie in oduc ion,” 2016.
[2] P. Jansson, “Scien i ic w i ing wi h la ex,” 2016.
[3] T. Tan au, “G aph d awing in ikz,” in In e na ional Symposium on G aph
D awing, pp. 517–528, Sp inge , 2012.
[4] J. P. Th¨ones, “LaTeX-plo -CI,” in h ps://gi lab.uni- os ock.de/j 292/la ex-
plo -ci, 2025.
[5] J. P. Th¨ones, “plo LaTeX,” in h ps://gi hub.com/JacobTh98/plo LaTeX,
2025.
7