ArthurSonzogni / Diagon

Interactive ASCII art diagram generators. :star2:
https://arthursonzogni.com/Diagon/
MIT License
1.48k stars 56 forks source link

Allow more complicated composition of characters in sub and superscript #2

Closed KennethNielsen closed 4 years ago

KennethNielsen commented 4 years ago

Hi me here once again.

I have another request, but as before feel free to ignore it if it is out of scope. I post the issues because I would really like to use the tool to create in-code equations and it can almost do everything I want :smile:

As mentioned before, for scientific equations there can often be complicated both super and subscripts. As it is right now, the sub or super script seems to allow only sequences of letters or numbers and ends as soon as they are mixed or if a special character is added. This means e.g. that if I wanted to do what I in Latex would write as E_{2m} or I{_M'} the m and the ' disappears and breaks the equation. Would it be possible to add an apply-to-start-and-end like the {} in Latex, to make it possible to make these more elaborate sub and super scripts.

Regards Kenneth

ArthurSonzogni commented 4 years ago

I think I can do one of the 3 things:

When typing:

A_(1+2)

We currently get:

A       
 (1 + 2)

But you would like:

A       
 1 + 2

I am already doing this for division:

(1+2)/3

is giving:

1 + 2
─────
  3  

instead of

(1 + 2)
───────
   3   
ArthurSonzogni commented 4 years ago

Hi KennethNielsen, Could you please take a look? This adds support for arbitrary "unparsed strings".

I will make another patch adding support for braces "{" "}". They will have roughly the same behavior as parenthesis, but won't be never be shown.

ArthurSonzogni commented 4 years ago

I think I fixed this issue. Please let me know if there are still work to do here.

KennethNielsen commented 4 years ago

That works like a charm. Thanks so much. :fireworks: