This is the first post in a series about blogging with LaTeX using TeX4ht. I originally set it up as a showcase of TeX4ht’s features for the TUG 2021 conference. Unfortunately, I didn’t get to present it in the end—I ran out of time during my allocated slot, and I also didn’t manage to finish all the posts I had planned by the deadline. Fast forward to February 2025, and I thought, why not finally complete this series? Better late than never, right?

Contents

1 Why would you do such a crazy thing?

I really enjoy writing my documents in LaTeX, and I want to offer a solid alternative to other markup languages like Markdown or HTML. The beauty of LaTeX lies in its incredible flexibility—it lets you structure your documents exactly how you want, without being tied down by the limitations of more rigid systems. Whether you’re writing a quick report or a full-blown book, LaTeX gives you the tools to make it look polished and professional.

Of course, LaTeX isn’t for everyone, and that’s totally fine! Some people prefer the instant visual feedback you get with WYSIWYG editors like Word or Google Docs, and there’s absolutely nothing wrong with that. Others might like the simplicity of plain text but find LaTeX’s syntax too complicated or even a bit ugly—and hey, that’s fair too. Markdown and other lightweight markup languages are great alternatives, and there’s no shame in using them.

Let’s be honest, LaTeX can be pretty complex, and a lot of people won’t even scratch the surface of what it can do. And that’s okay—not everyone needs that level of control or customization. Personally, though, I’ve never been a fan of Word or Markdown. Word feels too restrictive for my taste, and Markdown, while simple, just doesn’t give me the power I need. That’s why I’ve turned to LaTeX as my go-to tool. It’s my way of creating an alternative for myself and others who feel the same way—people who want more flexibility and precision without being tied down by the limitations of other tools.

One of the coolest things about LaTeX is how customizable it is. You can create your own environments and commands, which is a game-changer when it comes to organizing your content. This is super handy for big projects like theses or books, where you need everything to be consistent, but it’s also great for smaller stuff like articles or essays. Plus, once you’ve set up your custom commands, you can reuse them across different documents, saving you a ton of time.

Another reason I love LaTeX is the sheer number of packages available. These packages let you do pretty much anything you can think of. Need to draw diagrams? Check out TikZ or PGFPlots. Writing a math-heavy paper? Amsmath has got your back. Managing references? BibLaTeX makes it a breeze. The possibilities are endless, and it’s one of the reasons LaTeX is so powerful.

Now, some people say that converting LaTeX to HTML is a pain, but honestly, it’s not that hard if you know what you’re doing. I’m the author of TeX4ht, a tool that makes this process a lot smoother. It’s a great way to make your content more accessible online without losing the precision and beauty of LaTeX.

2 Overview of the setup

In the upcoming posts, we’ll dive into how TeX4ht works and how to configure it to generate HTML files that play nicely with static site generators. After that, I’ll share how I used Jekyll to build this series of posts. Finally, we’ll wrap things up by exploring how to use GitHub Actions to automatically rebuild your website whenever you update your LaTeX documents.

Here is an outline of the steps we’ll cover:

  1. Use TeX4ht to produce files suitable for static site generators.
  2. Use a static site generator, such as Jekyll or Hugo, to generate a website.
  3. Use GitHub Actions to automatically compile LaTeX files pushed to the repository and rebuild the website.

If you’re curious to check out the source code for this blog, you can find it at this link: https://github.com/michal-h21/testblog.

Notable files and directories include: