#  markdown with mathjax in hugo and pandoc

**URL:** <https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548>\
**Category:** support\
**Tags:** typesetting\
**Created:** [November 28, 2018, 2:30pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548 "2018-11-28T14:30:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![libertylocked](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/libertylocked/32/7414_2.png) [@libertylocked](https://discourse.gohugo.io/u/libertylocked)\
**Post date:** [November 28, 2018, 2:30pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/1 "2018-11-28T14:30:11Z")

</div>

Is it possible to write one markdown with mathjax that shows up correctly in both Hugo and PDF compiled by `pandoc --mathjax` ?

Here is example

```auto
Where $sid\_a$ is Alice's sending mailbox ID, i.e. Alice puts encrypted messages to Bob in a mailbox whose ID is $sid\_a$. Similarly $sid\_b$ is Bob's sending mailbox ID. The $k\_{e}$ is the shared secret for E2E messaging, used to encrypt and authenticate the messages.

```

If I escape the underscores like above, they render correctly in Hugo, but not so much in pandoc’s output

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/4/40db8ba91388f177479a34d583b2cfa227497ad7.png)

If I don’t escape the underscores they look messed up in Hugo but compile correctly in pandoc.

* * *

hugo env

```auto
Hugo Static Site Generator v0.51/extended linux/amd64 BuildDate: unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11.2"

```

---

<div class="post-metadata">

**Author:** ![AustenLamacraft](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/austenlamacraft/32/9776_2.png) [@AustenLamacraft](https://discourse.gohugo.io/u/AustenLamacraft)\
**Post date:** [October 11, 2019, 10:40pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/2 "2019-10-11T22:40:38Z")

</div>

Did anyone figure this out? I’d like to use Hugo and write markdown with Typora, which uses pandoc.

I note there is something in the docs about pandoc as an external helper, but `markdown: pandoc` in the front matter (if that is the right thing to do) didn’t help.

---

<div class="post-metadata">

**Author:** ![AustenLamacraft](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/austenlamacraft/32/9776_2.png) [@AustenLamacraft](https://discourse.gohugo.io/u/AustenLamacraft)\
**Post date:** [October 13, 2019, 10:12am UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/3 "2019-10-13T10:12:02Z")

</div>

Here’s a solution: give the markdown the extension `.pdc` and pandoc will be used. This isn’t stated explicitly in the docs

---

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [October 14, 2019, 5:03pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/4 "2019-10-14T17:03:31Z")

</div>

The docs link to Hugo’s source code, which currently says this:

> <https://github.com/gohugoio/hugo/blob/master/helpers/general.go#L77-L94>

I’ve written about this in [https://www.ii.com/hugo-markup-languages/](https://www.ii.com/hugo-markup-languages/), which discusses that you can tell Hugo to interpret a file as Pandoc with any of the following:

- `.pdc` file extension
- `.pandoc` file extension
- `markup: pdc` in YAML front matter
- `markup: pandoc` in YAML front matter

I hope that’s helpful!

I’d love to hear about any tips for using Pandoc with Hugo because I need to do that with some of my old Tumblr tumbles, which I wrote in PHP-Extra-flavored Markdown.

---

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [October 14, 2019, 5:05pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/5 "2019-10-14T17:05:00Z")

</div>

> [@AustenLamacraft](#):
>
> `markdown: pandoc`

That should be:

```
markup: pandoc

```

🥰

---

<div class="post-metadata">

**Author:** ![Royi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/royi/32/12954_2.png) [@Royi](https://discourse.gohugo.io/u/Royi)\
**Post date:** [December 27, 2020, 5:50pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/6 "2020-12-27T17:50:59Z")

</div>

Is there a way to enforce Hugo to use Pandoc as its MarkDown engine instead of the default?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 27, 2020, 5:53pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/7 "2020-12-27T17:53:05Z")

</div>

No there is not. Unless you fork Hugo and modify its source.

Also we discourage bumping old topics in this forum, as Hugo features may have changed in the meantime and participants in old discussions may no longer be active here.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 27, 2020, 5:53pm UTC](https://discourse.gohugo.io/t/markdown-with-mathjax-in-hugo-and-pandoc/15548/8 "2020-12-27T17:53:08Z")

</div>

Archived on December 27, 2020, 5:53pm UTC


