https://github.com/jessicategner/pytinytex
Thin wrapper for "TinyTeX" (MIT)
https://github.com/jessicategner/pytinytex
formatting hacktober hacktober2022 latex pandoc pdf pdflatex pypandoc python pytinytex tinytex
Last synced: 6 months ago
JSON representation
Thin wrapper for "TinyTeX" (MIT)
- Host: GitHub
- URL: https://github.com/jessicategner/pytinytex
- Owner: JessicaTegner
- License: mit
- Created: 2021-12-19T00:24:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-23T15:01:49.000Z (8 months ago)
- Last Synced: 2025-03-23T01:36:02.998Z (7 months ago)
- Topics: formatting, hacktober, hacktober2022, latex, pandoc, pdf, pdflatex, pypandoc, python, pytinytex, tinytex
- Language: Python
- Homepage:
- Size: 26.5 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# PyTinyTeX

[](https://pypi.python.org/pypi/PyTinyTeX/)
[](https://pypi.python.org/pypi/PyTinyTeX/)
[](https://pypi.python.org/pypi/PyTinyTeX/)
PyTinyTeX provides a thin wrapper for [TinyTeX](https://yihui.org/tinytex), A lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live.
### Installation
Installation through the normal means
§§§
pip install pytinytex
§§§### Installing a version of TinyTeX
Each version of TinyTeX contains three variations:
* TinyTeX-0.* contains the infraonly scheme of TeX Live, without any LaTeX packages.
* TinyTeX-1.* contains about 90 LaTeX packages enough to compile common R Markdown documents (which was the original motivation of the TinyTeX project).
* TinyTeX-2-* contains more LaTeX packages requested by the community. The list of packages may grow as time goes by, and the size of this variation will grow correspondingly.By default the variation PyTinyTeX will install is variation 1, but this can be changed.
§§§
import pytinytexpytinytex.download_tinytex(variation=0)
§§§### Getting the TinyTeX path
After installing TinyTeX, you can get the path to the installed distribution with the following:
§§§
import pytinytexpytinytex.get_tinytex_path()
# /home/jessica/.pytinytex/
# c:\Users\Jessica\.pytinytex\
§§§### Integrating with pypandoc
PyTinyTeX can be used with [PyPandoc](https://pypi.org/project/pypandoc/), a Python wrapper for Pandoc. PyPandoc can be used to convert documents between different formats, including LaTeX to PDF.
To use PyTinyTeX with pypandoc, when working with latex or pdf documents, you need to give pypandoc the path the pdflatex (included with variation 1 and above), like the ofllowing:§§§
import pytinytex
import pypandoc# make sure that pytinytex is installed
pytinytex.download_tinytex(variation=1)# get the path to the pdflatex executable
pdflatex_path = pytinytex.get_pdf_latex_engine()# convert a markdown file to a pdf
pypandoc.convert_file('input.md', 'pdf', outputfile='output.pdf', extra_args=['--pdf-engine', pdflatex_path])
§§§### TODO
* Write docs, since this looks to be a bigger wrapper than PyPandoc
* Wrap the tlmgr interface
* Wrap the PDFLatex engine### Contributing
Contributions are welcome. When opening a PR, please keep the following guidelines in mind:
1. Before implementing, please open an issue for discussion.
2. Make sure you have tests for the new logic.
3. Add yourself to contributors at README.md unless you are already there. In that case tweak your### Contributors
* [Jessica Tegner](https://github.com/JessicaTegner) - Maintainer and original creator of PyTinyTeX
### License
PyTinyTeX is available under MIT license. See [LICENSE](https://raw.githubusercontent.com/JessicaTegner/PyTinyTeX/master/LICENSE) for more details. TinyTeX itself is available under the GPL-2 license.