Package Management¶
jettex provides a complete wrapper around tlmgr (TeX Live Manager) for managing LaTeX packages.
Installing Packages¶
import jettex
# Install a single package
jettex.tlmgr_install(["geometry"])
# Install multiple packages
jettex.tlmgr_install(["amsmath", "amsfonts", "amssymb"])
# Install a collection
jettex.tlmgr_install(["collection-fontsrecommended"])
Removing Packages¶
Updating Packages¶
# Update specific packages
jettex.tlmgr_update(packages=["geometry", "hyperref"])
# Update all installed packages
jettex.tlmgr_update(all_packages=True)
# Update tlmgr itself
jettex.tlmgr_update(self_update=True)
# Update everything
jettex.tlmgr_update(all_packages=True, self_update=True)
Listing Packages¶
# List all installed packages
packages = jettex.tlmgr_list()
print(f"Installed packages: {len(packages)}")
for pkg in packages[:10]:
print(f" - {pkg}")
Searching for Packages¶
# Search by package name
results = jettex.tlmgr_search("tikz")
for result in results:
print(result["package"])
# Search by file name
results = jettex.tlmgr_search("geometry.sty", file_search=True)
for result in results:
print(f"{result['package']}: {result.get('file', '')}")
Finding Package for a File¶
Find which package provides a specific file:
# Find package that provides geometry.sty
package = jettex.find_package_for_file("geometry.sty")
print(f"geometry.sty is provided by: {package}")
# Find package for a font file
package = jettex.find_package_for_file("lmroman10-regular.otf")
print(f"Font is provided by: {package}")
Package Information¶
Get detailed information about a package:
info = jettex.tlmgr_info("geometry")
if info:
print(f"Name: {info['name']}")
print(f"Category: {info.get('category', 'N/A')}")
print(f"Description: {info.get('shortdesc', 'N/A')}")
Common Package Collections¶
TinyTeX uses TeX Live package collections. Here are commonly needed ones:
| Collection | Description |
|---|---|
collection-basic |
Essential programs and files |
collection-latex |
LaTeX fundamental packages |
collection-latexrecommended |
LaTeX recommended packages |
collection-fontsrecommended |
Recommended fonts |
collection-mathscience |
Mathematics and science packages |
collection-pictures |
Graphics, pictures, diagrams |
collection-bibtexextra |
BibTeX additional styles |
Install a collection:
Commonly Used Packages¶
Here are some frequently needed packages:
Document Structure¶
jettex.tlmgr_install([
"geometry", # Page layout
"fancyhdr", # Headers and footers
"titlesec", # Section titles
"tocloft", # Table of contents
])
Mathematics¶
jettex.tlmgr_install([
"amsmath", # AMS math environments
"amsfonts", # AMS fonts
"amssymb", # AMS symbols
"mathtools", # Math tools extension
])
Graphics¶
jettex.tlmgr_install([
"graphicx", # Include graphics
"tikz", # TikZ graphics
"pgfplots", # Plots
"xcolor", # Colors
])
Tables¶
jettex.tlmgr_install([
"booktabs", # Professional tables
"longtable", # Multi-page tables
"multirow", # Multi-row cells
"tabularx", # Auto-width tables
])
Bibliography¶
jettex.tlmgr_install([
"biblatex", # Modern bibliography
"biber", # Biblatex backend
"natbib", # Natural citations
])
Code Listings¶
jettex.tlmgr_install([
"listings", # Code listings
"minted", # Syntax highlighting (needs shell-escape)
])
CLI Package Management¶
Manage packages from the command line: