Katex: Make a new release (was: \left and \right don't work in macros with arguments)

Created on 8 Jun 2017  路  7Comments  路  Source: KaTeX/KaTeX

Reproduction Step

Here's a minimal example of the problem:

macroList = {"\\mtest": "\\left[ #1 \\right]"}

s = katex.renderToString("\\mtest{x}", {macros: macroList})

should produce the result "[x]" but instead katex throws an error:

Uncaught Error: KaTeX parse error: Expected '\right', got '#' at position 8: \left[ #滩1 \right]
    at new ParseError (katex.js:547)
    at Parser.expect (katex.js:641)
    at Parser.parseImplicitGroup (katex.js:980)
    at Parser.parseAtom (katex.js:865)
    at Parser.parseExpression (katex.js:719)
    at Parser.parseInput (katex.js:683)
    at Parser.parse (katex.js:674)
    at parseTree (katex.js:8270)
    at Object.renderToString (katex.js:53)
    at katex_init.js:30

I think this might have something to do with the time at which macro arguments are actually substituted?

bug

All 7 comments

Thanks for the report! Thoughts on this, @gagern?

Our latest release, v0.7.1, doesn't contain #605 which introduced this feature. We need to roll a new release soon.

I think we should do a release once https://github.com/Khan/KaTeX/pull/670 lands.

Ah, that makes sense. I didn't find any particular documentation on macros so I think I inferred a lot of information from the github issues. I didn't realize the issue in question hadn't made it into release.

I think we should do a release once #670 lands.

@kevinbarabash release please 馃槃

This issue is resolved now, I think.

I couldn't find any tests that actually verify that this is fixed. I'm going to add a couple of tests and try to split up our tests a little more so we don't end of with all tests in katex-spec.js.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

q2apro picture q2apro  路  3Comments

trollanfer picture trollanfer  路  5Comments

oddhack picture oddhack  路  3Comments

pvnr0082t picture pvnr0082t  路  4Comments

OisinMoran picture OisinMoran  路  4Comments