https://github.com/allofphysicsgraph/latex-example-expressions
test of latex as parsed by Sympy
https://github.com/allofphysicsgraph/latex-example-expressions
latex sympy
Last synced: 10 months ago
JSON representation
test of latex as parsed by Sympy
- Host: GitHub
- URL: https://github.com/allofphysicsgraph/latex-example-expressions
- Owner: allofphysicsgraph
- License: cc0-1.0
- Created: 2020-04-06T20:57:12.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-05-09T02:04:09.000Z (about 1 year ago)
- Last Synced: 2025-05-09T02:39:35.930Z (about 1 year ago)
- Topics: latex, sympy
- Language: TeX
- Homepage:
- Size: 521 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Explanation of files in this repo:
# manually created files
The folder `examples_of_valid_latex` contains manually created valid Latex expressions, one per file:
`examples_of_valid_latex/*_expression_latex.tex`
For each Latex expression there's also a manually created set of expected symbols:
`examples_of_valid_latex/*_expected_tokens.tex`
TODO: complete the manual specification of expected symbols.
# aggregation file
The file `examples_of_valid_latex/main.tex` aggregates all the other `*.tex` files into one PDF that a user can then manually review. (`main.tex` was partially generated by `generate_main.py`.)
# generated file content
## raw Latex expression parsed using SymPy 1.12 with antlr4-python3-runtime 4.11
The content for each file
`examples_of_valid_latex/*_expression_latex_sympy_112_antlr4-python3-runtime411_expression.tex`
was generated using
```bash
docker run -it --rm -v `pwd`:/scratch --workdir /scratch sympyonubuntu python3 sympy_from_latex.py
```
Similarly, the content for each file
`examples_of_valid_latex/*_expression_latex_sympy_112_antlr4-python3-runtime411_atoms.tex`
also comes from that same `.py` script.
## clean Latex expression parsed using SymPy 1.12 with antlr4-python3-runtime 4.11
Sometimes the reason SymPy fails to parse successfully is due to presentation-related spacing.
By removing the non-essential spacing marks, SymPy is more likely to succeed.
The file
`examples_of_valid_latex/*_cleaned_latex.tex`
is the cleaned version of
`examples_of_valid_latex/*_expression_latex.tex`
The command used was
```bash
python3 clean_latex_expressions.py
```
Then SymPy 1.12 with antlr4-python3-runtime 4.11 is used on
`examples_of_valid_latex/*_cleaned_latex.tex`
to generate
`examples_of_valid_latex/*_cleaned_latex_sympy_112_antlr4-python3-runtime411_expression.tex`
and
`examples_of_valid_latex/*_cleaned_latex_sympy_112_antlr4-python3-runtime411_atoms.tex`
The command is
```bash
docker run -it --rm -v `pwd`:/scratch --workdir /scratch sympyonubuntu python3 sympy_from_latex.py
```
That docker image is from
# context
This repo content is related to
and
For the comprehensive list of Latex symbols, see
and
for AMSmath, see