Improved Natural Language Processing-Based Optical Character Recognition Model for Image-to-LaTeX Conversion | IJLTEMAS
00
Days
00
Hrs
00
Min
00
Sec
Submit Your Paper

Improved Natural Language Processing-Based Optical Character Recognition Model for Image-to-LaTeX Conversion

Authors

Francis Amaechi Okoye

Computer Engineering , Enugu State University of Science and Technology (Nigeria)

Everistus Zeluwa Orji

Software Engineering Department, Cyprus Aydin University (Nigeria)

Godwin Odozo Ozor

Computer Engineering , Enugu State University of Science and Technology (Nigeria)

Article Information

DOI: 10.51583/IJLTEMAS.2026.151000126

Subject Category: Natural Language Processing

Volume/Issue: 15/10 | Page No: 1562-1578

Publication Timeline

Submitted: 2026-10-27

Accepted: 2026-11-02

Published: 2026-11-19

Abstract

Recognition of symbols in mathematical expressions and systematic analysis involving the recognition of basic mathematical expressions (BME) from images are difficult tasks. Many researchers have used optical character recognition (OCR) to support such recognition. However, recognizing such unique mathematical symbols and figuring out where they belong in the formula is still challenging due to the limitations of the existing encoder-decoder architecture that fails to capture the precise position of such symbols and a poor data set. In order to address such a challenge, this study proposes a natural language processing (NLP)-based optical character recognition (OCR) model that converts images of BME to LaTeX markup by using an encoder based on a convolutional neural network (CNN) and a decoder based on a recurrent neural network (RNN). The proposed approach includes an attention mechanism and a novel dataset that enable the encoder-decoder architecture to find the position of the math symbol correctly. The proposed NLP-based OCR model was evaluated using the BLEU score, edit distance, and exact match metrics by compiling the predicted LaTeX markup to produce new math formulas and contrasting them against the ground truth. The NLP-based OCR model achieved a good performance, having achieved 93.22% on the BLEU score, 93.49% on the edit dis-tance, and 78.21 on the exact match.

Keywords

Image; LaTeX; encoder-decoder; attention mechanism; GRU; mathematical expression recognition; natural language processing; optical character recognition; recurrent neural network

Downloads

References

1. A Hybrid Vision Transformer Approach for Mathematical Expression Recognition. (2022). 2022 International Conference on Digital Image Computing: Techniques and Applications (DICTA). https://doi.org/10.1109/DICTA56598.2022.10034626 [Google Scholar] [Crossref]

2. Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J., Devin, M., Ghemawat, S., Irving, G., Isard, M., Kudlur, M., Levenberg, J., Monga, R., Moore, S., Murray, D. G., Steiner, B., Tucker, P., Vasudevan, V., Warden, P., … Zheng, X. (2016). TensorFlow: A System for Large-Scale Machine Learning. Proceedings of the 12th USENIX Conference on Operating Systems Design and Imple-mentation, OSDI’16, 265–283. [Google Scholar] [Crossref]

3. Ahmad, R. A., Azhar, M., & Sattar, H. (2023). An Image captioning algorithm based on the Hybrid Deep Learning Technique (CNN+GRU). https://doi.org/10.48550/arxiv.2301.02440 [Google Scholar] [Crossref]

4. Anderson, R. H. (1967). Syntax-directed recognition of hand-printed two-dimensional mathematics. Interactive Systems for Experimental Applied Mathematics - Proceedings of the Association for Computing Machinery Inc. Symposium, ACM 1967, 436–459. https://doi.org/10.1145/2402536.2402585 [Google Scholar] [Crossref]

5. Bahdanau, D., Cho, K. H., & Bengio, Y. (2014). Neural Machine Translation by Jointly Learning to Align and Translate. 3rd International Conference on Learning Representations, ICLR 2015 - Con-ference Track Proceedings. https://doi.org/10.48550/arxiv.1409.0473 [Google Scholar] [Crossref]

6. Bitterman, D. S., Goldner, E., Finan, S., Harris, D., Durbin, E. B., Hochheiser, H., Warner, J. L., Mak, R. H., Miller, T., & Savova, G. K. (2023). An end-to-end natural language processing system for automatically extracting radiotherapy events from clinical texts: NLP to extract radiotherapy events from text. International Journal of Radiation Oncology*Biology*Physics. https://doi.org/10.1016/J.IJROBP.2023.03.055 [Google Scholar] [Crossref]

7. Chen, L., Chen, W., Wang, L., Zhai, C., Hu, X., Sun, L., Tian, Y., Huang, X., & Jiang, L. (2023). Convolutional neural networks (CNNs)-based multi-category damage detection and recognition of high-speed rail (HSR) reinforced concrete (RC) bridges using test images. Engineering Structures, 276, 115306. https://doi.org/10.1016/J.ENGSTRUCT.2022.115306 [Google Scholar] [Crossref]

8. Cho, K., van Merrienboer, B., Bahdanau, D., & Bengio, Y. (2014). On the Properties of Neural Machine Translation: Encoder-Decoder Approaches. [Google Scholar] [Crossref]

