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 author: Mivinci
title: Math Typesetting 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. description: A brief guide to write mathematical notation.
math: true math: true
tags: tags:
- KaTex - 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. 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,8 +6,13 @@
<h2 class="text-4xl mt-8 mb-8">{{ .Title }}</h2> <h2 class="text-4xl mt-8 mb-8">{{ .Title }}</h2>
{{ end }} {{ end }}
<div class="mt-8"> <div class="mt-8">
{{ range .Data.Pages }} {{ range .Data.Pages.GroupByDate "2006" }}
{{ partial "item.html" . }} <h3 class="text-3xl font-bold mb-4 mt-8">
<a href="#{{ .Key }}">{{ .Key }}</a>
</h3>
{{ range .Pages }}
{{ partial "item.html" . }}
{{ end }}
{{ end }} {{ end }}
</div> </div>
</main> </main>

View file

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