This commit is contained in:
mivinci 2023-03-16 20:14:25 +08:00
commit 144b197c31
3 changed files with 13 additions and 8 deletions

View file

@ -1,11 +1,12 @@
---
author: Mivinci
title: Math Typesetting
date: 2021-07-18T10:52:59+08:00
date: 2020-07-18T10:52:59+08:00
description: A brief guide to write mathematical notation.
math: true
tags:
- KaTex
- markdown
---
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries like [KaTeX](https://katex.org) the one that Minima uses. Here's what you can do in the configuration file to enable it.

View file

@ -6,9 +6,14 @@
<h2 class="text-4xl mt-8 mb-8">{{ .Title }}</h2>
{{ end }}
<div class="mt-8">
{{ range .Data.Pages }}
{{ partial "item.html" . }}
{{ range .Data.Pages.GroupByDate "2006" }}
<h3 class="text-3xl font-bold mb-4 mt-8">
<a href="#{{ .Key }}">{{ .Key }}</a>
</h3>
{{ range .Pages }}
{{ partial "item.html" . }}
{{ end }}
{{ end }}
</div>
</main>
{{ end }}
{{ end }}

View file

@ -15,12 +15,11 @@
</title>
{{ $favicon := "favicon.ico" }}
<link rel="shortcut icon" href="{{ $favicon | relURL }}" type="image/x-icon" />
{{ $hash := now.Unix }}
{{ $options := (dict "targetPath" (printf `minima.%d.css` $hash) "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $options := (dict "targetPath" "minima.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "css/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ $options = (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate (printf `minima.%d.js` $hash) . }}
{{ $options = (dict "targetPath" "minima.js" "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate "minima.js" . }}
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
{{ if .IsTranslated }}
{{ range .Translations }}