Gangmax Blog

Mathematics Content in Markdown

Mathematics Diagram

  1. Use the online version of “Mathcha“.

  2. Use the “GeoGebra“ application which is available on “macOS/iOS”.

Mathematics Equation(Markdown + LateX)

Plan A: write LaTeX in markdown content directly

  1. Install MacTeX

    MacTeX is required by the “pandoc” command below. So please install it from this, or install the basic version(which is smaller and I installed this version) from this.

  2. Use the following command to convert “markdown + Latex” into HTML file(from this):

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # Export to HTML.
    pandoc --standalone --mathjax -f markdown -t html sample.md -o sample.html

    # Export to PDF(it seems the full version of "MacTeX" is required by this,
    # otherwise the Chinese characters cannot be displayed properly).
    # You may be prompted "weasyprint not found. Please select a different
    # --pdf-engine or install weasyprint", if so, install it first with
    # "brew install weasyprint".
    pandoc sample.md --pdf-engine=xelatex -V CJKmainfont="PingFang SC" \
    --from=markdown+raw_html --resource-path=.:svg \
    -V geometry:margin=1.5cm -o sample.pdf
  3. Use the online tool “latex2image-web“ to convert a given LaTeX expression to local image(SVG/PNG) file.

Plan B: use online “markdown+LaTeX” editor

Use the online editor “upmath“ to write the markdown, and render the generated HTML content into PDF with the printing feature provided by browser like Chrome.

Content of “sample.md”

Here is the file content used in the commands above. The “./svg/equation.svg” file is an equation image made with “latex2image-web“.

sample.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Abstract

From [there](https://goessner.github.io/mdmath/publication.html).

Euler's identity makes a valid formula out of five mathematical constants.

## 1. Introduction

Euler's identity is often cited as an example of deep mathematical beauty.
Three basic arithmetic operations occur exactly once and combine five fundamental mathematical constants [[1](#1)].

## 2. The Identity

这是一句中文,用于测试中文环境下使用Latex表达式是否正常,比如: $\Delta = b^2 - 4ac$

这是第二句中文,用于测试中文环境下使用Latex表达式是否正常,比如: ![](./svg/equation.svg)

Starting from Euler's formula $$e^{ix}=\cos x + i\sin x$$ for any real number $x$, we get to Euler's identity with the special case of $x = \pi$

$$e^{i\pi}+1=0\,.$$ (1)

The arithmetic operations *addition*, *multiplication* and *exponentiation* combine the fundamental constants

* the additive identity $0$.
* the multiplicative identity $1$.
* the circle constant $\pi$.
* Euler's number $e$.
* the imaginary constant $i$.

## 3. Conclusion

It has been shown, how Euler's identity makes a valid formula from five mathematical constants.

### References

1. [Euler's identity](https://en.wikipedia.org/wiki/Euler%27s_identity)

Comments