9. Cho, K., van Merrienboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., & Bengio, Y. (2014). Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation. [Google Scholar] [Crossref]

10. Deng, Y., Kanervisto, A., Ling, J., & Rush, A. M. (2017). Image-to-Markup Generation with Coarse-to-Fine Attention. [Google Scholar] [Crossref]

11. Deng, Y., Kanervisto, A., & Rush, A. M. (2016). What You Get Is What You See: A Visual Markup Decompiler. CoRR, abs/1609.04938. [Google Scholar] [Crossref]

12. Emily, E., & Sophie Alpert. (n.d.). KaTeX – The fastest math typesetting library for the web. Re-trieved December 21, 2022, from https://katex.org/ [Google Scholar] [Crossref]

13. Goldberg, Y. (2017). Neural Network Methods for Natural Language Processing. Synthesis Lectures on Human Language Technologies. https://doi.org/10.1007/978-3-031-02165-7 [Google Scholar] [Crossref]

14. Graves, A. (2012). Sequence Transduction with Recurrent Neural Networks. [Google Scholar] [Crossref]

15. He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep residual learning for image recognition. Pro-ceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2016-December, 770–778. https://doi.org/10.1109/CVPR.2016.90 [Google Scholar] [Crossref]

16. Ilya, S., SchulmanTim, S., & Durk, K. (2018, January 31). Requests for Research 2.0. https://openai.com/blog/requests-for-research-2/#im2latex [Google Scholar] [Crossref]

17. Jaderberg, M., Simonyan, K., Vedaldi, A., & Zisserman, A. (2014a). Deep Structured Output Learning for Unconstrained Text Recognition. 3rd International Conference on Learning Represen-tations, ICLR 2015 - Conference Track Proceedings. https://doi.org/10.48550/arxiv.1412.5903 [Google Scholar] [Crossref]

18. Jaderberg, M., Simonyan, K., Vedaldi, A., & Zisserman, A. (2014b). Reading Text in the Wild with Convolutional Neural Networks. International Journal of Computer Vision, 116(1), 1–20. https://doi.org/10.48550/arxiv.1412.1842 [Google Scholar] [Crossref]

19. Kanervisto, A. (2016). im2latex-100k , arXiv:1609.04938. https://doi.org/10.5281/ZENODO.56198 [Google Scholar] [Crossref]

20. Khurana, D., Koli, A., Khatter, K., & Singh, S. (2022). Natural language processing: state of the art, current trends and challenges. Multimedia Tools and Applications, 1–32. https://doi.org/10.1007/S11042-022-13428-4/FIGURES/3 [Google Scholar] [Crossref]

21. Kingma, D. P., & Ba, J. (2014). Adam: A Method for Stochastic Optimization. [Google Scholar] [Crossref]

22. Lee, C.-Y., & Osindero, S. (2016). Recursive Recurrent Nets with Attention Modeling for OCR in the Wild. [Google Scholar] [Crossref]

23. Li, B., Yuan, Y., Liang, D., Liu, X., Ji, Z., Bai, J., Liu, W., & Bai, X. (2022). When Counting Meets HMER: Counting-Aware Network for Handwritten Mathematical Expression Recognition. [Google Scholar] [Crossref]

24. Li, Z., Jin, L., Lai, S., & Zhu, Y. (2020). Improving Attention-Based Handwritten Mathematical Expression Recognition with Scale Augmentation and Drop Attention. [Google Scholar] [Crossref]

25. Lin, Z., Li, J., Yang, F., Huang, S., Yang, X., Lin, J., & Yang, M. (2023). Spatial Attention and Syntax Rule Enhanced Tree Decoder for Offline Handwritten Mathematical Expression Recognition. ArXiv, 13639 LNCS, 213–227. https://doi.org/10.1007/978-3-031-21648-0_15 [Google Scholar] [Crossref]

26. Liu, Y., Young, R., & Jafarpour, B. (2023). Long–short-term memory encoder–decoder with regu-larized hidden dynamics for fault detection in industrial processes. Journal of Process Control, 124, 166–178. https://doi.org/https://doi.org/10.1016/j.jprocont.2023.01.015 [Google Scholar] [Crossref]

27. Luong, M.-T., Pham, H., & Manning, C. D. (2015). Effective Approaches to Attention-based Neural Machine Translation. [Google Scholar] [Crossref]

28. Martinez, Q., Chen, C., Xia, J., & Bahai, H. (2023). Sequence-to-Sequence Change-Point Detection in Single-Particle Trajectories via Recurrent Neural Network for Measuring Self-Diffusion. Transport in Porous Media, 147(3), 679–701. https://doi.org/10.1007/S11242-023-01923-7/FIGURES/21 [Google Scholar] [Crossref]

29. Niu, Z., Zhong, G., Yue, G., Wang, L.-N., Yu, H., Ling, X., & Dong, J. (2023). Recurrent attention unit: A new gated recurrent unit for long-term memory of important parts in sequential data. Neu-rocomputing, 517, 1–9. https://doi.org/https://doi.org/10.1016/j.neucom.2022.10.050 [Google Scholar] [Crossref]

