Datasets:

Modalities:
Text
Image
Formats:
json
Languages:
English
ArXiv:
License:
File size: 9,579 Bytes
6adcbc6
 
 
 
 
 
 
91eca9b
 
6adcbc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91eca9b
 
 
 
 
 
6adcbc6
91eca9b
 
 
 
 
 
 
 
 
 
6adcbc6
 
 
 
91eca9b
85085c7
6adcbc6
91eca9b
 
 
829da68
6adcbc6
 
91eca9b
 
 
 
 
 
6adcbc6
91eca9b
6adcbc6
 
 
91eca9b
 
 
 
 
6adcbc6
 
91eca9b
 
6adcbc6
91eca9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6adcbc6
 
91eca9b
6adcbc6
91eca9b
 
 
 
6adcbc6
 
 
91eca9b
6adcbc6
91eca9b
6adcbc6
 
 
 
 
 
 
 
 
 
91eca9b
6adcbc6
 
 
 
91eca9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6adcbc6
 
 
91eca9b
 
 
 
 
 
 
6adcbc6
91eca9b
6adcbc6
 
 
 
 
91eca9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6adcbc6
 
 
91eca9b
 
 
 
 
 
 
 
 
 
6adcbc6
91eca9b
 
 
 
 
 
 
6adcbc6
91eca9b
6adcbc6
91eca9b
6adcbc6
91eca9b
6adcbc6
91eca9b
 
 
 
6adcbc6
91eca9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6adcbc6
 
 
91eca9b
 
 
 
6adcbc6
91eca9b
 
6adcbc6
 
 
 
 
 
91eca9b
 
6adcbc6
 
 
 
 
91eca9b
 
 
 
 
 
6adcbc6
91eca9b
 
 
 
 
6adcbc6
 
 
 
 
 
 
 
 
 
 
 
91eca9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
---
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}
}
```