Pubtab
Bidirectional Excel↔LaTeX table converter with style-preserving roundtrip, multi-sheet support, and PNG/PDF preview.
Install / Use
/learn @Galaxy-Dawn/PubtabREADME
pubtab
<div align="center"> <img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/LOGO.png" alt="pubtab logo" width="100%"/> <p> <a href="https://pypi.org/project/pubtab/"><img src="https://img.shields.io/pypi/v/pubtab?style=flat-square&color=blue" alt="PyPI Version"/></a> <a href="https://pypi.org/project/pubtab/"><img src="https://img.shields.io/pypi/pyversions/pubtab?style=flat-square" alt="Python Versions"/></a> <img src="https://img.shields.io/badge/License-MIT-green?style=flat-square" alt="License"/> <a href="https://pypi.org/project/pubtab/"><img src="https://img.shields.io/pypi/dm/pubtab?style=flat-square&color=orange" alt="Downloads"/></a> </p><strong>Language</strong>: <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/README.md">English</a> | <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/README.zh-CN.md">中文</a>
</div>Convert Excel tables to publication-ready LaTeX (and back) with stable roundtrip behavior.
Highlights
- Roundtrip Consistency — Designed for
tex -> xlsx -> texworkflows with minimal structural drift. - Multiple TeX Backends — Supports both classic
tabularexport andtabularray/tblroutput. - All-Sheets by Default —
xlsx2texexports every sheet as*_sheetNN.texwhen--sheetis not set. - Style Fidelity — Preserves merged cells, colors, rich text, rotation, and common table semantics.
- Publication Preview — Generate PNG/PDF directly from
.texvia one CLI entry. - Overleaf-Ready Output — Generated
.texstarts with commented\usepackage{...}hints.
Recent News
- 2026-03-18:
tabularraybackend support and README refresh — addedtabularrayas an alternative TeX backend forxlsx2tex, updated theme/backend resolution sothree_linecan be used consistently across render and preview, replaced placeholder usage paths with real repo examples underexamples/, documented GitHub dev installation, and removed the repository test directory from the tracked tree. - 2026-03-06: Preview dependency recovery and resizebox controls — improved TinyTeX / missing-package recovery in preview, and added
resizebox-related CLI switches for more reliable wide-table export. - 2026-03-05: PyPI-safe README cleanup and release prep — switched README links to PyPI-safe forms and prepared the 1.0.1 release workflow.
Examples
Showcase
<p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table4.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table4.png" width="48%" alt="Example table4"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table7.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table7.png" width="48%" alt="Example table7"></a> </p> <p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table8.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table8.png" width="48%" alt="Example table8"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table10.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table10.png" width="48%" alt="Example table10"></a> </p> <details> <summary><strong>Full Gallery (11 examples)</strong></summary> <p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table1.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table1.png" width="31%" alt="table1"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table2.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table2.png" width="31%" alt="table2"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table3.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table3.png" width="31%" alt="table3"></a> </p> <p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table4.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table4.png" width="31%" alt="table4"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table5.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table5.png" width="31%" alt="table5"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table6.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table6.png" width="31%" alt="table6"></a> </p> <p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table7.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table7.png" width="31%" alt="table7"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table8.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table8.png" width="31%" alt="table8"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table9.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table9.png" width="31%" alt="table9"></a> </p> <p align="center"> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table10.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table10.png" width="31%" alt="table10"></a> <a href="https://github.com/Galaxy-Dawn/pubtab/blob/main/examples/table11.xlsx"><img src="https://raw.githubusercontent.com/Galaxy-Dawn/pubtab/main/examples/table11.png" width="31%" alt="table11"></a> </p> </details>Example A: Excel -> LaTeX
pubtab xlsx2tex ./examples/table4.xlsx -o ./out/table4.tex
Output file:
./out/table4.tex
Example B: LaTeX -> Excel (roundtrip from the generated sample)
pubtab tex2xlsx ./out/table4.tex -o ./out/table4_roundtrip.xlsx
Example C: LaTeX -> PNG / PDF preview
pubtab preview ./out/table4.tex -o ./out/table4.png --dpi 300
pubtab preview ./out/table4.tex --format pdf -o ./out/table4.pdf
Example D: Excel -> tabularray (tblr)
pubtab xlsx2tex ./examples/table4.xlsx -o ./out/table4_tblr.tex \
--theme three_line \
--latex-backend tabularray
# Preview the generated tabularray tex file
pubtab preview ./out/table4_tblr.tex -o ./out/table4_tblr.png \
--theme three_line --latex-backend tabularray --dpi 300
Generated .tex header includes package hints (comments only):
% Theme package hints for this table (add in your preamble):
% \usepackage{booktabs}
% \usepackage{multirow}
% \usepackage[table]{xcolor}
Quick Start
pip install pubtab
Stable release on PyPI: pubtab on PyPI
Install the current GitHub development version:
pip install "git+https://github.com/Galaxy-Dawn/pubtab.git"
CLI Quick Start
# 1) Excel -> LaTeX
pubtab xlsx2tex table.xlsx -o table.tex
# 2) LaTeX -> Excel
pubtab tex2xlsx table.tex -o table.xlsx
# 3) Preview
pubtab preview table.tex -o table.png --dpi 300
# 4) Native batch pipeline (directory input)
pubtab tex2xlsx ./tables_tex -o ./out/xlsx
pubtab xlsx2tex ./out/xlsx -o ./out/tex
pubtab preview ./out/tex -o ./out/png --format png --dpi 300
Python Quick Start
import pubtab
# Excel -> LaTeX
pubtab.xlsx2tex("table.xlsx", output="table.tex", theme="three_line")
# Excel -> tabularray
pubtab.xlsx2tex(
"table.xlsx",
output="table_tblr.tex",
theme="three_line",
latex_backend="tabularray",
)
# LaTeX -> Excel
pubtab.tex_to_excel("table.tex", "table.xlsx")
# Preview (.png by default)
pubtab.preview("table.tex", dpi=300)
# Native batch pipeline (directory input)
pubtab.tex_to_excel("tables_tex", "out/xlsx")
pubtab.xlsx2tex("out/xlsx", output="out/tex")
pubtab.preview("out/tex", output="out/png", format="png", dpi=300)
Parameter Guide
pubtab xlsx2tex
| Parameter | Type / Values | Default | Description | Typical Use |
|---|---|---|---|---|
| INPUT_FILE | path (file or directory) | required | Source .xlsx / .xls file, or a directory containing them | Main input / batch conversion |
| -o, --output | path | required | Output .tex path or output directory; when INPUT_FILE is a directory, this must be a directory | Set destination |
| -c, --config | path | none | YAML config file | Team presets |
| --sheet | sheet name / 0-based index | all sheets | Export only one sheet | Single-sheet export |
| --theme | string | three_line | Style theme used for rendering | Switch visual style |
| --caption | string | none | Table caption | Paper-ready table |
| --label | string | none | LaTeX label | Cross-reference |
| --header-rows | int | auto | Number of header rows | Override detection |
| --span-columns | flag | false | Use table* | Two-column papers |
| --preview | flag | false | Generate PNG preview(s) | Fast visual check |
| --position | string | htbp | Float position | Layout tuning |
| --font-size | string | theme default | Set table font size | Compact layout |
| --resizebox | string | none | Wrap with \resizebox{...}{!}{...} | Wide tables |
| --with-resizebox | flag | false | Enable \resizebox wrapper | Force width control |
| --without-resizebox | flag | false | Disable \resizebox wrapper | Keep raw tabular width |
| --resizebox-width | string | \linewidth | Width used by --with-resizebox | Custom scaling |
| --col-spec | string | auto | Explicit tabular col spec | Manual alignment |
| --dpi | int | 300 | Preview DPI (--preview) | Sharper PNG |
| --header-sep | string | auto | Custom separator under header | Custom rule line |
| --upright-scripts | flag | false | Render sub/superscript as upright \mathrm{} | Typographic preference |
| --latex-backend | tabular / tabularray | tabular | TeX backend
Related Skills
claude-opus-4-5-migration
109.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
349.7kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
openhue
349.7kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
349.7kElevenLabs text-to-speech with mac-style say UX.
