Fadi Barbàra's Brand

How to make a LaTeX document spotless

Motivation and Definitions

I recently wrote a big document (150+ pages) and had to give it to higher-ups. My document was not in the best shape possible (from a stylistic point of view) and I realized the my errors lies in the tools I used.

The goal of this post is clarify (to me principally) which steps should be done not to have this problem again

What do I mean by spotless? By spotless I mean the concurrent validity of the following properties:

  1. One typo per ten pages (see below)
  2. A consistent bibliography
  3. No bad references (represented by a [??] or [?] in the PDF)

Tools

Process

The process is simple:

  1. git pull
  2. Write
  3. Check
  4. git commit/push

The only thing to understand for the sake of this post is: what can I check efficiently, i.e. fast and with no obvious errors

Checking

Checking has two components: typos and bibliography (assuming your content is straight)

Typos

Know your way around a spell checker. Use it often, use it good. You may use spell, integrated from vim 7 and in nvim, or you may use aspell.

If you use spell you can do :set (no)spell and use it. It handles

I found this solution good enough for 99% of the cases.

On the other hand, if you use vim you can call aspell within vim itself. This does not work in nvim, but you can exit the file and run it after. I use this solution too, at the end or near the and of the completion of my document.

However, no traditional spell checker will catch errors like “red” instead of “read”, or “shy” instead of “why”. In a 150+ pages document you will have similar errors. That is why I aim for one error per 10 pages: I need to make room for these kinds of errors.

Bibliography

That is a pain point. After nearly a decade of using latex for scientific writings, I still have not found a good AND automatic way to handle citations. For example: Zotero does the automatic part good. But not the “good” part. On the other hand, doing things by hand is good, but tedious.

I am painfully building a bibliography.bib I intend to use in all my writings, something I update constantly. The only way to check if it has no error, is by bibtexing the main.tex file.

Conclusions

The main purpose of this post is to clarify how things should be properly done to me. My goal is to have spotless TeX files.

Of course, I have not found a 100% reliable solution, especially for those errors where there is no obvious typo. A “context-based spell checker” would be better, but do not know of one capable of running locally. If you know about it, I am very happy to learn about it.

Also, if you have better ideas, I am happy to hear/read them, so please tell me!


I hope you liked this post. If you have comments, the best way to express them is by going on Telegram and comment on the dedicated post on the group.

Alternatively you can write me in private on Telegram or an email at me at fadibarbara .it .