jettex.tlmgr¶
TeX Live Manager (tlmgr) wrapper functions.
Module Overview¶
This module provides a Python interface to tlmgr for managing LaTeX packages.
from jettex import (
tlmgr_install,
tlmgr_remove,
tlmgr_update,
tlmgr_list,
tlmgr_search,
tlmgr_info,
find_package_for_file
)
Functions¶
tlmgr_install(packages)
¶
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
tlmgr_remove(packages)
¶
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
tlmgr_update(packages=None, all_packages=False, self_update=False)
¶
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
tlmgr_list(only_installed=True)
¶
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
tlmgr_search(query, file_search=False, global_search=True)
¶
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 | |
tlmgr_info(package)
¶
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
tlmgr_path(action='add')
¶
Manage TinyTeX in system PATH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
'add' or 'remove' |
'add'
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if successful |
Source code in jettex/tlmgr.py
tlmgr_version()
¶
Get tlmgr/TeX Live version.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
str or None: Version string |
Source code in jettex/tlmgr.py
find_package_for_file(filename)
¶
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
Examples¶
Installing Packages¶
from jettex import tlmgr_install
# Install multiple packages
success = tlmgr_install([
"geometry",
"amsmath",
"hyperref",
"booktabs"
])
if success:
print("Packages installed successfully")
Searching Packages¶
from jettex import tlmgr_search
# Search by name
results = tlmgr_search("tikz")
for r in results:
print(r["package"])
# Search by file
results = tlmgr_search("pgfplots.sty", file_search=True)
for r in results:
print(f"{r['package']}: {r.get('file', '')}")
Finding Package for File¶
from jettex import find_package_for_file
# Find which package provides a file
package = find_package_for_file("geometry.sty")
print(f"geometry.sty is in package: {package}")
Updating Packages¶
from jettex import tlmgr_update
# Update everything
tlmgr_update(all_packages=True, self_update=True)