Skip to content

pie-framework/latex-parser

 
 

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 54.7%
  • TypeScript 43.0%
  • CSS 1.5%
  • HTML 0.8%