asciidoctor / asciimath

Asciimath parser
MIT License
24 stars 16 forks source link

Anomalies in symbols table #41

Closed davidfarmer closed 4 years ago

davidfarmer commented 4 years ago

This refers to the symbols table in AST.adoc .

For example, the first of these two lines presumably should end in sinh:

sinh | :sinh |   | Sinh
Sinh | :Sinh |   | Sinh

There are some other similar examples (Cosh, Tanh, Coth, Sech, Csch)

And the capitalization at the end of this line does not make sense to me:

arcsin | :arcsin |   | ARCsin

Some rows in that table have math which does not make sense to me: Lim (what is lim with a capital L?) FLoor (F and L are capital) Norm, Ceil (again, why capital?) same for the 7 lines from Sqrt to UNder

Is there an official reference to what should be in that table? That might help me understand which of the above are errors and which are intentional. If this is meant as an alternate representation of the data in the AMsymbols of ASCIIMathML.js , then that explains some of my questions.

pepijnve commented 4 years ago

This is probably my fault. I wrote a little script to generate that table, but the script doesn’t handle asciidoc escaping. I had to manually tweak it and probably made some mistakes.

The source formulated table is split into two locations. The parser uses the table that’s declared at https://github.com/asciidoctor/asciimath/blob/master/lib/asciimath/parser.rb#L204 That table maps text input to Ruby symbols (constants). The MathML and HTML backend uses https://github.com/asciidoctor/asciimath/blob/master/lib/asciimath/markup.rb#L12 That table maps the Ruby symbols to the appropriate tag and value in MathML.

The script that generated the AST.adoc table is https://github.com/asciidoctor/asciimath/blob/master/dump_symbol_table.rb

pepijnve commented 4 years ago

@davidfarmer I tweaked dump_symbol_table a bit so that the manual massaging is no longer necessary. The table in AST.adoc is now derived directly from the source code. Note that this only reflects the MathML/HTML rendering. The LaTeX backend uses its own rendering table located at https://github.com/asciidoctor/asciimath/blob/master/lib/asciimath/latex.rb#L23

GarkGarcia commented 4 years ago

@davidfarmer I tweaked dump_symbol_table a bit so that the manual massaging is no longer necessary. The table in AST.adoc is now derived directly from the source code. Note that this only reflects the MathML/HTML rendering. The LaTeX backend uses its own rendering table located at https://github.com/asciidoctor/asciimath/blob/master/lib/asciimath/latex.rb#L23

Indeed. I was thinking we could include it in SymbolsTable. @pepijnve Do you think it's a good idea?

pepijnve commented 4 years ago

Sure why not. Feel free to tweak the dump script to add a column for the LaTeX output.

pepijnve commented 4 years ago

The table has been updated to reflect what's actually in the code.