top | item 18307747

Show HN: TeXMe – Self-Rendering Markdown and LaTeX Documents

209 points| susam | 7 years ago |github.com

90 comments

order
[+] andridk|7 years ago|reply
As someone who has written a few of LaTeX documents over the years, I'd like to point out that rendering TeX math does not constitute a TeX document at all.

What LaTeX truly shines at, is typography. Yet a bunch of people seem to think that it's only a way to write math.

This is an interesting project. It just bums me out because I thought it was a TeX distribution for the web. I'd remove "TeX" from the name to avoid confusion.

[+] bfirsh|7 years ago|reply
If you’re interested in an actual TeX distribution for the web, I’m working on something like that: https://github.com/arxiv-vanity/engrafo

It’s based on LaTeXML, which does the heavy lifting of converting LaTeX to HTML. I’m more interested in the CSS applied on top of that. I want to make web output of the same calibre as the PDF output. (Or, near to it at least. :)

[+] paraditedc|7 years ago|reply
> What LaTeX truly shines at, is typography.

I respectfully disagree. I think people use LaTeX to write scientific documents because there is no better alternatives, not because LaTeX is good.

I find the typesetting system in LaTeX is extremely verbose and over-complicated, as compared to something like HTML+CSS or Markdown.

If someone comes up with a good enough typesetting system with some inspiration from Markdown, HTML and CSS, LaTeX will lose its popularity. HTML and CSS are more expressive than LaTeX, so it should be theoretically possible.

One possible explanation for the lack of better alternatives is that the people who really need the alternatives and people who are capable of coming up with better alternatives are somewhat mutually exclusive. Former is more research-heavily and latter is more coding and user experience heavy.

[+] minademian|7 years ago|reply
I agree. It is indeed a novel project, but has little to actually do with TeX.
[+] wuliwong|7 years ago|reply
If a bunch of people use LaTeX only to write math and this contains that functionality, why wouldn't the author want to advertise it? Is there a specific short-hand name for the LaTeX math functionality?
[+] nabla9|7 years ago|reply
It would be nice to have a option that uses LaTex to render html text in browsers.

   p.legibility {
      text-rendering: LaTeX;
   }
[+] SagelyGuru|7 years ago|reply
This is a godsend to anyone who just wants to publish markdown blogs (with some maths) etc in the simplest possible way on a static website.

I know, the proper way is supposed to be to use Jekyll or Hugo or something like that, to compile to raw html on the server side but this is much simpler for the publisher. No configuration and compilation and updating on the server involved.

I do not think that the user will notice or begrudge the few milliseconds of processing in his browser. Especially if this could be converted to a WASM module. Any takers?

[+] bhl|7 years ago|reply
Two different approaches: Jekyll is often top-down, start with a theme that you like and make edits to the css and html files until you get something you like. Downside is if you want to make major changes, you’ll have to understand complex code you didn’t write yourself. The approach given by this post is bottom-down; start with some basic css edits. Downside is you may spend enough time customizing that using a Jekyll would have been better. ‍️
[+] garganzol|7 years ago|reply
I'm very grateful you created this. It is going to be a tool #1 in my workflow. The best thing I like is that the resulting document can be printed or saved as a PDF file with web browser printing dialog.

Impressive. A sweet spot between HTML, Markdown and LaTeX.

[+] arendtio|7 years ago|reply
I think that is pretty cool.

The one thing I would wish for is a build tool where I could insert my CSS (or a choose from available themes) and build my version of TeXMe (I have a CSS file already which I use to convert Markdown files to PDF).

I mean, yes it is not that complicated, and I might just do it manually, but for wider adoption, it would be cool to have themed versions which do not clutter the Markdown files.

[+] chrisweekly|7 years ago|reply
Huh? How do you use CSS to convert MD to PDF?
[+] tdgunes|7 years ago|reply
Can you explain how different TexMe is than Markdeep?
[+] wahern|7 years ago|reply
I'm curious, too, though I suspect the author either wasn't aware of Markdeep or just wanted to scratch their own itch.

