Coder Social home page Coder Social logo

html2latex's People

Contributors

gorkang avatar tjebo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

html2latex's Issues

How to add label in a generated latex file?

Load html2pdf.R function

source("R/html2pdf.R")

Create tex and pdf

html2pdf(filename = "temp.html", page_width = 13, build_pdf = TRUE, silent = TRUE)

It seems a table label doesn't work after manually adding \label in temp.tex.

'soffice' not found

I'm having the same issue as the previous issue (that has since been closed), but installing LibreOffice has not solved it. The full error is:

Error in system(paste(soffice, "--convert-to odt", filename), intern = TRUE) : 
  'soffice' not found

If I modify the function and use the Mac = TRUE option to force soffice to point to the file path location on my PC (C:/Program Files/LibreOffice/program/soffice.exe), it gives a different error:

Error in system(paste0(file.path(path_w2l, w2l_file), " ", odt_file),  : 
  'C:/Users/[Username]/Documents/R/win-library/4.0/html2latex/extdata/w2l' not found

though w2l (and writer2latex.jar) are both in the listed directory.

Automatic OS detection

I just implemented a simple OS detection with Sys.info()["sysname"] and adapted the code to change the relevant bits depending on the OS detected.

@tjebo , I am not sure if I used the proper identifier for macOS (OS == "Darwin" | OS == "macOS"), and I have no way to test it. If you could install the latest version remotes::install_github("gorkang/html2latex") and give it a try, it would be awesome.

Seems to work fine on Linux and Windows.

Latex table label

A latex file temp.tex can be generated as follows. However, the file doesn't have label, which should be quite useful in a latex file.

'''
library(html2latex)
library(lme4)
library(sjPlot)

This is a terrible model

model = lmer(mpg ~ cyl * disp + (1|vs), mtcars)

We save the sjPlot table to an .html file

TAB = sjPlot::tab_model(
model,
show.r2 = TRUE,
show.icc = FALSE,
show.re.var = FALSE,
p.style = "scientific",
emph.p = TRUE,
file = "temp.html")
html2pdf(filename = "temp.html",
table_width = 13,
silent = TRUE,
style = TRUE,
build_pdf = TRUE,
clean = TRUE)
'''

html2pdf() throws error "sh: soffice: command not found"

Trying to run the example given in the README,
just replacing lmer by lm for convenience.

OS is MacOS Big Sure Version 11.3 Beta

model = lm(mpg ~ cyl * disp + (1|vs), mtcars)

# We save the sjPlot table to an .html file
sjPlot::tab_model(
  model,
  show.r2 = TRUE,
  show.icc = FALSE,
  show.re.var = FALSE,
  p.style = "scientific",
  emph.p = TRUE,
  file = "temp.html")

library(html2latex)
# Create tex and pdf
html2pdf(filename = "temp.html", 
         table_width = 13, 
         silent = TRUE, 
         style = TRUE, 
         build_pdf = TRUE, 
         clean = TRUE)

This throws the following error:

sh: soffice: command not found
Error in system(paste(soffice, "--convert-to odt", filename), intern = TRUE) : 
  error in running command

Connection Error

Hi,

I get the error below trying to convert my model.

Snip20220820_1

How can I resolve this?

TAB = sjPlot::tab_model doesn't generate html

From the tutorial on Windows
TAB = sjPlot::tab_model(
model,
show.r2 = TRUE,
show.icc = FALSE,
show.re.var = FALSE,
p.style = "scientific",
emph.p = TRUE,
file = "temp.html") doesnt generate the html, only when its not assigned.

Is that on purpose?

paths to tex cannot contain blank space

Hi

thx for this. I just wanted to flag that on Windows the Tex conversion didn't like it when there was spaces on the path leading to the table. The ODT could however cope with it.

output for collapsed SE or CI

For collapse.se=TRUE or collapse.ci=TRUE in sjPlot::tab_model(), the tex output of html2pdf() does not show the collapsed statistics in separate rows.

Not working

Hey,
I tried out your function but it doesnt't work. Am I doing something wrong? Heres what I go
Bildschirmfoto 2021-10-22 um 08 47 05
t

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.