GithubHelp home page GithubHelp logo

asciimathml's People

Contributors

ad-si avatar alaasdk avatar anton-zamniborshch avatar doersino avatar drlippman avatar javarome avatar jipsen avatar lesik avatar niedzielski avatar pkra avatar sophiebits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciimathml's Issues

phi / varphi

AsciiMath's symbols for phi and varphi are opposite of TeX's symbols for the same names.

This was changed by default in MathJax (issue mathjax/MathJax#353). Should we do the same here? Like Davide did in the MathJax, we could add a config flag to revert it back to the original behavior if desired.

Percentage sign incorrect transformed to LaTeX

I just noticed that the following formula is incorrect transformed from AsciiMath to LaTeX:

AMTparseAMtoTeX('99,9~~100 %') ---> {99,9}\approx{100}%

Which, as far as I know is incorrect and should have been:

{99,9}\approx{100}\%

asterisk vs. star

I was wondering why ** translates to the latex equivalent of \star? Shouldn't it rather be \ast.
Otherwise we should introduce a new operation symbol for it, because I think asterisk is a pretty important symbol. (At least I use it a lot …)
What do you think?

Right way to write z' index 0

There are 3 options:

  1. z_0'
  2. z'_0
  3. z_0^'

Although alternative 3. looks the best, 2. seems to be the most reasonable approach to me.
What do you think?

Handling whitespaces

Hi,

Is there any specific reasons to handle coscos as cos cos?

This is not of very great importance, but writing without whitespaces is a pain for readability and introduces a difference between things like cosx (the cosine of x variable) and cosh (the hyperbolic cosine function).

entities in math

When using AsciiMathML with editors like TinyMCE, I've run into issues with entities like   or < ending up in the string that AsciiMath has to parse. I would encourage adding, in the top of the parseMath function, some basic cleanup:

str = str.replace(/ /g,"");
str = str.replace(/>/g,">");
str = str.replace(/&lt;/g,"<");

define vs newcommand?

Does anyone (maybe @jipsen) know why AsciiMath has both define and newcommand, which do exactly the same thing in the code? It appears that newcommand has been around since 1.4.7, but define was added later.

Possible incorrect usage of \matrix

I have the following formula

((2-2); (0-1,5)) = (0 ; text(-)1,5)

When I convert this to latex I get:

{\left(\matrix{{2}-{2}\right)};{\left({0}-{1,5}}\right)}={\left({0};\text{-}{1,5}\right)}

Which is incorrect, and should be

{\left(\matrix{2}-{2}\right)};{\left({0}-{1,5}\right)}={\left({0};\text{-}{1,5}\right)}

math

Could this be a bug or is there something incorrect in the asciimath ?

triangle symbol

there is no triangle symbol
you can use /_\ or simply tri
Delta is a bit different

rendering of log_2(3)/5

This isn't so much a bug as a desired enhancement.

Currently log_2(3)/5 renders equivalent to log_2(3/5), rather than the desired (log_2(3))/5. This is because the func:true handling considers the _2 as the unary argument for the log symbol, and ignores the (3).

I don't know if there is an elegant language-based approach to address this, or whether this requires an extended hack, like the original func:true.

What's ASCIIMath equivalent of coprod

I tried coprod_1^n but it does not work. It displays two letters co along with math expression for prod_1^n. I'm using MathJax via CDN as:
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full"></script>
Thanks..Saf

Treat $ as part of a constant

Right now $5/3 displays as \$ \frac{5}{3}. It seems like it'd be nice to have a $ followed by numbers or letters be treated as part of that constant, so $5/3 would display as \frac{\$5}{3}.

Does anyone see any issues with this? Does $ have some mathematical usage I'm not aware of that would make this problematic?

Use of the tex property in the AMsymbols object (array)

In ASCIIMathML.js file some tex property values below are clear to me: For example in the following portion of the AMsymbols, inputs alpha , beta, ...,delta in the ASCIIMathML mode will be same as in the tex mode but the input epsi in the ASCIIMathML mode is epsilon in tex mode. I assumes text:null means the ASCIIMathMl input and the text inputs are the same.

But for the case of "Lim" shown under "standard functions" below, the "Lim" does not work in the text mode. I may be misunderstanding the tex property defined in the AMsymbols. Please help. Thanks..Saf

var AMsymbols = [
//some greek symbols
{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},
{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},
............
//standard functions
{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},
{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},

testing

Any interest in implementing a test suite?

asciimath support for augmented matrix

There is currently no support for in asciimath for rendering an augmented matrix. This would be useful for showing something like Gauss-Jordan elimination.

Spacing of negative inside parens

The spacing between the negative sign and the number is incorrect when the negative is preceeded by a parenthesis. For example in (-3,6), the negative is spaced like subtraction, like in 5-3, rather than the tighter spacing in -3

From a quick glance, it looks like the TeX renderer uses − rather than - for the negative sign; I'm presuming this is what's causing the different spacing.

We might want to see if we can find a way to distinguish in the AM parser between subtraction and a negative symbol so we can mimic the spacing of the TeX renderer.

Rendering bug

{w | w in {a, b}^+, |w|_a = |w|_b}

this code yields to

screen shot 2014-06-30 at 16 33 47

Any idea how this can be fixed?

Incorrect transform of ]

Consider the following AsciiMath formula

⟨text(-)2 , 4 ]

