A Python tool to count character or word contributions of each author in a LaTeX project, based on git blame.
This is particularly useful for collaborative textbook or research note projects where authorship and writing effort need to be measured quantitatively.
- ✅ Counts by actual authorship using
git blame - ✅ Supports both words (default) and characters (
--char) - ✅ Removes LaTeX syntax when requested
- ✅ Reads
.flsto trace all.texfiles recursively - ✅ Automatically compiles
.texwith-recorderif.flsis missing - ✅ Outputs human-readable table in terminal
- ✅ Logs results to
count_word.log - ✅ Outputs CSV (
count_word.csv) for plotting or analysis
Install dependencies:
pip install tabulateIf .fls file is not found, the script will automatically run xelatex or pdflatex twice.
You may also pre-compile manually:
xelatex -recorder main.tex
# or
pdflatex -recorder main.texpython count_latex_contrib.py main.tex| Flag | Description |
|---|---|
--char |
Count characters instead of words |
--nocsv |
Disable output of count_word.csv |
--pdflatex |
Use pdflatex instead of xelatex |
--fls |
Manually specify .fls path |
=== Total Contributions (Without LaTeX Grammar) ===
╒══════════════════╤══════════════╤══════════╕
│ Author │ Characters │ Percent │
╞══════════════════╪══════════════╪══════════╡
│ Photon │ 131025 │ 44.85% │
│ LittlePhoton │ 52291 │ 17.90% │
│ ... │ ... │ ... │
╘══════════════════╧══════════════╧══════════╛
count_word.log: Plain text result with timestampcount_word.csv: Optional CSV (Author,Plain,Raw) for Excel/plotting
MIT License. Use freely, attribution appreciated.
Created by PhotonYan for collaborative academic writing and fair contribution analysis.
Contributions and suggestions welcome!