1

Like this question.

I have a similar question about that. Is there a BNF grammar for tex math expressions?

closed as unclear what you're asking by siracusa, Troy, Milo, Henri Menke, Stefan Pinnow Aug 29 '18 at 4:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    There is a grammar for the tex primitives in the texbook but not for the syntax that is allowed in tex documents including macro expansion as that can not be expressed in bnf – David Carlisle Sep 16 '16 at 13:14
  • 2
    all the discussion in the linked question to show there is no bnf for tex apply equally to math expressions, so I think that this is a duplicate. – David Carlisle Sep 16 '16 at 13:26
  • @DavidCarlisle I'm sorry about not explaining it clearly. What about if we do not consider macro expansion in the tex math expressions. It's a subset in a total tex document. – 陈家泽 Sep 16 '16 at 14:14
  • 4
    You would have to be a lot more specific as there are almost no math commands defined by default, for example \sqrt is a macro, \alpha isn't a primitive but is defined via a \mathchardef something like amsmath align is hundreds of macros implementing a custom syntax. there is nothing math-specific about tex parsing. So any answer here would apply equally to the linked question. – David Carlisle Sep 16 '16 at 14:16