Expand description
§rtex — Native TeX to multi-format converter
A self-contained Rust library for converting LaTeX documents to PDF, HTML, DOCX, or EPUB without an external TeX installation.
§Quick example
use rtex::{convert_tex_to_pdf, convert_tex_string, OutputFormat};
use std::path::Path;
// File → PDF
convert_tex_to_pdf(Path::new("doc.tex"), Path::new("doc.pdf")).unwrap();
// String → HTML
let html = convert_tex_string("\\documentclass{article}\\begin{document}Hi\\end{document}", OutputFormat::Html).unwrap();§Modules
NativeTexConverter— main conversion entry pointOutputFormat— PDF, HTML, DOCX, EPUB selectionPackageFetcher— on-demand CTAN package downloadTexParser/TexElement— LaTeX parsing ASTpdfrs_pdf— PDF generation via the pdfrs engine
§Feature flags
wasm— enableswasm-bindgenexports for browser uselsp— builds thertex-lsplanguage server binary
Re-exports§
pub use error::LatexError;pub use error::Position;pub use lsp::CompletionKind;pub use lsp::Severity;pub use lsp::SymbolKind;pub use lsp::TexCompletion;pub use lsp::TexDiagnostic;pub use lsp::TexPosition;pub use lsp::TexRange;pub use lsp::TexSymbol;pub use lsp::analyze_diagnostics;pub use lsp::command_completions;pub use lsp::completions_at;pub use lsp::document_symbols;pub use lsp::hover_at;
Modules§
Structs§
- Cache
Config - Cache configuration.
- Cache
Stats - Statistics for cache performance monitoring.
- Console
Reporter - Simple console reporter that prints stage names to stderr.
- Conversion
Options - Options controlling conversion format and package fetching.
- Document
Cache - Live cache for parsed documents and rendered output.
- Document
Meta - Document metadata extracted from parsed elements.
- Incremental
Compiler - Tracks build state for incremental compilation.
- Intermediate
Meta - Metadata summary written alongside intermediate artifacts.
- Math
Formatter - Native
TexConverter - Pure-Rust TeX-to-PDF converter.
- NoOp
Reporter - No-op reporter — useful when progress is not required.
- Package
Fetcher - Local cache and download settings.
- Package
Request - A LaTeX package or class file required by a document.
- Streaming
Converter - Converts a LaTeX file to the configured output format with progress reporting and memory-conscious chunked reading.
- TexParser
- Stateful parser for a single LaTeX document.
Enums§
- Output
Format - Supported output formats for LaTeX conversion.
- PdfBackend
- Identifies the pdfrs PDF engine as the only PDF backend.
- TexElement
- A structured element parsed from a LaTeX document.
Traits§
- Progress
Reporter - Callback trait for reporting conversion progress.
- TexConverter
- Trait for converting a LaTeX file to PDF.
Functions§
- convert_
tex_ file - Convert a
.texfile to an output file using the given options. - convert_
tex_ string - Convert TeX source to bytes in the requested format.
- convert_
tex_ string_ to_ pdf_ bytes - Convert a TeX source string directly to PDF bytes (no filesystem access).
- convert_
tex_ to_ pdf - One-shot helper: convert a
.texfile to a.pdf. - expand_
document - Expand user-defined macros in
textwithout structured parsing. - render_
elements - Render parsed elements to bytes in the requested format.
- render_
elements_ in_ dir - Like
render_elementswith an optional base directory for relative images (PDF). - sibling_
artifact - Return the path for a sibling artifact next to
output. - watch_
batch - Watch a set of input files and recompile when any change.
- watch_
single - Convenience: watch a single input/output pair, including
\inputdependencies. When the root file or any dependency changes, the root document is rebuilt. - write_
intermediates - Write intermediate artifacts next to
output.