Test-driven LaTeX

Once I had a thesis to write.

That thesis turned into a large document.

Some parts of that document were highly repetitive. It would have been great to be able to reuse them as I went.

One caveat of reusing them was - if I wanted to review what the particular item looked like, I had to build the entire 100-page document just to see that small part (eg. an SVG picture, labelled appropriately).

Perhaps keeping those "building blocks" of my thesis separately for later reuse would have been more convenient.

Instead of regenerating the whole 100-page document (Overleaf free plan started timing out after I passed the 60-th page or so), maybe I could have enabled myself to check the behaviour of the part that interested me in a matter of seconds.

Testing values

Through a tip from Daniel Patru, I found a convenient way to test values in LaTeX.

Usage:

\documentclass{article}

\usepackage{assert}

\begin{document}

\def\hello#1{hello #1}

\assert{hello world}{\hello{world}}{hello world}

\assert{failing hello world}{\hello{world}}{hello cruel world}

\end{document}

Result:

When variable \def\EnforceAssertions{defined} is defined, errors in the console also appear:

The error message is clear and meaningful:

Note also that Overleaf highlights the line with the error right in the editor. I had no trouble locating the problematic line!

The resulting project can be found on Overleaf: https://www.overleaf.com/read/bqnkgbkjkpgd.

Again, thanks to Daniel Patru for sharing his idea and implementation!

The index and bibliography are usually generated independently. Thus makeindex/xindy or bibtex/biber can be called in two parallel processes.

https://tex.stackexchange.com/questions/181305/latex-compilers-with-parallel-support