Skip to content

Commit 0868f92

Browse files
committed
PyTinyTeX v0.4.0
1 parent 86eae0f commit 0868f92

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "PyTinyTeX"
3-
version = "0.3.4"
3+
version = "0.4.0"
44
description = "Thin wrapper for \"TinyTeX\" (MIT)"
55
license = {text = "MIT"}
66
authors = [{name = "JessicaTegner", email = "[email protected]"}]

readme.md

+30-20
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,57 @@ PyTinyTeX provides a thin wrapper for [TinyTeX](https://yihui.org/tinytex), A li
1212

1313
Installation through the normal means
1414

15-
~~~
15+
§§§
1616
pip install pytinytex
17-
~~~
18-
19-
Or through poetry
20-
21-
~~~
22-
poetry add pytinytex
23-
~~~
24-
17+
§§§
2518

2619
### Installing a version of TinyTeX
2720

2821
Each version of TinyTeX contains three variations:
29-
* TinyTeX-0.* contains the infraonly scheme of TeX Live, without any LaTeX packages. If you install this variation, you may install any other packages via tlmgr (which is a utility included in this variation), e.g., tlmgr install latex-bin framed.
22+
* TinyTeX-0.* contains the infraonly scheme of TeX Live, without any LaTeX packages.
3023
* TinyTeX-1.* contains about 90 LaTeX packages enough to compile common R Markdown documents (which was the original motivation of the TinyTeX project).
3124
* 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.
3225

3326

3427
By default the variation PyTinyTeX will install is variation 1, but this can be changed.
3528

36-
~~~
29+
§§§
3730
import pytinytex
3831

39-
pytinytex.download_tinytex()
40-
~~~
32+
pytinytex.download_tinytex(variation=0)
33+
§§§
4134

4235

4336
### Getting the TinyTeX path
4437

45-
After installing TinyTeX, you can get PyTinyTeX to pick it up with the following
38+
After installing TinyTeX, you can get the path to the installed distribution with the following:
4639

47-
~~~
40+
§§§
4841
import pytinytex
4942

50-
# from the current working dir
5143
pytinytex.get_tinytex_path()
44+
# /home/jessica/.pytinytex/
45+
# c:\Users\Jessica\.pytinytex\
46+
§§§
47+
48+
### Integrating with pypandoc
49+
50+
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.
51+
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:
5252

53-
# Or from a specific starting base
54-
pytinytex.get_tinytex_path("../../")
55-
~~~
53+
§§§
54+
import pytinytex
55+
import pypandoc
56+
57+
# make sure that pytinytex is installed
58+
pytinytex.download_tinytex(variation=1)
59+
60+
# get the path to the pdflatex executable
61+
pdflatex_path = pytinytex.get_pdf_latex_engine()
5662

57-
You can then use the returned string (which is the path to the installed TinyTeX distributions "bin" directory), with other libraries or programs.
63+
# convert a markdown file to a pdf
64+
pypandoc.convert_file('input.md', 'pdf', outputfile='output.pdf', extra_args=['--pdf-engine', pdflatex_path])
65+
§§§
5866

5967

6068
### TODO
@@ -74,7 +82,9 @@ Contributions are welcome. When opening a PR, please keep the following guidelin
7482

7583

7684
### Contributors
85+
7786
* [Jessica Tegner](https://github.com/JessicaTegner) - Maintainer and original creator of PyTinyTeX
7887

7988
### License
89+
8090
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.

uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)