Now if I transform it as follows:

AMTparseAMtoTeX('⟨text(-)2 , 4 ]')
--> ⟨\text{-}{2},{4}{\]}

Now, the issue here is the \], which should be (I think) just ]. The problem is that MathJax renders the slash. Is this a transform issue ?

Question: is there an api to convert from asciimath to latex?

Ahoy! We love asciimath! Great work, and thank you!

Your API is great for converting from asciimath to a rendered equation, but we already have a latex renderer that we're quite happy with, and we'd like to first convert asciimath to latex and then use our existing renderer to get an image from that latex. Do you expose a way to just do the parsing of asciimath & conversion to latex?

Thanks for your great work and for any additional help you have time for! :D

improving MathML output for bevelled fractions

I've noticed that a\\b produces something like <mi>a</mi><mo>/</mo><mi>b</mi>. It seems to me it would be better to produce <mfrac bevelled="true"><mi>a</mi><mi>b</mi></mfrac> instead.

Suggestions

Hello,
I have just added/modified two keywords/symbols that I needed and I thought that might interest you:

Here is the code I used:

MathJax.Hub.Register.StartupHook("AsciiMath Jax Config",function () {
  var AM = MathJax.InputJax.AsciiMath.AM;
  for (var i = 0; i < AM.symbols.length; i++) {
    if (AM.symbols[i].input == "->") {
      AM.symbols[i].ttype = AM.TOKEN.UNDEROVER
    }
  }
  AM.symbols.push(
    {input:"~",  tag:"mo", output:"\u223C", tex:null, ttype: AM.TOKEN.UNDEROVER}
  );
});

This allows for those uses (the 2nd and 4th were not possible):

capture d ecran 2015-01-15 a 17 42 12

I can make a PR if you think it's useful.

Extension request: (:A:| Bra and ket |:B:) vector support with new space-less separator :| and |: and :|: (use << and >> for regular angle bracketing)

