| Crates.io | latexmk-diff-head |
| lib.rs | latexmk-diff-head |
| version | 0.2.2 |
| created_at | 2025-06-09 09:00:29.229697+00 |
| updated_at | 2025-06-10 11:29:28.707798+00 |
| description | LaTeX compilation tool that generates diff PDFs against Git commits |
| homepage | https://momota.pw |
| repository | https://github.com/momota1029/latexmk-diff-head |
| max_upload_size | |
| id | 1705688 |
| size | 51,868 |
A latexmk wrapper that automatically generates diff PDFs against the previous Git commit alongside regular compilation. Designed for LaTeX Workshop integration.
Primary use case: Academic paper writing where Git commits represent submission milestones, enabling clear visualization of changes for revision tracking.
cargo install latexmk-diff-head
Or build from source:
git clone https://github.com/momota1029/latexmk-diff-head.git
cd latexmk-diff-head
cargo install --path .
# Basic usage (recommended)
latexmk-diff-head --synctex --flatten paper/main
# Output files:
# paper/main.pdf (regular)
# paper/diff/main-diff.pdf (diff with additions in blue, deletions in red)
Add to your settings.json:
{
"latex-workshop.latex.recipes": [
{
"name": "latexmk-diff-head",
"tools": ["latexmk-diff-head"]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk-diff-head",
"command": "latexmk-diff-head",
"args": ["--synctex", "--flatten", "%DOC%"]
}
]
}
Run latexmk-diff-head -h for complete option list. Key options:
--synctex # Generate SyncTeX (required for LaTeX Workshop)
--flatten # Expand \input/\include (recommended for complex projects)
--xelatex # Use XeLaTeX
--lualatex # Use LuaLaTeX
--bibtex # Use BibTeX
--biber # Use Biber (BibLaTeX)
--revision REV # Compare against specific revision [default: HEAD]
--async-diff # Run diff compilation asynchronously, ignoring its errors
--tmpdir DIR # Temporary files directory
--outdir DIR # PDF output directory
Initialize your project:
git init
git add .
git commit -m "Initial draft"
After making changes and building, you'll see diffs against this commit. Commit periodically to update the comparison baseline.
MIT