asciimath / asciimathml Goto Github PK
View Code? Open in Web Editor NEWA new home for asciimathml
Home Page: http://asciimath.org/
License: MIT License
A new home for asciimathml
Home Page: http://asciimath.org/
License: MIT License
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.
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}\%
Another note. https://github.com/learningobjectsinc/mathml-to-asciimath follows an interesting idea -- converting (a subset of) MathML back to asciimath notation.
It reminds me of HTML to markdown converters (which work surprisingly well) and could prove very useful.
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?
There are 3 options:
z_0'
z'_0
z_0^'
Although alternative 3. looks the best, 2. seems to be the most reasonable approach to me.
What do you think?
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).
This came already up before, but we didn't really make a decision…
I think we should move it to focus all repositories in one place!
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(/</g,"<");
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.
Both of these are causing a javascript error.
Bug report and proposed solution via lwz on Google Groups.
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)}
Could this be a bug or is there something incorrect in the asciimath ?
there is no triangle symbol
you can use /_\ or simply tri
Delta is a bit different
Not an issue, just a note. In case you don't know it, https://github.com/psalaets/ascii-math is a nodejs package based on asciimath. It would be worthwhile to connect up to reduce fragmentation (e.g., ForbesLindesay/ascii-math#1)
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.
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
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?
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},
Any interest in implementing a test suite?
There is currently no support for in asciimath for rendering an augmented matrix. This would be useful for showing something like Gauss-Jordan elimination.
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.
In ASCIIMath, how can I write extensible right arrow as in LaTeX. rarr does not work. Likewise, is there an ASIIMath equivalent of widehat? Thanks..Saf
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 ?
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
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.
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):
I can make a PR if you think it's useful.
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.
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.
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?
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") {
There seems to be some uncertainty whether it's "lamda" or "lambda".
http://www.danielmoth.com/Blog/lambda-vs-lamda.aspx
So I guess we should support both spellings!
What do you think?
{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
U+025B is ɛ (latin epsilon), not
<!ENTITY varepsilon "ϵ" ><!--GREEK LUNATE EPSILON SYMBOL -->
as it should be?
I think underbraces should be part of core AsciiMath.
This was already discussed in this issue: mathjax/MathJax#741
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.
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:
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.
What is the proper MathML and TeX to render the vector norm?
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?
This was filed on the MathJax end at mathjax/MathJax#1245.
Quote:
It seems to cause Math processing error whenever the pair of brackets
{: :}
is wrapped in another > pair of brackets{: :}
, and is the only thing in that bracket.Examples:
not ok {: {::} :} not ok {: {: :} :} ok {: {: something :} :} ok {: {: :} something :}
See also @dpvc's comments regarding https://github.com/mathjax/MathJax/blob/master/unpacked/jax/input/AsciiMath/jax.js#L1064
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?
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 ?
While trying to create this equation..
I noticed no matter my syntax, I could not get the summation to render properly..
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!
A user reported issues when augmenting asciimath with a phantom macro.
On IE11, it looks like the to
in phantom
is picked up first, disabling the phantom
macro.
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");
Is there a shorthand way to display asciimath on a separate line like
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:
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.
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.
The code bb " text"
causes a Math Processing Error in MathJax, with the error being
Error: 'null' is not an object (evaluating 'ai.firstChild.firstChild.nodeValue')
See the issue at mathjax/MathJax#883 for details.
Currently the matrix notation cannot be used to enter row vectors, like [(2,3,4)], since the matrix code requires more than 1 row.
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!
I was just wondering if there should be a special keyword for the imaginary unit to separate it from a variable i
to improve the semantic of expressions?
I was thinking of ii
or iu
for imaginary unit.
There also seems to be a special unicode character: http://fileformat.info/info/unicode/char/2148/index.htm
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 "∧" ><!--LOGICAL AND -->
and
<!ENTITY or "∨" ><!--LOGICAL OR -->
ie. the same as vv
/wedge
and ^^
/vee
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.