Skip to content

Hemanthkumar2112/PyTinyTeX

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTinyTeX

Build Status PyPI version Development Status Python version License

PyTinyTeX provides a thin wrapper for TinyTeX, a lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live.

Installation

Install PyTinyTeX using pip:

pip install -U pytinytex
import pytinytex pytinytex.download_tinytex(variation=0) # Installs TinyTeX-0.*

Parameters:

  • version (str): Specify the TinyTeX version to install. Use "latest" for the most recent version or a specific. Default is "latest". For reference https://github.com/rstudio/tinytex-releases.

  • variation (int): Choose the variant of TinyTeX to install:

    • 0: Contains the infraonly scheme of TeX Live, without any LaTeX packages.

    • 1(Default) : Contains approximately 90 LaTeX packages, sufficient for compiling common R Markdown documents (the original motivation behind TinyTeX).

    • 2: Contains a more extensive set of LaTeX packages requested by the community. The package list may grow over time, increasing the variation's size.

Getting the TinyTeX Path

After installation, retrieve the path to your TinyTeX distribution:

import pytinytex path = pytinytex.get_tinytex_path() print(path) # Example Output (platform dependent): # /home/jessica/.pytinytex/ (Linux/macOS) # c:\Users\Jessica\.pytinytex\ (Windows)

Integrating with pypandoc

PyTinyTeX seamlessly integrates with pypandoc, a Python wrapper for Pandoc, enabling document conversion between various formats, including LaTeX to PDF. To leverage PyTinyTeX with pypandoc, especially when working with LaTeX or PDF documents, provide pypandoc with the path to pdflatex (included in variation 1 and above):

# Get the path to the pdflatex executable pdflatex_path = pytinytex.get_pdf_latex_engine() # Convert a Markdown file to 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

License

PyTinyTeX is licensed under the MIT License. See LICENSE for details. TinyTeX itself is licensed under the GPL-2 license.

About

Thin wrapper for "TinyTeX" (MIT)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%