Skip to contents

texor is a package that deals with multiple challenges that occour in conversion of LaTeX source files (which typically generate a PDF) to a web friendly RJ-web-article format.

Currently texor can handle R-Journal structured LaTeX files with support for:

  1. RJournal based LaTeX files with macros such as \pkg{},\CRANpkg{},\BIOpkg{}, \code{}, \acronym{}
  2. Reading Metadata from LaTeX file as well as DESCRIPTION.
  3. Reading bibliography from bibtex files and ignoring \thebibliography
  4. Supports code environments like Sinput,Soutput, example ,example*,verbatim, smallverbatim with code highlight.
  5. Supports graphics included as PDF, PNG, JPG, tikz, algorithm2e graphics supported (some figures might not work).
  6. Functions to convert PDF graphics to PNG.
  7. Almost all tables are supported with a few exceptions.
  8. Other things like citations,links,footnotes,math,CTV,package references are also supported.
  9. A parser to read and minimally convert inbuilt \thebibliography to bibtex (moved to rebib)
  10. Figure/Table/Equation numbering
  11. Stream Editor to rename alien commands/environments to accepted defaults.
  12. Pre and Post conversion statistics of environments for verification.
  13. Bibliography aggregation.(moved to rebib)
  14. Tikz,algorithm graphics supported (some figures might not work)
  15. Logging of events.

texor features

Note :

Update : relative paths should also work with current development version.

Please use absolute paths when working with texor/rebib !

The reason is that earlier texor used to work with relative paths by using setwd(), getwd() to handle working directories. However this was not an ideal method to handle paths and working on files.

Hence I had to switch to absolute path system for almost all functions where automation is possible and works well. As there was no changing of working directories there is less risk of setting up a wrong working directory when failing certain function.

Use forward slashes (/) in paths and do not add a forward slash at the end of the path for example

  1. Wrong usage : C:\projects\texor\main
  2. wrong usage : C:/projects/texor/main/
  3. wrong usage : C:\\projects\\texor\\main\\
  4. wrong usage : C:\\projects\\texor\\main (this may work with R)
  5. Correct usage : C:/projects/texor/main


install these dependency packages (github development versions)

# install.packages("remotes")

install the development version from GitHub with:

# install.packages("remotes")
# install.packages("pak")
# also install rebib for bibliography

General Usage

here is a quick example to use texor package with a sample RJournal article (included with the package inst/article)

# for a single LaTeX article 
# for multiple articles in RJ folder structure

#base dir 
article_dir <- "C:/Users/abhis/Documents/projects/gsoc-2022/original"
# list of journal number directories
journal_dirs <- list.dirs(article_dir,recursive = FALSE)
# list of individual slug directories
slug_dirs <- lapply(journal_dirs,function(journal_dir) {
    list.dirs(journal_dir,recursive = FALSE)
# creating a single list of all slug directories
slug_dirs <- unlist(slug_dirs)
# Calling 
for (dir in slug_dirs) {
    # below function will create a log file of success/error in current
    # working directory while running the texor::latex_to_web() function