Tips and tricks for Hugo/PaperMod that I have used.
Opening Links in New page#
Override default behaviour by adding a render-link.html file under layouts. Follow this page for more details.
Handle Katex#
- Enable Maths on the markdown page:
1
2
| math: true
markup: "mmark"
|
- Create a shortcode for katex with
{{ .Inner }}
. This would ensure all text meant for Katex is not processed. - Use shortcode
\{\{< katex >\}\}
before any katex code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| \{\{< katex >\}\} # remove \ here
$$
\begin{align}
q(x_t|x_0) &= N(\sqrt\alpha_tx_{t-1}, (1 - \alpha_t )I) \cr
&= \sqrt\alpha_t x_{t-1} + \sqrt{(1-\alpha_t)}\ast\epsilon_t \cr
&= \sqrt\alpha_t(\sqrt\alpha_t x_{t-2} + \sqrt{(1-\alpha_{t-1})}\ast\epsilon_{t-1}) + \sqrt(1-\alpha_t)\ast\epsilon_t \cr
&= \sqrt\alpha_t\sqrt\alpha_t x_{t-2} + \sqrt\alpha_t\sqrt{(1-\alpha_{t-1})}\ast\epsilon_{t-1} + \sqrt(1-\alpha_t)\ast\epsilon_t \cr
&= \sqrt\alpha_t\sqrt\alpha_tx_{t-2} + \sqrt{(1-\alpha_t\alpha_{t-1})}\ast\epsilon_{t-1}^\ast \quad where \thinspace \epsilon_{t-1}^\ast\in N(0, I) \cr
&= ... \cr
&= \sqrt{\bar\alpha_t}x_0 + \sqrt{(1 - \bar\alpha_t )}\ast\epsilon_0^\ast ; where \space \bar\alpha_t=\Pi_{i=1}^T{\sqrt\alpha_i}, \space \epsilon_0^\ast \in N(0, I) \cr
&= N(\sqrt{\bar\alpha_t}x_0, (1 - \bar\alpha_t)I)\cr
\end{align}
$$
\{\{< /katex >\}\} # remove \ here
|
$$
\begin{align}
q(x_t|x_0) &= N(\sqrt\alpha_tx_{t-1}, (1 - \alpha_t )I) \cr
&= \sqrt\alpha_t x_{t-1} + \sqrt{(1-\alpha_t)}\ast\epsilon_t \cr
&= \sqrt\alpha_t(\sqrt\alpha_t x_{t-2} + \sqrt{(1-\alpha_{t-1})}\ast\epsilon_{t-1}) + \sqrt(1-\alpha_t)\ast\epsilon_t \cr
&= \sqrt\alpha_t\sqrt\alpha_t x_{t-2} + \sqrt\alpha_t\sqrt{(1-\alpha_{t-1})}\ast\epsilon_{t-1} + \sqrt(1-\alpha_t)\ast\epsilon_t \cr
&= \sqrt\alpha_t\sqrt\alpha_tx_{t-2} + \sqrt{(1-\alpha_t\alpha_{t-1})}\ast\epsilon_{t-1}^\ast \quad where \thinspace \epsilon_{t-1}^\ast\in N(0, I) \cr
&= ... \cr
&= \sqrt{\bar\alpha_t}x_0 + \sqrt{(1 - \bar\alpha_t )}\ast\epsilon_0^\ast ; where \space \bar\alpha_t=\Pi_{i=1}^T{\sqrt\alpha_i}, \space \epsilon_0^\ast \in N(0, I) \cr
&= N(\sqrt{\bar\alpha_t}x_0, (1 - \bar\alpha_t)I)\cr
\end{align}
$$
Adding collapsible Sections in Hugo#
Got this from here
The following caveats:
- Have an empty line after the
</summary>
tag or markdown/code blocks will not render. - Have an empty line after each
</details>
tag if you have multiple collapsible sections.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <details>
<summary>Click me</summary>
### Heading
1. Foo
2. Bar
* Baz
* Qux
### Some Code
```js
function logSomething(something) {
console.log('Something', something);
}
</details>
|
Want to connect? Reach out @varuntul22.