You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
in command line not able to escape single quote character in mathml #444
Error: bash: syntax error near unexpected token `<'
Not able to escape single quote character node /usr/local/lib/node_modules/mathjax-node-cli/bin/mml2svg '<math><mi>μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>' > eqn.svg
Peter is correct, the problem is the internal ' which closes the initial ' being used as the quotation mark, so the rest of the MathML is being interpreted by bash as part of the command. Try
Yes, these are the issues you face when trying to pass content containing quotation marks to command-line programs. One solution would be to use single quotes for the attribute values
But you will have to modify the original string in some way if it contains both " and ' internally. Either that, or you will need to modify mml2svg in order to take its input from STDIN instead of as a parameter, for example, so that you can pass the MathML string to it directly as input rather than as a command-line parameter, which avoids the problem with command-line special characters.
In any case, none of these are problems with mathjax-node itself, but with your interaction with your command shell, so are really outside the scope of this issue tracker.
Activity
pkra commentedon Jun 27, 2019
CLI issues belong in its repository https://github.com/mathjax/mathjax-node-cli
But I suspect it's just the apostrophe in the mml expression that is closing the argument.
dpvc commentedon Jun 27, 2019
Peter is correct, the problem is the internal
'which closes the initial'being used as the quotation mark, so the rest of the MathML is being interpreted by bash as part of the command. Tryinstead.
gbala2412 commentedon Jun 27, 2019
Sorry I am already tried the double quotes also which I forgot to mention. That also throws error if the mathml contains attributes.
node /usr/local/lib/node_modules/mathjax-node-cli/bin/mml2svg "<math><mi mathvariant="normal">μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>" > eqn.svg MathML - Error parsing MathML: Unquoted attribute value Column: 66 Char: ndpvc commentedon Jun 27, 2019
Yes, these are the issues you face when trying to pass content containing quotation marks to command-line programs. One solution would be to use single quotes for the attribute values
as this is still valid MathML. Alternatively, you can replace the internal
'with′:But you will have to modify the original string in some way if it contains both
"and'internally. Either that, or you will need to modifymml2svgin order to take its input from STDIN instead of as a parameter, for example, so that you can pass the MathML string to it directly as input rather than as a command-line parameter, which avoids the problem with command-line special characters.dpvc commentedon Jun 27, 2019
In any case, none of these are problems with
mathjax-nodeitself, but with your interaction with your command shell, so are really outside the scope of this issue tracker.gbala2412 commentedon Jun 28, 2019
Thank you!