30. Orji, E. Z., & Alienyi, D. C. (n.d.). Image-to-LaTeX Basic Mathematical Equation. Retrieved De-cember 21, 2022, from https://github.com/everistus-orji/image-to-latex-basic-math-equation/blob/main/dataset.zip [Google Scholar] [Crossref]

31. Orji, E. Z., Haydar, A., & Erşan, İ. (2024). Inception-Transformer: End-To-End Printed Mathematical Expression Recognition Using Convolutional and Transformer Networks. Nanotechnology Perceptions, 20(6), 2672–2690. https://doi.org/10.62441/NANO-NTP.VI.3274 [Google Scholar] [Crossref]

32. Orji, E. Z., Haydar, A., Erşan, İ., & Mwambe, O. O. (2023). Advancing OCR Accuracy in Im-age-to-LaTeX Conversion—A Critical and Creative Exploration. Applied Sciences 2023, Vol. 13, Page 12503, 13(22), 12503. https://doi.org/10.3390/APP132212503 [Google Scholar] [Crossref]

33. Papineni, K., Roukos, S., Ward, T., & Zhu, W.-J. (2002). Bleu: a Method for Automatic Evaluation of Machine Translation. Annual Meeting of the Association for Computational Linguistics. [Google Scholar] [Crossref]

34. Schaefer, A. M., Udluft, S., & Zimmermann, H. G. (2008). Learning long-term dependencies with recurrent neural networks. Neurocomputing, 71(13–15), 2481–2488. https://doi.org/10.1016/J.NEUCOM.2007.12.036 [Google Scholar] [Crossref]

35. Sutskever, I., Vinyals, O., & Le, Q. V. (2014). Sequence to Sequence Learning with Neural Networks. Advances in Neural Information Processing Systems, 4(January), 3104–3112. https://doi.org/10.48550/arxiv.1409.3215 [Google Scholar] [Crossref]

36. Suzuki, M., Tamari, F., Fukuda, R., Uchida, S., & Kanahori, T. (2003). INFTY - An integrated OCR system for mathematical documents. In C. Vanoirbeek, C. Roisin, & E. Munson (Eds.), Proceedings of the 2003 ACM Symposium on Document Engineering (pp. 95–104). [Google Scholar] [Crossref]

37. Teslya, N., & Mohammed, S. (2022). Deep Learning for Handwriting Text Recognition: Existing Approaches and Challenges. 2022 31st Conference of Open Innovations Association (FRUCT), 2022-April, 339–346. https://doi.org/10.23919/FRUCT54823.2022.9770912 [Google Scholar] [Crossref]

38. Thakur, U., & Sharma, A. (2022). Offline Handwritten Mathematical Recognition using Adversarial Learning and Transformers. ArXiv. https://doi.org/10.48550/ARXIV.2208.09662 [Google Scholar] [Crossref]

39. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Po-losukhin, I. (2017). Attention Is All You Need. [Google Scholar] [Crossref]

40. Wang, J., Sun, Y., & Wang, S. (2019). Image To Latex with DenseNet Encoder and Joint Attention. Procedia Computer Science, 147, 374–380. https://doi.org/10.1016/J.PROCS.2019.01.246 [Google Scholar] [Crossref]

41. Wang, T., Wu, D. J., Coates, A., & Ng, A. (2012). End-to-end text recognition with convolutional neural networks. Proceedings of the 21st International Conference on Pattern Recognition (ICPR2012). [Google Scholar] [Crossref]

42. Yan, Z., Zhang, X., Gao, L., Yuan, K., & Tang, Z. (2020). ConvMath: A Convolutional Sequence Network for Mathematical Expression Recognition. 2020 25th International Conference on Pattern Recognition (ICPR), 4566–4572. [Google Scholar] [Crossref]

43. Yuan, Y., Liu, X., Dikubab, W., Liu, H., Ji, Z., Wu, Z., & Bai, X. (2022). Syntax-Aware Network for Handwritten Mathematical Expression Recognition. 2022 IEEE/CVF Conference on Computer Vi-sion and Pattern Recognition (CVPR), 2022-June, 4543–4552. https://doi.org/10.1109/CVPR52688.2022.00451 [Google Scholar] [Crossref]

44. Zhang, J., Du, J., Zhang, S., Liu, D., Hu, Y., Hu, J., Wei, S., & Dai, L. (2017). Watch, attend and parse: An end-to-end neural network based approach to handwritten mathematical expression recognition. Pattern Recognition, 71, 196–206. https://doi.org/https://doi.org/10.1016/j.patcog.2017.06.017 [Google Scholar] [Crossref]

Metrics

Views & Downloads

Similar Articles

Engineering,
Management &
Applied Science
Journal
(IJLTEMAS)
Published by RSIS International
Tower B, Suncity Success Tower
Golf Course Ext Rd, Sector 65
Gurugram, Haryana 122101, India
© 2026 IJLTEMAS · RSIS International. ISSN 2278-2540.