Hacker News new | past | comments | ask | show | jobs | submit login
Convert LaTeX notation to ready to be embedded Markdown (8holon.github.io)
42 points by 8HoLoN on Dec 4, 2021 | hide | past | favorite | 20 comments



This just embeds an image from a third-party commercial service https://latex.codecogs.com/. I don’t think this is a good idea. The “Buy Now” link on that site even 404s; I seriously doubt the longevity of that service.

Just use Pandoc with good old KaTeX or MathJax. The CDN builds will last way longer than this commercial service, and you have the option of self-hosting everything.

Edit: I didn't see the author's comment here. Apparently it's meant for environments where you aren't allowed to include your own JavaScript. In that case it's probably a good idea to prerender the images and include them alongside if you can.


These days it's becoming standard for any markdown converter to support katex/mathjax. For instance, markdown-it has markdown-it-katex. Dump your markdown with equations directly inside your html file and have it do the conversion. Or this: https://github.com/susam/texme


Does it work on Github markdown ? (I made the tool back in 2019 mainly because I couldn't render latex in the render of the readme.md on Github)


Hello! I am the author of TeXMe[1].

Congratulations on launching a working project and running it successfully for the past few years. It is always nice to see new projects pertaining to rendering mathematics on the web.

TeXMe does support GitHub Flavored Markdown (GFM)[2] when used in standalone HTML files. It however does not support your use case of rendering equations in GitHub README.md files. If TeXMe seems interesting, I would also request you to take a look at Muboard[4] which is a live, interactive, self-rendering mathematics chalkboard for the web built with TeXMe.[4]

[1] https://github.com/susam/texme

[2] https://github.github.com/gfm

[3] https://spec.commonmark.org/

[4] https://muboard.net/


Hi, I saw textme uses html and imports js, but does this work in static .md (to be parsed by Github as README.md) ? I only saw .html example in the docs.


Not really, LaTeX is only supported in ipynb on GitHub AFAIK. The submission title is too generic though.


When I converted my CV from Word back in 2013, I went straight to Tex. A local install of MacTex or BasicTex will outlast all of this and works entirely offline from the start.

If I hadn't gotten so far along with my conversion, I might have even dropped down to groff/troff and used TeX as an intermediate step.


That's precisely what I did too about a decade or so ago when I decided to move away from Microsoft Word to write my CV. I used LaTeX. Back then I began using strictly free and open source software only, so I usually had texlive-latex-installed on my Debian GNU/Linux systems to compile my CV. These days, I just use BasicTeX on macOS.


Although the (relative) FOSS benefits are nice, that wasn't the real reason I switched. At the time, Office for Mac 2008 was going EOL, so this wasn't the best option and whispers had already surfaced that future versions would be subscription-only unless you were in an enterprise environment.

Going this route, you eventually end up paying more than MSRP, which feels icky.

As to why I didn't start from groff/toff - the original was done in Word, so I tried to keep a similar format and to get there required a few custom classes that would be a real pain to reproduce.

I considered just using HTML with the print media type, but @page was new then, still isn't uniformly supported, and is basically absent in WebKit.

All told, it probably took 2 weeks - asking silly questions on TeX Exchange and tweaking things - before I got something that I was happy with.


Depending on your goal, I quite like using pandoc [1] for rendering math in HTML. I can write something like:

    Equation:
    
    $$x=\frac{1}{2}$$
Unfortunately there is no common in-browser Math rendering and as the referenced article points out, pictures of equations are not the solution [2]. A common mathematics rendering format is desperately needed but nobody really seems motivated to solve it.

My approach is to use MathML that is rendered natively by Firefox and use JS to render in other browsers [3]. MathJax is way too heavy the last time I checked (growing towards 1MB) [4]. Instead I use math-ml, a JS library that is somewhat complete/abandoned but mostly works in about 80kB [5].

My rational for supporting Firefox's approach is that it's the browser I use, MathML is supported by W3C [6], MathML is supported by pandoc and there is a lightweight workaround for other browsers.

[1] https://pandoc.org/

[2] https://danilafe.com/blog/math_rendering_is_wrong/

[3] https://coffeespace.org.uk/projects/mathml-render.html

[4] https://www.mathjax.org/

[5] https://github.com/pshihn/math-ml

[6] http://www.w3.org/1998/Math/MathML


I agree, I spent ages trying to find a Markdown solution that supported equations and images and so on. Pandoc was the only one that worked really well.


As an alternative, something that I've put together in the past for personal notes / documents. It also covers LaTeX (and TIKZ) inside Markdown and leverages Pandoc.

https://github.com/W4RH4WK/Dogx

It contains a Pandoc filter that pulls out the LaTeX code, generates an SVG that gets embedded into the resulting HTML document.


I hosted a small snippet on heroku and am using https://github.com/atishay/tex2svg/ for my personal Hugo website. It is really cheap and easy to do latex to svg.


I'm the author of the tool, I hope this will be useful to some of you in case you need to put mathematical formulas in your README.md


Nice. There are unescaped ()'s in the URL, will this work correctly?


It's seems to work with the parenthesis as is.


In all markdown parsers?


Which packages does it support? I tried \cancel and it works :)


I don't really know, it's built over the latex.codecogs.com web services.


Is codecogs ok with you using their free service this way?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: