Hugo Math Typsesetting

Display Math Equations To display math equations in Hugo, we need to add math typesettings. I followed the PaperMod - Math Typesetting tutorial since I use it as the template. The tutorial uses KaTex as the library. Step 1: Math.html Create a partial under /layouts/partials/math.html. I use the Auto-render Extension to render the math inside it, and I include the reference to the script: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css" integrity="sha384-zh0CIslj+VczCZtlzBcjt5ppRcsAmDnRem7ESsYwWwg3m/OaJ2l4x7YBZl9Kxxib" crossorigin="anonymous" /> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.js" integrity="sha384-Rma6DA2IPUwhNxmrB/7S3Tno0YY7sFu9WSYMCuulLhIqYSGZ2gKCJWIqhBWqMQfh" crossorigin="anonymous" ></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/contrib/auto-render.min.js" integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous" onload="renderMathInElement(document.body);" ></script> Step 2: Extend Head.html Then we need to include this partial in extend_head.html. ...

February 23, 2025

Cross Entropy

Cross Entropy In machine learning, the cross-entropy loss is a very popular loss function. Here’s the math definiton of it: $$ H(P^* | P) = - \sum_{i} P^*(i) log P(i) $$ I have been using cross entropy for decades without truly understanding this loss function. Recently, I watched a few YouTube videos and want to share my most recent understanding of it. Essentially, cross entropy is very useful for measuring the difference between two distributions. ...

February 23, 2025

Null Parent Window Handler Issue for AzureAuth Library

Null Parent Window Handler Issue for AzureAuth Library Background AzureAuth-Lib is a thin wrapper on top of microsoft-authentication-cli, which is a CLI wrapper of MSAL. These CLI tools are heavily used by developers. Starting from September 2024, users reported an issue with the tool, stating that AzureAuth-Lib failed to acquire an access token due to a null reference exception. Here’s the error stack: [Verbose] MSAL.Desktop.4.54.1.0.MsalClientException: ErrorCode: window_handle_required Microsoft.Identity.Client.MsalClientException: A window handle must be configured. See https://aka.ms/msal-net-wam#parent-window-handles Error Code Deep-Dive But what does window_handle_required mean? ...

February 18, 2025

Hugo Basics

Hugo Basics What is Hugo? Hugo is a popular open-source static site generators. It takes your content written in Markdown format, applies templates, and generates a static HTML website. It is written in Go and has great performance. Comment: I have used other static site generators before, including Gatsby and Docusaurus. I prefer Hugo because it is very easy to use, and good for lightweight websites. Get Started Install Hugo and run the following command to verify you have installed Hugo: ...

February 16, 2025