You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+30-20
Original file line number
Diff line number
Diff line change
@@ -12,49 +12,57 @@ PyTinyTeX provides a thin wrapper for [TinyTeX](https://yihui.org/tinytex), A li
12
12
13
13
Installation through the normal means
14
14
15
-
~~~
15
+
§§§
16
16
pip install pytinytex
17
-
~~~
18
-
19
-
Or through poetry
20
-
21
-
~~~
22
-
poetry add pytinytex
23
-
~~~
24
-
17
+
§§§
25
18
26
19
### Installing a version of TinyTeX
27
20
28
21
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.
30
23
* TinyTeX-1.* contains about 90 LaTeX packages enough to compile common R Markdown documents (which was the original motivation of the TinyTeX project).
31
24
* 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.
32
25
33
26
34
27
By default the variation PyTinyTeX will install is variation 1, but this can be changed.
35
28
36
-
~~~
29
+
§§§
37
30
import pytinytex
38
31
39
-
pytinytex.download_tinytex()
40
-
~~~
32
+
pytinytex.download_tinytex(variation=0)
33
+
§§§
41
34
42
35
43
36
### Getting the TinyTeX path
44
37
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:
46
39
47
-
~~~
40
+
§§§
48
41
import pytinytex
49
42
50
-
# from the current working dir
51
43
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:
52
52
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()
56
62
57
-
You can then use the returned string (which is the path to the installed TinyTeX distributions "bin" directory), with other libraries or programs.
@@ -74,7 +82,9 @@ Contributions are welcome. When opening a PR, please keep the following guidelin
74
82
75
83
76
84
### Contributors
85
+
77
86
*[Jessica Tegner](https://github.com/JessicaTegner) - Maintainer and original creator of PyTinyTeX
78
87
79
88
### License
89
+
80
90
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.
0 commit comments