gjtorikian / mtex2MML

A Bison grammar to convert TeX math into MathML.
23 stars 14 forks source link

Strict inequalities? #45

Closed edborden closed 8 years ago

edborden commented 8 years ago

\textgreater, \textless aren't on the supported list, and don't work

\> produces just a blank space for me, although it is on the support list

<,>,\< all produce "Unknown character", and are not on the list

There seem to be many more obscure symbols involving inequalities on the list that do work, but none of them are just the vanilla < >... Am I missing something?

edborden commented 8 years ago

@gjtorikian Any thoughts on this? I'm just curious how big of a hurdle this is..

gjtorikian commented 8 years ago

I just got back from a vacation, I'll try to look at it soon. I would like this lib to support as much legit maths as possible.

freron commented 8 years ago

I'm having the same issue using the command line tool. Here is an example:

printf "a < 5" | ./mtex2MML --inline
<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><semantics><mrow><mi>a</mi><merror><mtext>Unknown character</mtext></merror><mn>5</mn></mrow><annotation encoding='application/x-tex'>a &lt; 5</annotation></semantics></math>

Note the “Unknown character” in the output. Am I doing something wrong?

This is on OS X El Capitan in case it makes a difference.

Thanks for creating this tool!

freron commented 8 years ago

Thanks for the quick update! My example above now works, but if I remove the whitespace then it still fails:

printf "a<5" | ./mtex2MML --inline
gjtorikian commented 8 years ago

Yes, I'm afraid that's intentional for now.

Part of mtex2MML's goal is to leave tags alone as it processes text. There's a test to check for this:

Inline: $\sin(x)$
Block: $$\sin(x)$$
Markup: $$<em>\sin(x)</em>$$

Unfortunately I had to force the lexer to expect whitespace on either side of > / < to allow HTML markup to passthrough unignored. It's not ideal but I felt it better to support these characters first than to not allow them at all.

freron commented 8 years ago

I see. Would it be futile to create a feature request for making this behavior optional?

gjtorikian commented 8 years ago

Not futile at all!