Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown katex macro #89

Merged
merged 1 commit into from
Aug 17, 2021
Merged

Markdown katex macro #89

merged 1 commit into from
Aug 17, 2021

Conversation

ziqiq
Copy link
Contributor

@ziqiq ziqiq commented Aug 10, 2021

This patch enables users to define page level and global katex macro, so that they don't have to type long but frequent math expression over and over again.

Example:

Global macros in pagic.config.ts

export default {
  md: {
    katexMacros: {
      "\\Z": "\\mathbb{Z}",
      "\\Null": "\\mathit{Null}",
      "\\cycl": "\\langle #1 \\rangle"
    },
  },
};

Some additional macros in index.md

$$
\gdef \greetings#1{\text{Welcome to my site, #1!}}
\gdef \degree{^\circ}
$$

$$\greetings{World}$$

A $90 \degree$ counter-clockwise rotation.

The null space of a matrix is $\Null(A) = \{\vec{x}\in \R^n : A\vec{x}=\vec{0}\}$

A cyclic subgroup is $\cycl{g} = \{ g^k | k \in \Z \}$.

result:
Screen Shot 2021-08-10 at 5 43 07 PM

@xcatliu xcatliu merged commit 8d5de47 into xcatliu:master Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants