When you make assertions in a channel like the Ubuntu Podcast’s Telegram chatter channel they sometimes have to be backed up. Recently I made reference to how you could utilize Markdown within a LaTeX document. I should take a moment to discuss a way to use LuaLaTeX to make your Markdown documents look nice. We’re going to build a “Minimum Working Example” to illustrate things.

First, I will refer to a package on the Comprehensive TeX Archive Network simply named markdown. That handles processing Markdown input. In its documentation you find that you can actually input a separate Markdown-formatted file into the macros provided which will convert them into appropriate LaTeX code and add that programmatically into your document. LaTeX is a Turing-complete programming language after all.

Using the basic default article class and bearing in mind that I am based in the United States of America, we can have something like this:

\documentclass[12pt,letter]{article}
\usepackage{hyperref}
\usepackage{xurl}
\usepackage{markdown}
\usepackage{fontspec}
\setmainfont{Liberation Serif}

\begin{document}
\markdownInput{file.md}
\end{document}


Taking that example line by line we mostly have a preamble and a very short document. First we declare the document’s class as “article” and pass the global options of wanting 12 point type and since I am in the USA I want to use Letter paper. Next we load the hypertext support package hyperref. We then load the smaller support package xurl which allows for URLs to break at any alphanumeric character in text. Our main player markdown then gets loaded. Since we’re using LuaLaTex to compile the document we then load the fontspec package to allow using any OpenType fonts. Liberation Serif is a font that ships in the basic install for any Ubuntu flavour so we’ll choose that. While we could have done something obscure like use Public Sans we’ll stick to basics today.

You can save that file locally as mwe.tex. Now, we need our Markdown file. We’ll keep it simple with this:

We have a **great** help system at [AskUbuntu](https://askubuntu.com/).


Save that single line as file.md. You’ll want to have both files in the same directory. From there you can then appropriately invoke LuaLaTeX with shell escape enabled and you’ll get a file with the line typeset and the link showing as a footnote. The link in the footnote will be clickable.

This is a very minimal example. You can modify what is essentially a driver file for LaTeX to process through your Markdown creations to make them look nice. Pandoc does something similar but this allows a bit closer ability to fiddle with settings. This can be included in automation chains to make pretty print output fairly readily with contemporary web stylings.

For further introduction to LaTeX, the guide that really helped me is “A short introduction to LaTeX2e” mainted by Tobias Oetiker which you can find in your appropriate language on the Comprehensive TeX Archive Network.

Good Luck & Good Hunting.