Datasets:

Modalities:
Text
Image
Formats:
json
Languages:
English
ArXiv:
License:
TableTex / README.md
yunfanyang1's picture
Update TableTex annotations, source metadata, rendering script, and dataset card
91eca9b verified
|
Raw
History Blame Contribute Delete
9.58 kB
---
pretty_name: TableTex
language:
- en
license: other
tags:
- image
- latex
- table
task_categories:
- image-to-text
size_categories:
- 10K<n<100K
configs:
- config_name: sft
data_files:
- split: train
path: sft_train.json
- config_name: cspo
data_files:
- split: train
path: cspo_train.jsonl
- config_name: evaluation
data_files:
- split: test
path: test.jsonl
---
# TableTex
## Dataset Summary
TableTex is a dataset for **table image-to-LaTeX generation**, comprising
19,000 renderable LaTeX table annotations extracted from scientific articles
on arXiv. Each annotation corresponds to a table image that can be generated
locally using the provided `generate_images.py` script. The rendered images
are not included in the repository, which keeps the distributed dataset
compact while providing a reproducible image-generation pipeline.
To support complete and compilable table generation, each annotation is
provided as a standalone LaTeX document containing the required package
declarations, table caption, and table body. The annotations preserve the
structure, content, and visual formatting of the source tables.
The source articles cover publications from 2012 to 2025 across six arXiv
subject categories: Computer Science (`cs`), Mathematics (`math`), Economics
(`econ`), Electrical Engineering and Systems Science (`eess`), Quantitative
Finance (`q-fin`), and Statistics (`stat`). Each sample also includes
source-level attribution, license, and modification metadata.
TableTex is introduced in:
- **CSPO: Alleviating Reward Ambiguity for Structured Table-to-LaTeX Generation**
- Paper: https://arxiv.org/abs/2604.10918
- Code: https://github.com/microsoft/CSPO
For additional details, see the
[TableTex data card](https://github.com/microsoft/CSPO/blob/main/TableTex_Data_Card.md)
in the CSPO repository.
## Dataset Structure
| Configuration | File | Split | Samples | Purpose |
| --- | --- | --- | ---: | --- |
| `sft` | `sft_train.json` | train | 10,000 | Supervised fine-tuning |
| `cspo` | `cspo_train.jsonl` | train | 5,000 | Reinforcement-learning post-training |
| `evaluation` | `test.jsonl` | test | 4,000 | Evaluation |
| **Total** | | | **19,000** | |
The distributed files are:
```text
tabletex/
|-- README.md
|-- generate_images.py
|-- sft_train.json
|-- cspo_train.jsonl
`-- test.jsonl
```
After image generation, PNG files are stored in subject-specific directories,
and the standalone LaTeX files used for compilation are retained under `tex/`:
```text
tabletex/
|-- tex/
| |-- cs/image/
| |-- econ/image/
| |-- eess/image/
| |-- math/image/
| |-- q-fin/image/
| `-- stat/image/
|-- cs/image/
|-- econ/image/
|-- eess/image/
|-- math/image/
|-- q-fin/image/
`-- stat/image/
```
All image paths in the annotations are relative to the dataset root. Examples:
```text
eess/image/2010.13713v2_tex_table3.png
stat/image/2501.02454v2_tex_table8.png
```
## Data Instances
### SFT configuration
`sft_train.json` stores samples in a multimodal conversation format:
```json
{
"messages": [
{
"role": "user",
"content": "<image>Please generate complete LaTeX code for the table in the image, including the table body and the full preamble."
},
{
"role": "assistant",
"content": "```latex\n\\documentclass{article}\n...\n```"
}
],
"images": [
"eess/image/2010.13713v2_tex_table3.png"
],
"source": {
"title": "Self-supervised Human Activity Recognition by Learning to Predict Cross-Dimensional Motion",
"authors": [
"Setareh Rahimi Taghanaki",
"Michael Rainbow",
"Ali Etemad"
],
"url": "https://arxiv.org/abs/2010.13713v2",
"attribution": "\"Self-supervised Human Activity Recognition by Learning to Predict Cross-Dimensional Motion\" by Setareh Rahimi Taghanaki, Michael Rainbow, and Ali Etemad, arXiv:2010.13713v2, licensed under CC BY-SA 4.0. The table was extracted, wrapped as standalone LaTeX, rendered, and cropped by TableTex.",
"license": {
"name": "CC BY-SA 4.0",
"url": "https://creativecommons.org/licenses/by-sa/4.0/"
},
"modifications": [
"Extracted the table LaTeX from the article source.",
"Wrapped it as a standalone LaTeX document.",
"Rendered and cropped it into a PNG image."
]
}
}
```
Fields:
- `messages`: multimodal prompt and target LaTeX response.
- `images`: list containing the relative output path of the table image.
- `source`: source and rights metadata for the sample.
### CSPO and evaluation configurations
`cspo_train.jsonl` and `test.jsonl` store one JSON object per line:
```json
{
"image_path": "stat/image/2501.02454v2_tex_table8.png",
"subject": "stat",
"tex_code": "\\documentclass{article}\n...",
"source": {
"title": "Finite-Sample Valid Randomization Tests for Monotone Spillover Effects",
"authors": [
"Shunzhuang Huang",
"Xinran Li",
"Panos Toulis"
],
"url": "https://arxiv.org/abs/2501.02454v2",
"attribution": "\"Finite-Sample Valid Randomization Tests for Monotone Spillover Effects\" by Shunzhuang Huang, Xinran Li, and Panos Toulis, arXiv:2501.02454v2, licensed under CC BY-SA 4.0. The table was extracted, wrapped as standalone LaTeX, rendered, and cropped by TableTex.",
"license": {
"name": "CC BY-SA 4.0",
"url": "https://creativecommons.org/licenses/by-sa/4.0/"
},
"modifications": [
"Extracted the table LaTeX from the article source.",
"Wrapped it as a standalone LaTeX document.",
"Rendered and cropped it into a PNG image."
]
}
}
```
Fields:
- `image_path`: relative output path of the table image.
- `subject`: arXiv subject category.
- `tex_code`: standalone LaTeX code corresponding to the image.
- `source`: source and rights metadata for the sample.
### Source metadata
Every sample includes:
- `source.title`: complete title of the source article.
- `source.authors`: authors of the source article.
- `source.url`: version-specific arXiv abstract URL.
- `source.attribution`: attribution statement for the sample.
- `source.license.name`: exact source-license name.
- `source.license.url`: URL of the source license.
- `source.modifications`: transformations performed by TableTex.
## Generating the Images
### 1. Install Dependencies
TableTex image generation requires:
- Python 3.10 or later
- `tqdm`
- TeX Live providing `pdflatex` and `pdfcrop`
- Poppler providing `pdftoppm`
Install the Python dependency with:
```bash
pip install tqdm
```
Install TeX Live using the official resources:
- **TeX Live:** [Official Website](https://tug.org/texlive/)
- **Installation Guide:** [TeX Live Documentation](https://tug.org/texlive/doc.html)
We recommend installing the full TeX Live distribution to ensure that all
LaTeX packages used by the dataset are available.
On Ubuntu/Debian systems, also install the following system dependencies:
```bash
sudo apt-get update
sudo apt-get install -y ghostscript poppler-utils
```
### 2. Run the Script
Run the following commands from the dataset root:
```bash
python generate_images.py sft_train.json
python generate_images.py cspo_train.jsonl
python generate_images.py test.jsonl
```
The default behavior is to process every record. To process only the first 20
records:
```bash
python generate_images.py test.jsonl --limit 20
```
To use a different output root:
```bash
python generate_images.py test.jsonl --output-root ./rendered
```
### 3. Output Files
By default, generated PNG images are written directly to:
```text
<dataset-root>/<subject>/image/<filename>.png
```
The standalone LaTeX files used for compilation are written to:
```text
<dataset-root>/tex/<subject>/image/<filename>.tex
```
## Dataset Creation
TableTex was constructed from LaTeX sources of scientific articles on arXiv.
For each sample, the table LaTeX was extracted from an article, wrapped as a
standalone document, and associated with version-specific source and licensing
metadata. Images can be generated using the included rendering script.
The source articles cover publications from 2012 to 2025 and were selected from
the following Creative Commons license families:
- CC BY
- CC BY-SA
- CC0
- CC BY-NC
The exact license applicable to each sample is recorded in its `source.license`
object.
## Intended Use
TableTex is intended for research on table image-to-LaTeX generation, including supervised fine-tuning, reinforcement-learning-based post-training, and evaluation of models that reconstruct tables from images as LaTeX code.
## Copyright, Attribution, and Licensing
TableTex contains samples derived from arXiv articles released under CC BY,
CC BY-SA, CC0, or CC BY-NC licenses. Copyright remains with the respective
authors and/or other rightsholders. The applicable license, attribution, and
modification information for each sample is recorded in its `source` metadata.
Users are responsible for complying with the applicable source license when
using, adapting, or redistributing the LaTeX annotations or generated images,
including any attribution, share-alike, and non-commercial requirements where
applicable. Rendering an image locally does not alter the copyright or license
terms of the source material.
## Citation
If you use TableTex in your work, please cite:
```bibtex
@article{yang2026cspo,
title={CSPO: Alleviating Reward Ambiguity for Structured Table-to-LaTeX Generation},
author={Yang, Yunfan and Lan, Cuiling and Sang, Jitao and Lu, Yan},
journal={arXiv preprint arXiv:2604.10918},
year={2026}
}
```