10

I have tried numerous HTML preambles such as the following minimal example:

  #+TITLE: Some math stuff
  #+BEGIN_HTML
         <script type="text/javascript"
            src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
        </script>
  #+END_HTML
  =(solve a b)= should return $X$, from $AX=B$

The inline math works on my desktop if I export to HTML and view in my browser, but does not seem to be rendered in Github where the dollar signs are just echoed in the output.

Any idea on how to get Github to render inline math? Please note the answer to this question on how to do the same with README.md doesn't help as markdown is dissimilar to the much more featureful org mode.

EDIT: I have now learned how Github processes the .org file using github/markup which in turn uses org-ruby to parse the file. It appears that code blocks with #+BeginSrc etc are parsed very well but not the preamble lines or the inline math---though I have not really confirmed this yet.

@david This is the partial but hopefully relevant source from my webpage:

README.org

    <article class="markdown-body entry-content" itemprop="mainContentOfPage"><h1><a id="user-content-some-math-stuff" class="anchor" href="#some-math-stuff" aria-hidden="true"><span class="octicon octicon-link"></span></a>Some math stuff</h1>
         
<p><code>(solve a b)</code> should return $X$, from $AX=B$</p>
</article>
  </div>

Edit 2: Signal for @VonC in the comments: GitHub supports Latex/MathJax since May 2022

mcheema
  • 850
  • 9
  • 25
  • 1
    possible duplicate of [How to show math equations in general github's markdown(not github's blog)](http://stackoverflow.com/questions/11256433/how-to-show-math-equations-in-general-githubs-markdownnot-githubs-blog) – schaueho Jul 21 '15 at 08:57
  • @schaueho i looked at that link and it only addresses the markdown format and not the org format for readme files. I will see If I can use the answer there as a step to figuring out how to setup org-mode files but I believe this is a separate question. – mcheema Jul 21 '15 at 09:08
  • @schaueho just checked the link refers to the processor used by github for markdown processing so will not help me with org file processing info. – mcheema Jul 21 '15 at 09:09
  • Try using `\(...\)` rather than `$...$`, as the dollar sign delimiters are not enabled by default. Otherwise, see the [documentation](http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-math-delimiters) for how to enable the dollar delimiters. – Davide Cervone Jul 21 '15 at 12:22
  • @DavideCervone thanks for the suggestion but it didn't work. In emacs I've never had a problem with the $...$ notation, but worth a try. – mcheema Jul 21 '15 at 12:51
  • Are you sure the script tag is getting through to the generated HTML on Github? If you view the source of the generated page, do you see the tag? As for `$...$` in emacs, the configuration for the emacs mode you are using (org mode?) probably includes the dollar signs. The one you give above certain does not. Can you post the modified HTML header? – Davide Cervone Jul 21 '15 at 14:29
  • Thanks for your efforts @DavideCervone much appreciated. I am not so familiar with viewing source of a web page but let me figure it out and get back to you. I have found out more about how github deals with org markup so I will edit my question to reflect that. Maybe you can see a way to use that information to get a result. – mcheema Jul 21 '15 at 16:12
  • The HTML fragment you added suggests that the ` – Davide Cervone Jul 21 '15 at 18:08
  • I'll see if i can dig up more information. – mcheema Jul 21 '15 at 19:54
  • 1
    GitHub supports [Latex/MathJax since May 2022](https://stackoverflow.com/a/72310304/6309). – VonC May 19 '22 at 19:49

1 Answers1

2

https://github.com/github/markup/issues/274 seems to indicate that it's not currently possible. The issue was closed with no resolution.

NickD
  • 5,937
  • 1
  • 21
  • 38
  • As of 2021, the working solution is still "to use an external service like iTex2Img to render latex to equations" (the quote is from the linked post). However, for some basic math try using [Markup for Rich Contents](https://orgmode.org/manual/Markup-for-Rich-Contents.html#Markup-for-Rich-Contents). Both Github and Gitlab properly render .org files with such markup. – Y. E. Mar 11 '21 at 14:35