This looks fine:
|A:)(:A|

This doesn't:

|A:)(:A| * 1/2

because the parser thinks the last (: opens a bracket that is not closed and includes all the rest in the sizing.

However, you have both (: ... :) and << ... >> (undocumented) for the same angle bracketing:

{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, 
{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, 
{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, 
{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, 

I suggest you use "(:" and ":)" together with a new ":|", "|:" or ":|:" for bra and ket vectors with no spacing, where a "(:" is closed by ":|", while a "|:" is closed by ":)" and keep "<<" and ">>" for regular bracketing, like so:

(:A:| (bra)
|:B:) (ket)
(:A:|:B:) (bra-ket)
(:A:|:B:|:C:) (sandwich)

This notation is important for quantum physics.

The pipe | is currently treated as a matrix column separator, making it look very ugly when using it for bras and kets unless one modifies the stylesheet, which then tampers with the whole absolute positioning. The only way currently is to separate all expressions in order to reset the sizing.

Thanks for listening.

unicode symbol for @

AsciiMathML is currently using U+26AC for the @ symbol (latex: \circ), when it probably should be using U+2218, which is intended for the ring operator.

In MathJax, the U+26AC symbol doesn't seem to reliably display with the webfonts.

Capitalized functions

AsciiMath does case-sensitive matching on symbols, so Sin(x) gets interpreted as S in (x) rather than sin(x).

I'm guessing that adding the capitalized functions to the symbols list is the simplest solution, as dealing with case in AMgetSymbols would be tricky (since case does matter with some symbols like Delta and delta).

Does anyone have a better idea? Or are others OK with me adding capitalized functions to the symbol list?

removeBrackets

I wish I could remember exactly why I added this. I think it was to deal with an issue with MathML inside TinyMCE. Basically, in the AMremoveBrackets() function, I found I needed to use

if (node.nodeName=="mrow" || node.nodeName=="M:MROW") {

instead of just

if (node.nodeName=="mrow") {

varepsilon

{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},

U+025B is ɛ (latin epsilon), not

<!ENTITY varepsilon       "&#x003F5;" ><!--GREEK LUNATE EPSILON SYMBOL -->

as it should be?

Separate DOM & init from text processing in asciimath-based/ASCIIMathTeXImg.js

Ahoy! We are going to try to use your text processing functions in https://github.com/asciimath/asciimathml/blob/master/asciimath-based/ASCIIMathTeXImg.js in a few different environments, including in a DOMless node.js app. To that end, we're going to separate out the DOM-related components (which we don't need) and the auto-loading code.

Would you like a PR back with these changes, or does this break your API too much? We could try to preserve the API by making the default behavior the same, but I imagine we will at least have to force the user to manually call initialization code (maybe that's the user's responsibility anyway?).

Thanks again for an amazing library! We are looking forward to using it.

Vector norm

I am teaching linear algebra this term, and just realized there isn't a symbol for vector norm in asciimath. I'm happy to add it to the code, but need some input:

  1. What should the asciimath symbol be? While ||x|| would be intuitive, I think it would be difficult to implement. I'm tempted to use a unary like norm(x) instead.

  2. What is the proper MathML and TeX to render the vector norm?

Website for AsciiMath

Now that asciimath has finally it's own repo, I was thinking it would be great if asciimath also had its own website.
For example asciimath.org would still be available.
I'd be happy to help you build the website!
We could host it via github pages in it's own repo e.g mathjax/asciimath.org
What do you think?

spaces

Maybe this is not an issue, but my misunderstanding of spaces in asciimath.

Consider the following AsciiMath formulas

`= 30\ 10`
`\ 30\ 10`

Now, if I run these through AMTparseAMtoTeX I get the following out

'={30}{10}'
'={30}{10}'

Is there something wrong with the spaces (I've also tried adding 2 \) Or is the space ignored by this converter for some reason?

AMTparseAMtoTeX issue: Incorrect transformation of `a // b` to Latex

I'm using ASCIIMathTeXImg.js to transform AsciiMath to Latex (or Tex)

AMTparseAMtoTeX('a // b');

This global function works pretty wel, but with fractions like

a // b

which is valid AsciiMath it seems to go wrong. AMTparseAMtoTeX transforms this to:

{a}\//{b}

Which is incorrect. Instead (I think) it should have been transformed to

a/b

Is this a bug or is there something I do wrong here ?

One other thing, I sometimes get the following error in the console:

Uncaught ReferenceError: AMTcgiloc is not defined

What might be the cause of this error ?

Summation rendering issue

While trying to create this equation..
image

I noticed no matter my syntax, I could not get the summation to render properly..
image

This is my formula in Asciimath:
EF_(N2O) = (sum_1^n (C_(N2O) ** 1.826 xx 10^(-6) ** Q) /P) /n

Every time I try to add parentheses to the numerator and denominators to section them off, the characters "n" and "1" are shifted to the side rather than remaining on the top and bottom of the Sigma character.

I am not sure if this is a syntax issue on my part or if it is perhaps a bug!

IE9

The IE detection line

var isIE = document.createElementNS==null;

should probably be updated, since IE9 does have the createElementNS function, and MathPlayer still works in IE9 (it does not, yet, work in IE10+, and at this point I'm doubtful it will happen)

While feature detection is usually better, in this case it might be safer to just use

var isIE = (navigator.appName.slice(0,9)=="Microsoft");

No access to AMprocessNode, newcommand, etc.

The closure in ASCIIMathML.js blocks access to translate(), AMprocessNode(), newcommand(), etc.

Access to some of these functions are required for a dynamic website to operate effectively. The question is how we want to address this:

  1. Expose the functions: window.translate = translate, etc. The upside is that any existing dynamic applications will just work with the new version, no retooling necessary. The downside is that we're invading the global namespace with some fairly generic function names.

  2. Create a global ASCIIMATH object (or AM or AMML), and attach the functions to that object. That way we're only adding one new global object to the namespace. Existing apps will need to be retooled.

Row vectors

Currently the matrix notation cannot be used to enter row vectors, like [(2,3,4)], since the matrix code requires more than 1 row.

Column vectors vs matrices

Hi,

I do not really get the difference between "column vectors" and "matrices" in http://asciimath.org/. For me, it seems both methods and inputs (((a,b),(c,d)) and [[a,b],[c,d]]) give the same result which is to define the

a b
c d

matrix.

However, according to the doc (and especially the "column vector" keyword), I would have expected it to be [[a,b],[c,d]] and ((a,c), (b,d)) (note the input as column vectors) to have the previous matrix. However, I am not sure having two different syntaxes for matrices input is a good idea though, and maybe the best solution is simply to update the doc?

Thanks!

Logical symbols "and" and "or"

Why is the logical symbols "and and "or"

{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
{input:"or",  tag:"mtext", output:"or",  tex:null, ttype:SPACE},

and not

<!ENTITY and              "&#x02227;" ><!--LOGICAL AND -->

and

<!ENTITY or               "&#x02228;" ><!--LOGICAL OR -->

ie. the same as vv/wedge and ^^/vee?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.