| Crates.io | talmudifier |
| lib.rs | talmudifier |
| version | 0.1.1 |
| created_at | 2025-05-04 16:19:22.784521+00 |
| updated_at | 2025-05-09 17:03:42.919786+00 |
| description | Convert markdown text into Talmud-like PDFs |
| homepage | |
| repository | https://github.com/subalterngames/talmudifier-rs |
| max_upload_size | |
| id | 1659754 |
| size | 3,756,398 |
Generate PDFs with page layouts similar to the Talmud.
Given three paragraphs of markdown text, Talmudifier will generate a .pdf file using XeTeX (via Rust's tectonic crate). You can also include a title, basic styling (bold, italic, etc.) and marginalia.
This is a Rust port of my Talmudifier Python module. It's faster now.

use std::{fs::write, path::PathBuf, str::FromStr};
use talmudifier::prelude::*;
let directory = PathBuf::from_str("example_text").unwrap();
// Load a default talmudifier.
let talmudifier = Talmudifier::default()
// Add a title to the page.
.title("Talmudifier")
// Set the source text as three Markdown files.
.source_text(SourceText::Files {
left: directory.join("left.md"),
center: directory.join("center.md"),
right: directory.join("right.md")
});
// Talmudify.
let daf = talmudifier.talmudify().unwrap();
// Write the .tex. This is sometimes useful for debugging.
write("out.tex", &daf.tex).unwrap();
// Write the PDF.
write("out.pdf", &daf.pdf).unwrap();
On this webpage, there is a Releases sidebar. Click that, and download Talmudifier.
Open a terminal. You first need to change directory to Downloads (or wherever Talmudifier actually is), so:
cd ~/Downloads
MacOS: The app might not be marked as an executable. Run this in the same terminal window:
chmod +x talmudifier
MacOS: If that didn't work, move talmudifier to your home directory, and then run this:
cd ~ && chmod +x talmudifier
MacOS and Linux: Run Talmudifier:
./talmudifier
Windows: Run Talmudifier:
./talmudifier.exe
All platforms: When you run Talmudifier, you'll see a list of command line options.
You now need to actually write some words for the page, and then create a valid talmudifier.json file.
Save talmudifier.json wherever you want. Assuming that:
/home/<username>/)talmudify is in Downloads/talmudifier.json is in Documents/Documents/...Then you would do this:
./talmudify -t Documents/talmudifier.json -o Documents/out.pdf
The underlying tectonic TeX engine uses some C++ libraries which are compiled via vcpkg.
First time only:
brew install autoconf automake autoconf-archivesudo apt install autoconf automake autoconf-archivecargo install cargo-vcpkgFirst time only or whenever you cargo clean:1
cargo vcpkg build
Every time you want to build your project, set the following environment flags:
Linux and MacOS:
export TECTONIC_DEP_BACKEND="vcpkg"
Windows:
$Env:TECTONIC_DEP_BACKEND="vcpkg"
$Env:RUSTFLAGS="-Ctarget-feature=+crt-static"
Then, create a talmudifier.json file.
Follow steps for adding Talmudifier to your project. Then, run:
cargo build --release --bin talmudify --features clap
Then, create a talmudifier.json file.
Talmudifier uses JSON config files for typesetting. example_talmudifier.json is an example config file. To make your own config file, copy+paste the example and edit as needed. It should be mostly human-readable.
Many of the values in the config file are measurements of lengths. The following units are valid: "In", "Cm", "Mm", "Pt", "Em". However, there are many cases in which "Em" is not valid. This is because many of the lengths need to be converted to Pts and there's no easy way to do what with Ems because they're font-specific. I recommend using Em for values only where example_talmdufier.json uses Em.
You can also optionally set the per-column "fonts". If you don't, and if you've included the default-features feature, default fonts will be used.
Limitations:
Each font style (regular, bold, etc.) must be a separate file.
A column's font files must all be in the same directory.
System fonts are not supported.
"source_text" specifies the source text that will be talmdufied. There are three options:
"Files": {
"left": "left.md",
"center": "center.md",
"right": "right.md"
}
"Text": {
"left": "This is the left column.",
"center": "This is the center column.",
"right": "This is the right column."
}
Example JSON:
"File": "text.md"
An example file:
This is the left column.
This is the center column.
This is the right column.
A very subset of markdown is used in Talmudifier:
For the most part, just type text like you normally would. You can italicize text like *this*. You can make text bold like **this**. You can make bold and italic text like ***this***. **You can make multiple words bold and you can *italicize* within bold text** (*and **vice** versa*). `If you want to add marginalia, use graves.`
Links, images, headers, emoji, etc. are not supported.
By default, "title" is set to null. Set it to something else to add a title to the page:
"title": "Chapter 1"
Set "log": true to enable logging. This will generated intermediary files per iteration that can be useful for debugging. This will also make Talmudifier run slower.
The Talmud's typesetting dates back to the invention of the printing press. Printmaking was easy but paper was expensive so people crammed several texts onto a single page. The standard "Talmud page layout" is actually the Talmud as printed in the Vilna Shas, and other page layouts are possible.
There are rules defining how to typeset a Talmud page. The Vilna Shas predates the formalization of iterative algorithms, so some pages follow the rules less strictly than others. Talmudifier strictly follows the following rules:


For more information, read: Printing the Talmud : a history of the earliest printed editions of the Talmud by Martin Heller
There is a fundamental problem in the typesetting algorithm: We need to iteratively get the number of lines in a column. Traditionally, this process would be sped up by experienced typesetters because they'd be able to eyeball how many character blocks would fit in a rectangle. Talmudifier emulates this heurisitic with the following algorithm:
default-fonts embeds default fonts into the executable. You might want to remove this if you want to use other fonts because the default fonts make the binary bigger.clap is required for some of the executables. If you're using Talmudifier as a library, you can ignore this.textest is only used for the textest binary; it makes some extra functions and structs public.To run a very rudimentary benchmark:2
cargo run --bin benchmark --release
Current benchmark: 18 seconds
To regenerate example_talmudifier.json:
cargo run --bin example_config
To convert an arbitrary .tex file into a .pdf (useful for debugging):
cargo run --bin textest --features textest -d directory/ -f filename.tex
The -d argument is optional and defaults to logs/.
You can also, optionally, add -x to create a .xdv file instead of a .pdf, which is useful for debugging line counts.
This is a Rust port of my talmudifier Python module. Major differences include:
It's twelve times faster.3
No external TeX engine needed. Talmudifier has its own internal TeX engine.
No need to manually download any TeX packages. Talmudifier will download the required packages for you.
Two major performance improvements to the algorithm:
Default fonts are embedded in the executable
Simplified the config file
No longer supported:
If cargo vcpkg build fails, it's probably because you've got a whitespace in the root file path. To fix: Move target/vcpkg to a directory without white spaces, such as: C:/vcpkg. Then: cd C:/vcpkg Then: vcpkg install icu on MacOS and Linux, or vcpkg install icu --triplet x64-windows-static on Windows. Then: Move vcpkg/ back to <project>/target/ The Internet implies that a newer compiler than what I'm using might fix the problem. Or maybe it won't. Sorry. ↩
There's no need for anything more complicated than this because Talmudifier is so slow. ↩
See the benchmark. With Python Talmudifier, a similar benchmark takes 216 seconds. ↩