# PR to add asciimath

**URL:** https://meta.discourse.org/t/pr-to-add-asciimath/253651
**Category:** Development
**Tags:** math
**Created:** [27.Май.2018 01:52:39 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651 "2018-05-27T01:52:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [27.Май.2018 01:52:39 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/1 "2018-05-27T01:52:39Z")

</div>

I’ve just submitted a pull request to modify the plugin so that it can process input expressed in asciimath, as well as LaTeX. The code is [on GitHub](https://github.com/mcmcclur/discourse-math) and (for a brief time only) you can see it in action on [this temporary discourse instance](https://discourse.marksmath.org/).

I mention it here because, as you said:

> [@Discourse Math](https://meta.discourse.org/t/discourse-math/65770/1):
>
> We need to discuss a syntax for [asciimath](http://asciimath.org/)

I chose to delimit asciimath input with a single percent sign (%). The [aciimath webpage](http://asciimath.org/) indicates a preference for a backtick (`); that seems a poor choice because markdown typically uses this to denote inline code. There’s not a whole lot of other choices of single character delimiters that aren’t either very commonly used in math (like +/-/=) or captured by discourse for some special purpose (like @ or #). I went with the percent sign, in part, because it’s right next to the dollar sign used for TeX. Note that you can still use a percent sign in math input by escaping it with a backslash.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [27.Май.2018 02:40:59 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/2 "2018-05-27T02:40:59Z")

</div>

Hmm 🤔 what if we did something like %` some math ` , I know it is 2 keys but it would save us from escaping percents and we could have a block form with % triple backtick?

What do other markdown implementations do like math stack exchange etc?

---

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [27.Май.2018 02:59:30 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/3 "2018-05-27T02:59:30Z")

</div>

> [@sam](#):
>
> Hmm 🤔 what if we did something like %`some math` , I know it is 2 keys but it would save us from escaping percents

One thing that I like about the code the way I’ve set it up now is that it uses your original `inlineMath` function almost verbatim. I’ve just added a third argument to specify the delimiter - 36 for $ for LaTeX and 37 for % for asciimath. I rather like that simplicity and multi-purposing of code. Also, I’m a bit of a novice at this and not sure how much time it would take me to figure out to scan two symbols.

I’m definitely open to using some other single symbol; I’m just not sure of a better choice.

> [@sam](#):
>
> could have a block form

It would not be hard to set up a block form (I’d prefer to delimit it with `%%`) which would be passed to a `div` rather than a `span`. The typesetting itself, though, would be unaffected because asciimath itself does not distinguish between inline and display math. That’s why I didn’t specify a block form to begin with and I’m still not totally sure if it’s a good idea.

> [@sam](#):
>
> What do other markdown implementations do like math stack exchange etc?

I don’t believe that math.stackexchange uses asciimath and I’m fairly active there. I honestly don’t know just how widely used it is. My own interest arises because I use Discourse to set up fora for college students and I’d like something that’s a bit more intuitive for them to use. I think the fact that asciimath is, to some degree, a “simpler” LaTeX supports the idea to use a single delimiter as well.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [27.Май.2018 03:32:07 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/4 "2018-05-27T03:32:07Z")

</div>

Ok so I am fine to accept % but let’s make this optional default off with a site setting

---

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [27.Май.2018 03:37:59 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/5 "2018-05-27T03:37:59Z")

</div>

> [@sam](#):
>
> let’s make this optional default off with a site setting

I can definitely do that!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [01.Февраль.2023 10:18:38 UTC](https://meta.discourse.org/t/pr-to-add-asciimath/253651/6 "2023-02-01T10:18:38Z")

</div>


