Tex2Rmd, a software to convert  a standard LaTex file to Rmarkdown file  © Lakshmi K. Raut 2020

I love reading research articles and books typeset with LaTex in pdf format. I also love these articles in html format which has its own charms.   Quite a few times, the work place, or some publishers require documents to be prepared in the Microsoft Word format.  It has been always a struggle to find an open source software to convert LaTex document with maths, figures and equations to Microsoft word and html formats in a straightforward way. Part of my work involves statistical and econometric analysis using various statistical softwares on Big Data using SAS, R and more recently Python.  Many times, I struggled to recollect which paper involved what codes using which software.  Moreover, when I modify the dataset, I end up manually change all the tables, figures and reference to the estimates in the text body. Simply gruesome.  I then came across the R markdown document processing system which can create a document embedding R and other software codes directly in the R markdown document and then apply knitr (which in the backend uses Tex processing system, pandoc, and other R packages) to convert the R markdown document to html, word and pdf (or LaTex) documents.  It can also produce other formats. This is part of what is known as Reproducible Research which many journals and publishers insist one to provide.  Let me raise warnings here, you may have to tweak the converted Microsoft Word and LaTex documents to make them look nicer.  But those can be done at the final production stage and generally require very little effort.

You can prepare your document in R markdown format from the beginning. But many of us have written papers in LaTex and need to convert them to other formats.  So, using my spare time, I wrote this little package Tex2Rmd using C++ and Java.  This package is just a single executable file and can be run in 32bit or 64bit Windows systems or on a 64bit Linux system. All you need is just download the executable file for your operating system and run it on your LaTex document.  I also provide a mini guide and examples below. 

Disclaimer and Limitations: The program currently is able to convert  Equations (displayed and inline), Figures (Tikz and png graphics).
For tables,  it creates only a template with caption and label. Reference to a table, figure, equation, theorem, remark and many more LaTex environments is  converted throughout in the converted R markdown documents. (To do it manually has been really painstaking, so I do it here programmatically). The user can prepare the table body programmatically using various R packages for nice looking tables either running R/Python codes on the dataset or linking to the excel, csv files with the table elements. I created this software for my own use to take care of the above worries I had.  I am sharing it online for  the world if others like to use it to their advantage.  I am  not accountable if it does not produce results to your satisfaction.  Your comments are always welcome, I will try to incorporate those during my free time.

Downloads: Go to the page https://github.com/lakshmiraut/Tex2Rmd/releases/tag/V0.1 which has all the materials you need. I just link those and a few other files here.

Click to download:  [32bit or 64bit  Tex2Rmd executable file for the Windows operating system]  [64bit Tex2Rmd executable file for the Linux operating system]

To run it, simply type
    tex2rmd Texfilename  (for Linux you use ./tex2rmdlinux, you need to change the permission of the file to become executable)
or simply type latex2rmd and it will tell you waht to do.  For instance you can totionally provide biblatex file name and also the name and directory of R markdown file.

[View Mini Guide in html] This guide is produced converting a LaTex document using Tex2Rmd. These files are given here.
[Mini Guide LaTex file] [corresponding LaTex processed pdf output] [Rmarkdown (Rmd) file] [html file created from the Rmd file] [Microsoft word file created from the Rmd file]


Here are some complex examples, basically my own few converted papers for you to see what it can do.
  1. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - Health Outcomes in Mid-Ages: Multistate time to event Statistical Models versus Long Short Term Memory (LSTM) Recurrent Neural Network (RNN) Models
  2. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - Economic Epidemiology of Malaria and Income Growth
  3. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - A Reformulation of the Aumann-Shapley Random Order Values of Non-Atomic Games Using Invariant Measures
  4. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - A Non-standard Analysis of Aumann-Shapley Random Order Values of Non-atomic Games
  5. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - Altruism, Gaussian curvature and Pareto Optimality: An Implication for Sens Meta Ranking Ethical Principle
  6. [pdf directly from LaTex] [html using tex2Rmd on LaTex] - Early Childhood Development, Earnings Inequality and Social Mobility in an Education Signaling Model