File size: 3,268 Bytes
54e447a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b64c36
 
 
0274c7e
 
 
 
 
54e447a
 
 
 
 
7b64c36
 
0274c7e
 
d0a406b
 
 
 
 
 
 
 
 
54e447a
ac786c9
54e447a
ac786c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5142b9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
dataset_info:
  features:
  - name: image
    dtype: image
  - name: latex
    dtype: string
  - name: sample_id
    dtype: string
  - name: split_tag
    dtype: string
  - name: data_type
    dtype: string
  splits:
  - name: train
    num_bytes: 1308313988.28
    num_examples: 229864
  - name: test
    num_bytes: 50449700.38
    num_examples: 7644
  - name: val
    num_bytes: 92725986.108
    num_examples: 15674
  download_size: 1247446895
  dataset_size: 1451489674.7680001
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: test
    path: data/test-*
  - split: val
    path: data/val-*
task_categories:
- image-to-text
tags:
- math
- latex
- handwritten
- ocr
size_categories:
- 100K<n<1M
---
# Dataset Card for MathWriting

## Dataset Summary

The **MathWriting** dataset contains online handwritten mathematical expressions collected through a prompted interface and rendered to RGB images. It consists of **230,000 human-written expressions**, each paired with its corresponding LaTeX string. The dataset is intended to support research in **online and offline handwritten mathematical expression (HME) recognition**.

Key features:

- Online handwriting converted to rendered RGB images.
- Each sample is labeled with a LaTeX expression.
- Includes splits: `train`, `val`, and `test`.
- All samples in this release are **human-written** (no synthetic data).
- Image preprocessing includes resizing (max dimension ≤ 512 px), stroke width jitter, and subtle color perturbations.

---

## Supported Tasks and Leaderboards

**Primary Task:**  
- *Handwritten Mathematical Expression Recognition (HMER)*: Given an image of a handwritten formula, predict its LaTeX representation.

This dataset is also suitable for:
- Offline HME recognition (from rendered images).
- Sequence modeling and encoder-decoder learning.
- Symbol layout analysis and parsing in math.

---

## Dataset Structure

Each example has the following structure:

```python
{
    'image': <PIL.Image.Image in RGB mode>,
    'latex': str,  # the latex string"
    'sample_id': str,  # unique identifier
    'split_tag': str,  # "train", "val", or "test"
    'data_type': str,  # always "human" in this version
}
```

All samples are rendered from digital ink into JPEG images with randomized stroke width and light RGB variations for augmentation and realism.

## Usage

To load the dataset:

```python
from datasets import load_dataset

ds = load_dataset("deepcopy/MathWriting-Human")
sample = ds["train"][0]
image = sample["image"]
latex = sample["latex"]
```

## Licensing Information

The dataset is licensed by **Google LLC** under the **Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International** license ([CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)).

---

## Citation

Please cite the following paper if you use this dataset:

```
@misc{gervais2025mathwritingdatasethandwrittenmathematical,
      title={MathWriting: A Dataset For Handwritten Mathematical Expression Recognition}, 
      author={Philippe Gervais and Anastasiia Fadeeva and Andrii Maksai},
      eprint={2404.10690},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2404.10690}, 
}
```