Re-starting my blogging habit - putting LaTeX in Blogger posts

I vaguely remember some joy I had when I was blogging somewhat religiously. The first topic I wrote about was my journey to understand what the matrix determinant was.

When I looked back at those posts, I felt that they were silly, and that I was pretty stupid. I even felt embarrassed that I wrote those posts with so much excitement and confidence even though I knew so little. Was I so blinded by the Dunning-Kruger effect? Why would people even read what I wrote. I was not even close to being an expert on the matter. There were a lot of "better-written" textbooks out there, right?

But actually, after spending a bit more time going through my past work, I realized that my posts were not totally pointless despite the strong sense of "Geez, you're so noob". In fact, it is the naivety that makes blog posts stand out among many of the "better-written" serious publications.

It is my belief that when the writer is just a little less clueless than the reader about some topic, the resulting writing can give the reader more sense of empathy. Blogging is perfect for this kind of writing: it gives the writer and the reader the sense that they are growing together. I should not have felt embarrassed about my attempt to convey the message as well as I knew how to. I wasn't trying to explain what the determinant was in the most complete way possible. Rather, I was trying to tell my reader how I transitioned from not knowing something to knowing them. That should be more useful to the reader who is also learning, right?

So, that's how I've imagined my future blog posts will be like. I'm not going to be writing about things I'm an expert on. (Well, I'm not an expert on anything anyway 😆) I'm going to write about things I've recently learned, and I hope that some readers who are also learning will find my posts useful.

As the epilogue of this post, I'm going to tell you something I just learned today: how to put $\LaTeX$ expressions in a Blogger post using MathJax. (This only applies to Google's Blogger platform.)

The steps are pretty simple actually.

  1. Go to your Theme tab.
  2. In the Customize drop down, choose "Edit HTML".
  3. Right under <head>, insert the following code snippet, which I took from here:

    <script>
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']],
        tags: 'ams',
        processEscapes: true,
      }
    };
    </script>
    <script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js' type='text/javascript'>
    </script>

The tex attribute can be customized a lot more. (See MathJax's page for more information.) The inlineMath part declares character sequences to start and end an inline $\LaTeX$ expression. You can change them to whatever you prefer. processEscapes lets you write a single dollar sign (\$) with \\\$, and a single backslash (\\) with \\\\. tags: 'ams' allows automatic equation numbering like the following:

\begin{eqnarray}
\pi & = & 4\left(1 - \frac 13 + \frac 15 - \frac 17 + \ldots \right)\\
& = & 2\left(1 + \frac 13 + \frac{1 \cdot 2}{3 \cdot 5} + \frac{1 \cdot 2 \cdot 3}{3 \cdot 5 \cdot 7} + \ldots\right) \label{eq:second}
\end{eqnarray}

The equation number can be referred to by the usual \label and \eqref commands. Example: \eqref{eq:second}.

Finally, the cdn server can also be customized if you'd like. I just used what the example on the page says, but there are many other choices listed in this section.

Comments

Popular posts from this blog

Adding code snippets to Blogger posts (or any HTML pages)

C++: Hidden array copy operation

You could have invented the determinant