## Showdown KaTeX With mhchem

### mhchem support for Showdown-KaTeX

Background I’ve written about bringing user-defined KaTeX macros into Hugo a few years ago. Looking back, I realized that I only knew how to copy code at that time. Goal To replace the current code for my math editor with Showdown-KaTeX. To bring mhchem into my LaTeX + Markdown sandbox. Motivation To get the benefits of the three free (as in “freedom”) technologies. Markdown syntax is (much) simple(r than its LaTeX equivalent, especially for tables, ordered/unordered lists, etc). [Read More]

## Katex Boxed Equations

Goal To render a bordered box with multiple equations. Background My previous article about dot products contains some boxed math expressions: some are inline and some take up the whole line. For inline math, that’s simple: either $\fbox{text}$ or $\boxed{a=1}$ will do. For displayed math, these two KaTeX commands will ignore the newline command \\. Solution A simple Google search ‘“katex” AND “box”’ saved the day. It led me to this relevant Stack Overflow question, whose accepted answer suggested the use of custom CSS. [Read More]

## Improved Integration of Hugo and $\KaTeX$

Problem There’s no custom $\KaTeX$ macro in local preview since I’ve merged some recent commits from the upstream of this blog’s theme, in particular, Beautiful Hugo’s pull requests #246 and #255, which allowed self-hosting the theme’s static JS, CSS and font files. This self-hosted option is particularly useful in case of slow response from Cloudflare’s CDN. Even they do appear on the public GitLab site, the final rendered Markdown + $\TeX$ code would be succumb to syntax errors due to their absence in the preview process. [Read More]

## Custom $\KaTeX$ Macros

### More efficient math editing

Background Same as the last section in Beautiful Hugo Improvements. Goal To write math efficiently by automatically loading longer code with shorter macro code. For example, when I wrote Some Infinite Cardinality Identities, it would be ten times more quicker and efficient to type \card{C} than to write \mathop{\mathrm{card}}(C) all the time. Changes committed to my repo The current version of Beautiful Hugo is still using $\KaTeX$ v0.7, which doesn’t support macros in auto-rendering. [Read More]