---
title: FlexiTeX (Bachelor thesis)
subtitle: LaTeX Collaboration Without Giving Up Personal Project Structure
showOnCv: false
type: University
abstract: Command-line tool for restructuring and splitting large LaTeX projects. Intended for collaborative writing, sharing, or reorganizing complex LaTeX documents.

images:
  - src: cover
    filetype: .webp
  - src: results/sample-tree
    filetype: .webp
    subtitle: Sample tree model extracted using FlexiTeX representing a simple LaTeX document containing 2 chapters and 3 sections.
  - src: results/distribution-similarity
    filetype: .webp
    subtitle: Distribution of similarity scores between original projects and 20-step transformation pipeline, higher is better. Red indicates that the output only contains preamble indicating that processing failed in preamble.
  - src: results/median-similarity
    filetype: .webp
    subtitle: Median similarity score per transformation chain length. Slight decline with longer chains suggests minor cumulative effects.
  - src: results/test-config-20
    filetype: .webp
    subtitle: Similarity score vs input file line count for 20-step transformation chains

pdfFiles:
  - kind: thesis
    file: thesis
  - kind: slides
    file: slides

quickLinks:
  - kind: demo
    url: https://github.com/wtb04/FlexiTeX-Example
  - kind: github
    url: https://github.com/wtb04/flexitex
  - kind: open-access
    url: https://purl.utwente.nl/essays/107262
    repositoryName: UTwente

keywords:
  - LaTeX
  - document transformation
  - collaborative editing
  - abstract syntax tree
  - configuration-based layout

supervisors:
  - dr. Vadim Zaytsev
  - Nhat Bui
  
tags:
  - LaTeX
  - Tooling
  - Automation
  - Python
---

LaTeX gives users a lot of freedom in how they structure their projects, but this becomes a problem when working with others. Popular collaboration tools assume that all users follow the same project structure, which does not reflect how people actually prefer to organize their work. This thesis introduces FlexiTeX, a system that allows each user to keep their own project structure while still collaborating on the same content. The system works by flattening a LaTeX project, parsing it into an abstract tree that captures the logical structure. It then applies transformation rules to rebuild the project structure based on a configuration file. The transformation is designed to be reversible, idempotent and preserve the ability to compile the document. A proof of concept shows how this approach can be used in a collaborative setup where each user works in a personal branch and changes are synced through a shared internal version. An evaluation on real-world projects shows that the system preserves content in most cases, although some limitations remain due to parser behavior. Overall, FlexiTeX makes it possible to collaborate on LaTeX projects without forcing everyone to adopt the same structure.