gorkang / html2latex

Convert sjPlot::tab_model() html tables to tex and pdf
Other
14 stars 4 forks source link

Automatic OS detection #6

Closed gorkang closed 3 years ago

gorkang commented 3 years ago

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.

tjebo commented 3 years ago

@gorkang Hi Gorka Sorry for the delay, quite busy with other stuff at the minute. I think the system recognition seems to work fine, I didn't need to specify mac=TRUE any more. However, something doesn't seem to work any more regarding looking files up, when running the example in ?html2pdf I get the error

sh: /Library/Frameworks/R.framework/Versions/4.1/Resources/library/html2latex/extdata/w2l /Users/tjebo/temp.odt: No such file or directory Error in file(con, "r") : cannot open the connection In addition: Warning messages: 1: In system2(paste0(file.path(path_w2l, w2l_file), " ", odt_file)) : error in running command 2: In file(con, "r") : cannot open file '/Users/tjebo/temp.tex': No such file or directory

whereby Users/tjebo is of course the working directory, and a file temp.odt has actually been successfully created. Not sure what is happening there and unfortunately I currently have not much time to look into it. Might hopefully be able to do in a few weeks time :)

VincentTennanty commented 3 years ago

Hi Just wondering is there any fix for this? html2pdf() doesnt work. Error is cannot open the connection.

Current work around for me is copying and pasting odt output from into word doc and saving as pdf.

Thanks in advamce

gorkang commented 3 years ago

Sorry about that. I switched to system2 and left the wrong syntax when silent == TRUE.

Should work now.

VincentTennanty commented 3 years ago

No worries. Il try again and post back. Thank you