# Disabling LaTeX generation in Documenter Markdown

**URL:** <https://discourse.julialang.org/t/disabling-latex-generation-in-documenter-markdown/51167>\
**Category:** General Usage\
**Tags:** documenter\
**Created:** [December 3, 2020, 4:33am UTC](https://discourse.julialang.org/t/disabling-latex-generation-in-documenter-markdown/51167 "2020-12-03T04:33:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EP-Guy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ep-guy/32/3442_2.png) [@EP-Guy](https://discourse.julialang.org/u/EP-Guy)\
**Post date:** [December 3, 2020, 4:33am UTC](https://discourse.julialang.org/t/disabling-latex-generation-in-documenter-markdown/51167/1 "2020-12-03T04:33:38Z")

</div>

[Documenter.jl](https://juliadocs.github.io/Documenter.jl/stable/) is being used with the Markdown backend to process docstrings into `.md` files. Usually the next step would be to use [MkDocs](https://www.mkdocs.org/) or something similar to turn them into `.html` files. Unfortunately, the system where this is running is fairly locked down and MkDocs can’t be used. The src files are on a Gitlab server, but Gitlab Pages is disabled (which is why we’re using the Markdown backend in the first place).

Gitlab formats the `.md` files nicely, but there is one problem. The source code docstrings have a considerable number of math blocks, e.g.

````
```math
    \alpha = \frac{1}{2}
```

````

which become

```
$$\alpha = \frac{1}{2}$$

```

after processing by Documenter.jl. Gitlab automatically renders the ` ```math` block correctly but doesn’t format the `$$` style.

How can I prevent Documenter.jl from changing the math formatting in the generated `.md` files?

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [December 4, 2020, 2:27am UTC](https://discourse.julialang.org/t/disabling-latex-generation-in-documenter-markdown/51167/2 "2020-12-04T02:27:55Z")

</div>

This is a bit of a hack, but what you could do is re-define the relevant Markdown stdlib methods in `make.jl`. I haven’t tested it, but I think, for the block math, this is where the dollar signs come from:

> <https://github.com/JuliaLang/julia/blob/8dd959efb89dda15ebee94672d672675c9858607/stdlib/Markdown/src/render/plain.jl#L87-L91>

Of course, this is all internals, so there is no guarantee that updating the version of Julia or Documenter won’t break things.

> [@EP-Guy](#):
>
> Gitlab automatically renders the ` ```math` block correctly but doesn’t format the `$` style.

Just curious: does it actually render them as math? Or does it just show the LaTeX source?

Edit: I also found the method that renders the inline LaTeX:

> <https://github.com/JuliaLang/julia/blob/8dd959efb89dda15ebee94672d672675c9858607/stdlib/Markdown/src/IPython/IPython.jl#L25-L26>

---

<div class="post-metadata">

**Author:** ![EP-Guy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ep-guy/32/3442_2.png) [@EP-Guy](https://discourse.julialang.org/u/EP-Guy)\
**Post date:** [December 4, 2020, 2:34am UTC](https://discourse.julialang.org/t/disabling-latex-generation-in-documenter-markdown/51167/3 "2020-12-04T02:34:31Z")

</div>

Thanks for pointing this bit out.

We’ve ended up just writing some code to identify the dollar signs and replace them with ` ```math`.

> [@mortenpi](#):
>
> Just curious: does it actually render them as math? Or does it just show the LaTeX source?

It actually renders as math! See [GitLab Flavored Markdown (GLFM) | GitLab](https://docs.gitlab.com/ee/user/markdown.html#math)

I was surprised that Gitlab does this too. (We also added some code to switch the single dollar signs to Gitlab-compatible ` $` `$`).
