Git Product home page Git Product logo

texor's Introduction

texor texor package hex sticker with icons showing transistion from PDF documents to web pages.

CRAN/METACRAN GitHub Workflow Status (branch) GitHub Workflow Status GitHub R package version (subdirectory of monorepo) Github Issues codecov

The R package texor will ease your LaTeX R Journal / Sweave article migration to web format by providing tools and utilities.

Installation

Install pandoc v3.1 or greater, ideally latest version. If you are using Rstudio, it should be pre-installed.

# To check the version of pandoc
rmarkdown::pandoc_version()
# or to simply check if you are good to go in terms of pandoc
texor::pandoc_version_check()
# TRUE if pandoc is good to go, else FALSE

For included PDF conversions also install poppler-utils (used with pdftools package) Ideally install the latest version of poppler-utils.

Install the mainline version from CRAN with:

install.packages('texor')

Install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("Abhi-1U/texor")
# install.packages("pak")
pak::pak("Abhi-1U/texor")

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 
texor::latex_to_web(article_dir)
# A running example
article_dir <- system.file("examples/article", package = "texor")
dir.create(your_article_folder <- file.path(tempdir(), "tempdir"))
x <- file.copy(from = article_dir, to = your_article_folder,recursive = TRUE,)
your_article_path <- paste(your_article_folder,"article",sep="/")
# view your original article at
your_article_path
#Note : Do not use example = TRUE param when working with conversions.
#  It is set TRUE here, to conform with CRAN/Build check restrictions.
texor::latex_to_web(your_article_path,log_steps = FALSE, example = TRUE)
# view  your converted and original article at
paste0(your_article_path,"/web")

Using texor over multiple files

# for multiple articles in RJ folder structure
#base dir 
article_dir <- "C:/Users/abhis/path/to/base"
# 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) {
    #print(dir)
    getwd()
    # below function will create a log file of success/error in current
    # working directory while running the texor::latex_to_web() function
    texor:::convert_to_html(dir)
}

texor's People

Contributors

abhi-1u avatar fzyxh avatar hturner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.