I use Markdeep for most Markdown content, including Github, as I like being able to compose in my own editor, joe, but be able to quickly see the results before committing without having to explicitly compile anything--just tab into browser and refresh.

The "problem" with Markdeep is that it supports so many different features (including LaTeX math typesetting, but also ASCII diagram rendering) that it can be difficult stick to a common subset supported by, e.g., Github.

[+] blattimwind|7 years ago|reply
> The rendered document demonstrates two interesting features of TeXMe:

It also demonstrates documents created this way require code from two different third-party origins to work at all.

[+] andrepd|7 years ago|reply
Wouldn't it make more sense to compile the markdown and serve the result, rather than having the user render it client-side? Seems very inefficient.
[+] susam|7 years ago|reply
Pandoc, commonmark.js, and many other tools and libraries can already do that. This project is not trying to address that use case. Instead, this project is attempting to make a Markdown + LaTeX (MathJax) file render itself with minimal additional HTML.
[+] mxstbr|7 years ago|reply
Does anybody know if a similar thing exists that renders out markdown without LaTeX?

That'd be a neat way to quickly create documentation websites for open source projects!

[+] susam|7 years ago|reply
Yes, TeXMe does it. Here is a minimal example:

    <!DOCTYPE html>
    <script>window.texme = { useMathJax: false, protectMath: false }</script>
    <script src="https://cdn.jsdelivr.net/npm/texme"></script><textarea>

    ### Atomic Theory

    Atomic theory is a scientific theory of the nature of matter, which
    states that matter is composed of discrete units called atoms. It began
    as a philosophical concept in ancient Greece and entered the scientific
    mainstream in the early 19th century when discoveries in the field of
    chemistry showed that matter did indeed behave as if it were made up of
    atoms.
Right now, it requires a few more lines of HTML code to disable MathJax related processing. I am planning to add a simpler mechanism later, so that something like merely appending "?markme" to the TeXMe URL in the <script> tag is enough to set it to Markdown-only mode. If anyone has a better idea regarding this, please let me know or send a pull request.
[+] dspillett|7 years ago|reply
The documentation suggests this library has the option to skip the extra mathematical rendering if that is all you need:

> Render Markdown Without MathJax > To render Markdown-only content without any mathematical content at all ...

[+] acqq|7 years ago|reply
The same project has this option, read the readme.
[+] enriquto|7 years ago|reply
for simple documents, you can write html directly, is is not a hassle at all.
[+] luckylittle|7 years ago|reply
There are already tools doing similar thing: https://www.sharelatex.com/ https://latexbase.com https://papeeria.com/
[+] foo101|7 years ago|reply
None of the tools you mention does anything similar to the tool shared in this post. What similarity do you find apart from the obvious and peripheral similarity that they are all rendering latex?

The first and third tools require you to sign up. How exactly do you create a distributable Markdown file there that can be read both in editor as text and viewed as HTML in browser? The second link does not recognize Markdown.

[+] zzo38computer|7 years ago|reply
I use Plain TeX for typesetting, and it is good. (I don't use LaTeX. I think Plain TeX is better. And, for making fonts, METAFONT is better.) But to render TeX documents you will need to implement TeX. (You could, however, implement a TeX macro package that you can then use the same input for multiple kind of output.)
[+] Too|7 years ago|reply
This project is just evidence that markdown rendering should be built into the browser.
[+] c-smile|7 years ago|reply
But why?

Isn't it better to use something like my https://html-notepad.com where you can just create/edit your document in WYSIWYG and use Markdown as one of input options? (Markdown is coming there).

I think that this is the best of two worlds.

[+] ajnin|7 years ago|reply
The example is incorrect, it should be e^{i \pi} + 1 = 0
[+] susam|7 years ago|reply
Whoops! That was incorrect indeed. A very unfortunate typo because it happens to be a favourite equation of many people, including me.

Thank you for reporting this. I have fixed it now.