
Mdmath – LaTeX Math for Markdown inside of Visual Studio Code - fango
https://github.com/goessner/mdmath
======
nerdponx
I wonder if Pandoc being written in Haskell is what's stopping it from being
the default Markdown engine everywhere. Or am I misunderstanding the technical
needs here?

~~~
rntz
I tried to switch from markdown.pl to Pandoc and encountered some problems,
one of which remains an open issue
([https://github.com/jgm/pandoc/issues/1841](https://github.com/jgm/pandoc/issues/1841)):
[https://twitter.com/arntzenius/status/745946799836381184](https://twitter.com/arntzenius/status/745946799836381184)

A telling comment on that github issue is "Actually, it's a bit unclear what
the behavior should be." I think the real problem is the idea of "a default
Markdown engine" is pretty impossible when Markdown doesn't even have a formal
spec. Complex human-readable formats without a spec are never gonna be
compatible between different implementations without extraordinary effort.
(Hence the [http://commonmark.org/](http://commonmark.org/) effort, which I
applaud, but doesn't seem to have a 1.0 spec out yet.)

~~~
geofft
That's sort of convincing me that Markdown + arbitrary HTML is a fundamentally
unstable idea. What's the use case for it? GitHub allows a subset of HTML
tags; sites like Reddit allow none.

I mean, I use Pelican's Markdown support in my own blog, but I wouldn't be
unhappy about having to use <i> instead of underscores.

~~~
rntz
I use markdown for writing blog posts, and I need arbitrary HTML _all the
time_. For tables; or for custom syntax highlighting; for drop-down menus that
let readers choose what PL they want to see examples in
([http://www.rntz.net/post/2016-06-06-not-everything-is-an-
exp...](http://www.rntz.net/post/2016-06-06-not-everything-is-an-
expression.html) ); to put the numbers on section headings into the left-
margin; etc, etc.

Basically, markdown has (at least) two use-cases:

1\. A safe (if you do HTML sanitization properly) way to let people mark-up
their input on web comment sites like HN, StackOverflow, etc. This is probably
the most common use-case.

2\. A web authoring tool. This was the intended use-case.

Supporting arbitrary HTML is absolutely inadmissible for (1); not having
arbitrary HTML is basically inexcusable for (2). And yeah, I could write the
posts in straight HTML, but honestly that's a pain. Why _shouldn 't_ there be
a tool that makes writing styled-text-with-lists-and-headings easy but lets me
drop down to HTML when I need to?

~~~
geofft
Because intermixing Markdown and HTML is ambiguous, and if you're authoring
HTML, you clearly know HTML already?

I'm not actually sure I believe this yet. But I think I'd see a lot more use
case for something that lets me do a very tiny amount of things, maybe just
headings and bold and italic, and avoids not only ambiguity but any risk of
ambiguity.

It just feels like we've reinvented HoTMetaL
([https://support.novell.com/techcenter/articles/img/ana199609...](https://support.novell.com/techcenter/articles/img/ana1996090111.jpg))
but with bonus ambiguity.

~~~
tannhaeuser
Are you saying you shouldn't use HTML with markdown? Markdown was explicitly
designed _not_ to cover each and everything HTML, and so that you could
fallback to HTML; it's kind of the entire point of markdown (or have I
misunderstood you?).

------
saboot
Oh man, this is PERFECT for me. Previously I would just run VS Code and
periodically build my current markdown document while writing LaTeX in it, and
have a browser window refresh on changes (using the LivePage addon for
Chrome). This saves a lot of trouble for me, very excited!

------
wangchow
Very awesome. However, the $ signs indicate financial stuff. It would be nice
to have a different delimiter like the code blocks use back-tics. For example
using back-ticks couple with single-quotes? It doesn't work since it clash
with the code block just for example more legible:

`' x^2 + 4 _x + 4 '`

Remember: the whole idea behind markdown is it should be _first and foremost*
legible from plain-text. One idea behind typography is it shouldn't be noticed
at all to the reader.

~~~
stuffedBelly
"$" ("$$" to be exact) is actually used in TeX to indicate opening and closing
of statements/mathematical expressions. I think the author of this project is
trying to conform to TeX syntax as much as possible so that TeX users like me
would feel at home :).

~~~
widdma
The story is that Knuth chose '$' to denote math mode because math typesetting
at the time was prohibitively expensive.

~~~
stuffedBelly
ahaha, that's a good piece of anecdote.

------
IshKebab
I have looked into markdown editors a lot, and the best I found was this
plugin for Atom:

[https://github.com/shd101wyy/markdown-preview-
enhanced](https://github.com/shd101wyy/markdown-preview-enhanced)

I know Atom kind of sucks, but this plugin is amazing. Mostly because it
supports PlantUML which is also amazing.

Highly recommended.

~~~
OJFord
> _I know Atom kind of sucks_

I've tried really hard to like Atom. It's a shame that 'modern open-source
configurable' seems to mean 'Electron app' (cf. Hyper) - I'm convinced it's
not the best in terms of potential, but since that's where the collective
effort, it seems unfortunately the best available.

(I revert to vim after getting fed up with Atom, I just can't help feeling
that better could be achieved by forgetting legacy platforms and backwards
compatibility - I'll try Kakoune if it stops being called the author's
"experiment" and gets versioned releases.)

------
now
Couldn’t you just write your “LaTeX Math” for LaTeX instead?

~~~
KON_Air
As I see it, it is more for "I just wrote/ended up with this code doing a
complex math equation. But I just can't read it even with all these comments."
cases.

------
pflats
This is really cool for quick things, but for anything short of quick notes, I
don't want to have to manually number my equations. I generally don't write
top-to-bottom, I write subsections at a time.

Labels seem straightforward enough, but I'm at a loss for a markdown-y way to
do a ref.

$$\exist 0 \in R \mathrm{s.t.} a + 0 = a \forall a \in R$$ (eqn:addid)

In addition to a zero as per (*eqn:addid), one must also show the existence of
an inverse.

It's decent, but I don't love it. And further overloading the splat will be
miserable.

------
akvar
Oh wow! Man this is so rad. This can help me kick my dependence on Typora /
Dropbox Paper for class notes and continue the VSCode loving.

------
karlding
I've been using the free-tier of Classeur [1] for taking notes during class,
which I then export to a PDF. It's basically an online Math/Mardown editor
with pretty much the same feature-set.

Maybe I'll try this out and see how I like it.

[1] [http://classeur.io/](http://classeur.io/)

------
nickysielicki
Neovim users can do something similar:

[https://github.com/donRaphaco/neotex](https://github.com/donRaphaco/neotex)

[https://www.youtube.com/watch?v=zCdDgtlBaTU](https://www.youtube.com/watch?v=zCdDgtlBaTU)

------
jwtadvice
This is wonderful. However, I always loved markdown because of its being so
simple and fast.

Isn't Latex Turing-Complete?

~~~
contravariant
TeX has \def which basically allows you to write lambda expressions, so yeah
it's Turing complete. The basic math notation isn't though, and I'd be
surprised if this extension allows you to use \def (or really any of the more
powerful features of TeX).

~~~
Mtinie
If it's using the full selection of functions available to KaTeX, here's the
list:

[https://github.com/Khan/KaTeX/wiki/Function-Support-in-
KaTeX](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)

\def isn't included in the core set, from what I can see.

------
rkevingibson
Surprised I haven't seen anyone post Markdeep here yet: [https://casual-
effects.com/markdeep/](https://casual-effects.com/markdeep/)

Seems to cover a lot of the same ground, though it's not restricted to visual
studio code.

------
lenkite
I really wish the author had chosen asciidoc which has well defined semantics
for latex math incorporation and also supports asciimath

------
S4M
That's neat, but I managed to do something similar (except for the graphics, I
haven't tried that) with Markdown + Mathjax.

~~~
verandaguy
As I understand it, this is basically that; except with Khan Academy's KaTeX
library instead (it's got ridiculously fast rendering compared to MathJax).

------
kevinwang
Is there a latex editor that can show the end product side by side while
you're writing the document?

~~~
nbz118
Both [http://sharelatex.com](http://sharelatex.com) and
[http://overleaf.com](http://overleaf.com) support that by re-rendering a pdf
preview as you make changes. Overleaf also has a WYSIWYG editor with inline
latex, although I find it doesn't work for everything.

~~~
mjdesa
The best WYSIWYG LaTeX I've come across is
[http://mathquill.com](http://mathquill.com)

~~~
OJFord
If you press and hold `/`, that's a Christmas tree generator.

------
smilekzs
Nitpick: Title should indicate VSCode

------
carlcortright
Can someone do this for atom?

------
mrcactu5
i would appreciate something like this for Atom.

------
legulere
doesn't understand \boldsymbol :/

