latex-svg for blogs in .tex

Posted on 2020-05-10 by Oleg Grenrus

I’m a weird person. I like writing \text{\LaTeX} . With all of its downsides, it’s quite flexible.

This blog post is written in tex file, not markdown. With the help of latex-svg, the included math and some other environments work. We are still constrained by what pandoc supports, but there is a lot.

#Examples

Let us write few examples of what we can do.

#Math

Formulas

\sin^2 \theta + \cos^2 \theta = 1

or

\begin{aligned} \sin&39; &= \cos \\ \cos&39; &= - \sin\end{aligned}

work nicely.

#tikzcd

As pandoc can preserve raw latex blocks and latex-svg renders them, you can draw tikzcd diagrams:

\begin{tikzcd} A \arrow[r,"f"] & B \end{tikzcd}

#Tables

Writing tables in markdown is a pain. It is painful in \text{\LaTeX} also but less.

foo bar quu
foo1 2345678 quu9
foo123 456 quu789

#Code snippets

pandoc recognizes code environment. So we get code highlighting!

fact :: Integer -> Integer
fact n = product [2 .. n]

#Rendering as PDF

The benefit of writing posts in \text{\LaTeX} is that you can convert to PDF. You can also start with markdown, and use pandoc to convert it to tex document, and that is what more reasonable people do.

image


Site proudly generated by Hakyll