Skip to content
 
 

Repository files navigation

latex-parser

Generate an AST and beautify LaTeX code

latex-parser parses a typical LaTeX document and then pretty-prints it. Though parsing LaTeX isn't possible since it effectively has no grammar, latex-parser makes some practical assumptions.

How it works

latex-parser uses PEG.js to define a PEG grammar for LaTeX. LaTeX source is first parsed with this grammar. Then it is post-processed based on knowledge of special macros. (e.g., some macros are known to take an argument, like \mathbb. Such arguments are not detected in the PEG processing stage).

Development

node.js and npm are used to package and bundle latex-parser. To build the playground, run

npm install
npm run build
npm run playground

for development, you can run

webpack --watch

to automatically rebuild files as they change.

Related Projects

About

Generate an AST and beautify LaTeX code

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages