jettex¶
The main module that exports all public functions and classes.
Usage¶
import jettex
# All functions are available directly
jettex.install_tinytex()
jettex.compile_tex("document.tex")
Exports¶
Installation¶
Download and install TinyTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
int
|
TinyTeX version to install - 0: infraonly (minimal, no packages) - 1: default (~90 packages for common documents) - 2: extended (more packages) |
1
|
install_dir
|
Optional[Path]
|
Custom installation directory (default: platform-specific) |
None
|
force
|
bool
|
Force reinstall even if already installed |
False
|
add_path
|
bool
|
Add TinyTeX bin to PATH |
True
|
progress_callback
|
Optional[Callable[[str, int, int], None]]
|
Optional callback(stage, downloaded, total) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
Installation directory |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If installation fails |
Source code in jettex/install.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
Uninstall TinyTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_dir
|
Optional[Path]
|
Installation directory to remove (default: detect automatically) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if uninstalled successfully |
Source code in jettex/install.py
Get the TinyTeX installation root directory.
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path or None: Installation directory if found |
Get the installed TinyTeX/TeX Live version.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
str or None: Version string if available |
Compilation¶
Compile a LaTeX file using pdflatex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Union[str, Path]
|
Path to .tex file |
required |
output_dir
|
Optional[Union[str, Path]]
|
Directory for output files |
None
|
interaction
|
str
|
Interaction mode |
'nonstopmode'
|
synctex
|
bool
|
Enable SyncTeX |
False
|
shell_escape
|
bool
|
Enable shell escape |
False
|
extra_args
|
Optional[List[str]]
|
Additional arguments |
None
|
quiet
|
bool
|
Suppress output |
False
|
timeout
|
Optional[int]
|
Compilation timeout in seconds |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CompileResult |
CompileResult
|
Compilation result |
Example
result = pdflatex("document.tex") if result.success: ... print(f"PDF created: {result.output_file}")
Source code in jettex/compile.py
Compile a LaTeX file using xelatex.
XeLaTeX supports OpenType fonts and Unicode natively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Union[str, Path]
|
Path to .tex file |
required |
output_dir
|
Optional[Union[str, Path]]
|
Directory for output files |
None
|
interaction
|
str
|
Interaction mode |
'nonstopmode'
|
synctex
|
bool
|
Enable SyncTeX |
False
|
shell_escape
|
bool
|
Enable shell escape |
False
|
extra_args
|
Optional[List[str]]
|
Additional arguments |
None
|
quiet
|
bool
|
Suppress output |
False
|
timeout
|
Optional[int]
|
Compilation timeout in seconds |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CompileResult |
CompileResult
|
Compilation result |
Source code in jettex/compile.py
Compile a LaTeX file using lualatex.
LuaLaTeX provides Lua scripting and OpenType font support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Union[str, Path]
|
Path to .tex file |
required |
output_dir
|
Optional[Union[str, Path]]
|
Directory for output files |
None
|
interaction
|
str
|
Interaction mode |
'nonstopmode'
|
synctex
|
bool
|
Enable SyncTeX |
False
|
shell_escape
|
bool
|
Enable shell escape |
False
|
extra_args
|
Optional[List[str]]
|
Additional arguments |
None
|
quiet
|
bool
|
Suppress output |
False
|
timeout
|
Optional[int]
|
Compilation timeout in seconds |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CompileResult |
CompileResult
|
Compilation result |
Source code in jettex/compile.py
Compile a LaTeX file using latexmk.
latexmk automatically runs the correct number of compilations and handles bibliography/index generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Union[str, Path]
|
Path to .tex file |
required |
output_dir
|
Optional[Union[str, Path]]
|
Directory for output files |
None
|
engine
|
str
|
Backend engine (pdflatex, xelatex, lualatex) |
'pdflatex'
|
clean
|
bool
|
Clean auxiliary files after compilation |
False
|
continuous
|
bool
|
Continuous compilation mode (watch for changes) |
False
|
extra_args
|
Optional[List[str]]
|
Additional arguments |
None
|
timeout
|
Optional[int]
|
Compilation timeout in seconds |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CompileResult |
CompileResult
|
Compilation result |
Source code in jettex/compile.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
Clean auxiliary files from LaTeX compilation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Union[str, Path]
|
Path to .tex file |
required |
output_dir
|
Optional[Union[str, Path]]
|
Directory containing auxiliary files |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Number of files removed |
Source code in jettex/compile.py
Package Management¶
Install LaTeX packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
packages
|
List[str]
|
List of package names to install |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if installation succeeded |
Example
tlmgr_install(['amsmath', 'geometry'])
Source code in jettex/tlmgr.py
Remove LaTeX packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
packages
|
List[str]
|
List of package names to remove |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if removal succeeded |
Source code in jettex/tlmgr.py
Update LaTeX packages or tlmgr itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
packages
|
Optional[List[str]]
|
Specific packages to update (optional) |
None
|
all_packages
|
bool
|
Update all installed packages |
False
|
self_update
|
bool
|
Update tlmgr itself |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if update succeeded |
Source code in jettex/tlmgr.py
List packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
only_installed
|
bool
|
Only list installed packages |
True
|
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Package names |
Source code in jettex/tlmgr.py
Search for packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query (package name or filename) |
required |
file_search
|
bool
|
Search by filename instead of package name |
False
|
global_search
|
bool
|
Search all available packages, not just installed |
True
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, str]]
|
List of dicts with 'package' and optionally 'file' keys |
Source code in jettex/tlmgr.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
Get information about a package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package
|
str
|
Package name |
required |
Returns:
| Type | Description |
|---|---|
Optional[Dict[str, Any]]
|
Dict with package info or None if not found |
Source code in jettex/tlmgr.py
Find which package provides a file.
This is the key function for auto-installing missing packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
File to search for (e.g., 'geometry.sty') |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
str or None: Package name that provides the file |
Source code in jettex/tlmgr.py
Utilities¶
Check if TinyTeX is installed.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if TinyTeX is installed and usable |
Source code in jettex/utils.py
Ensure TinyTeX bin directory is in PATH.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if TinyTeX is available in PATH |
Source code in jettex/utils.py
Get the TinyTeX bin directory containing executables.
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path or None: bin directory if found |
Source code in jettex/utils.py
Get the path to a TinyTeX executable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Executable name (e.g., 'pdflatex', 'tlmgr') |
required |
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path or None: Full path to executable if found |
Source code in jettex/utils.py
Data Classes¶
Result of a LaTeX compilation.
Attributes¶
success
instance-attribute
¶
Whether compilation succeeded.
output_file
instance-attribute
¶
Path to the output PDF file if successful.
log_file
instance-attribute
¶
Path to the compilation log file.
stdout
instance-attribute
¶
Standard output from the compiler.
stderr
instance-attribute
¶
Standard error from the compiler.
returncode
instance-attribute
¶
Return code from the compiler.