Paths when using Windows
Inferrator opened this issue · 10 comments
When using texPreview in Windows, I get an error message
Error in tex_image(obj, stem, write_flag, overwrite) : pdf not rendered
So I ran it with cleanup=F
and found that the tex_tempDoc file uses \
instead of /
in the path. So no wonder it doesn't compile.
thank you for raising this issue.
can you attach the code that is creating the error and devtools::session_info()
please. There are no explicit paths set in the package in order to have it be OS compatible.
Sure. Let me first provide a screenshot that documents everything:
https://imgur.com/a/PGbUrOO
Now for session info. I just realized that it is version 1.2.3, but that was the latest from CRAN.
> devtools::session_info()
- Session info ---------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
os Windows 7 x64 SP 1
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/New_York
date 2019-01-05
- Packages -------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.0)
backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.2)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.0)
callr 3.1.1 2018-12-21 [1] CRAN (R 3.5.2)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.2)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.0)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.0)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.2)
fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.0)
knitr 1.21 2018-12-10 [1] CRAN (R 3.5.1)
magick 2.0 2018-10-05 [1] CRAN (R 3.5.2)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.2)
pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.2)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.2)
pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.2)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.2)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)
processx 3.2.1 2018-12-05 [1] CRAN (R 3.5.1)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.2)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.2)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1)
rematch2 2.0.1 2017-06-20 [1] CRAN (R 3.5.2)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.2)
rlang 0.3.0.1 2018-10-25 [1] CRAN (R 3.5.1)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
rstudioapi 0.8 2018-10-02 [1] CRAN (R 3.5.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.2)
svgPanZoom 0.3.3 2016-09-26 [1] CRAN (R 3.5.2)
texPreview * 1.2.3 2018-10-25 [1] CRAN (R 3.5.2)
tibble 2.0.0 2019-01-04 [1] CRAN (R 3.5.1)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.2)
whisker 0.3-2 2013-04-28 [1] CRAN (R 3.5.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)
xfun 0.4 2018-10-23 [1] CRAN (R 3.5.1)
xml2 1.2.0 2018-01-24 [1] CRAN (R 3.5.0)
yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.2)
thank you
so the github release should fix this issue.
if you could check it using
remotes::install_github('metrumresearchgroup/texPreview')
We are submitting a new version to CRAN soon, this bug will prompt the submission sooner rather than later.
I am still seeing the exact same issue. Absolute path in the tex_tempDoc.tex
file, and with \
instead of /
I think I know why. Take a look at build_lines.R
, line 45
input_path <- normalizePath(file.path(fileDir,sprintf('%s.tex',stem)))
normalizePath
is putting the windows backslashes in. It defaults to winslash = "\\"
- which is creating the problem. Easy to fix. I'd do a pull request, but I am on my windows machine now where I haven't set up git yet.
Updated session info
setting value
version R version 3.5.1 (2018-07-02)
os Windows 7 x64 SP 1
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/New_York
date 2019-01-05
- Packages --------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.0)
backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.2)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.0)
callr 3.1.1 2018-12-21 [1] CRAN (R 3.5.2)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.2)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.0)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.0)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.2)
fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.0)
knitr 1.21 2018-12-10 [1] CRAN (R 3.5.1)
magick 2.0 2018-10-05 [1] CRAN (R 3.5.2)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.2)
pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.2)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.2)
pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.2)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.2)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)
processx 3.2.1 2018-12-05 [1] CRAN (R 3.5.1)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.2)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.2)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1)
rematch2 2.0.1 2017-06-20 [1] CRAN (R 3.5.2)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.2)
rlang 0.3.0.1 2018-10-25 [1] CRAN (R 3.5.1)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
rstudioapi 0.8 2018-10-02 [1] CRAN (R 3.5.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.2)
svgPanZoom 0.3.3 2016-09-26 [1] CRAN (R 3.5.2)
texPreview * 1.3.0 2019-01-06 [1] Github (metrumresearchgroup/texPreview@c51a665)
tibble 2.0.0 2019-01-04 [1] CRAN (R 3.5.1)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.2)
whisker 0.3-2 2013-04-28 [1] CRAN (R 3.5.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)
xfun 0.4 2018-10-23 [1] CRAN (R 3.5.1)
xml2 1.2.0 2018-01-24 [1] CRAN (R 3.5.0)
yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.2)
tex_tempDoc.tex file (and I cleaned the directory, so it came from the 1.3 version)
\documentclass[varwidth, border={ 10 5 10 5 }]{standalone}
\usepackage[usenames,dvispnames,svgnames,table]{xcolor}
\usepackage{multirow}
\usepackage{helvet}
\usepackage{amsmath}
\usepackage{rotating}
\usepackage{listings}
\usepackage{graphicx}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{setspace}
\usepackage{caption}
\captionsetup{labelformat=empty}
\begin{document}
\input{ S:\RProjects\bugfixing\tex_temp.tex }
\end{document}
can you paste the output from .Platform
from your windows session. thanks
Yes, it works. winslash = '/'
fixed the issue, i.e.
input_path <- normalizePath(file.path(fileDir,sprintf('%s.tex',stem)),winslash = '/')
I haven't tested if it still works on linux, but I don't see why not.
.Platform
$`OS.type`
[1] "windows"
$file.sep
[1] "/"
$dynlib.ext
[1] ".dll"
$GUI
[1] "RStudio"
$endian
[1] "little"
$pkgType
[1] "win.binary"
$path.sep
[1] ";"
$r_arch
[1] "x64"
I think this is ready for CRAN. Btw, I love the package.
great.
We'll try to push out the update to CRAN this week.
Glad you like the package.