Aurelius
Aurelius

Reputation: 1196

LaTeX math in github wikis

Is it possible to include LaTeX-style math in any way with github repo wikis? Googling implies github no longer allows things like MathJax, but most references are years old. What (if any) alternatives are there to including LaTeX-formatted math in github wikis?

Upvotes: 37

Views: 15477

Answers (6)

Ulysses Zhan
Ulysses Zhan

Reputation: 23

Now GitHub officially supports showing Mathjax in the wiki!

In Markdown, just use $ as the deliminator of inline formulas, and $$ as the deliminator of display formulas.

Upvotes: 1

rjmoggach
rjmoggach

Reputation: 1470

GitLab Wiki and markdown supports formulas. I moved multiple repos for this reason.

Upvotes: 2

Viliam Simko
Viliam Simko

Reputation: 1841

You can use chart.apis.google.com to render LaTeX formulas as PNG. It work nicely with Githhub's markdown:

Example (Markdown):

The ratio of the momentum to the velocity is
the relativistic mass, m.

![f1]

And the relativistic mass and the relativistic
kinetic energy are related by the formula:

![f2]

Einstein wanted to omit the unnatural second term
on the right-hand side, whose only purpose is
to make the energy at rest zero, and to declare
that the particle has a total energy, which obeys:
![f3] which is a sum of the rest energy ![f4]
and the kinetic energy.

[f1]: http://chart.apis.google.com/chart?cht=tx&chl=m=\frac{m_0}{\sqrt{1-{\frac{v^2}{c^2}}}}
[f2]: http://chart.apis.google.com/chart?cht=tx&chl=E_k=mc^2-m_0c^2
[f3]: http://chart.apis.google.com/chart?cht=tx&chl=E=mc^2
[f4]: http://chart.apis.google.com/chart?cht=tx&chl=m_0c^2

https

Some installations of Github Enterprise reject http and work only if you use https

Rendered: enter image description here

Upvotes: 23

Kamil Kiełczewski
Kamil Kiełczewski

Reputation: 92557

There is good solution for your problem - use TeXify github plugin - more details about this plugin and explanation why this is good approach you can find in that answer.

Upvotes: 2

jeninco
jeninco

Reputation: 26

To add math equations to a GitHub wiki, I used mathURL as suggested by Ionică. It will render your LaTeX equations. Append .png to the generated url and use that url as an image (either block or inline) in your markdown.

Upvotes: 0

Ionică Bizău
Ionică Bizău

Reputation: 113455

For simple formulas (such as exponents etc) you may one just to use the available render languages. For example, using Textile, you can do:

_E = mc ^2^_

Thiw will be rendered as:

_ is used for italic style and ^ for superscript.

You can do the same thing in Markdown adding some HTML:

*E = mc<sup>2</sup>*

You can see it in action in this very place:

E = mc2

If you're looking for support for complex math formulas, then you have no better option than using a third-party service generating images for you. mathUrl looks interesting.

As input we give it E = mc ^ 2 and it generates the following link:

http://mathurl.com/render.cgi?E%20%3D%20mc%20%5E%202%5Cnocache

Upvotes: 12

Related Questions