I am trying to compile an Rsweave document. I recently migrated from a Macbook to a Thinkpad running rhel.
Previously on my macbook after simply downloading and in stalling the fonts, a document wih the following header would compile.
\documentclass[titlepage]{article}
\usepackage[T1]{fontenc}
\usepackage[usefilenames,DefaultFeatures={Ligatures=Common}]{plex-otf} %
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
However now it returns the error plex-otf.sty not found.
I tried copying the plex-otf.sty file from the latex package into the directory with no luck.
heres the log from xelatex
This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018) (preloaded format=xelatex 2023.2.3) 3 FEB 2023 17:21
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**Onboarding.tex
(./Onboarding.tex
LaTeX2e <2017-04-15>
Babel <3.17> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c#part=\count79
\c#section=\count80
\c#subsection=\count81
\c#subsubsection=\count82
\c#paragraph=\count83
\c#subparagraph=\count84
\c#figure=\count85
\c#table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2017/04/05 v2.0i Standard LaTeX package
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def
File: t1enc.def 2017/04/05 v2.0i Standard LaTeX file
LaTeX Font Info: Redeclaring font encoding T1 on input line 48.
)
LaTeX Font Info: Try loading font information for T1+lmr on input line 105.
(/usr/share/texlive/texmf-dist/tex/latex/lm/t1lmr.fd
File: t1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
))
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2010/09/12 v5.6 Page Geometry
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV#toks#=\toks14
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
\Gm#cnth=\count87
\Gm#cntv=\count88
\c#Gm#tempcnt=\count89
\Gm#bindingoffset=\dimen103
\Gm#wd#mp=\dimen104
\Gm#odd#mp=\dimen105
\Gm#even#mp=\dimen106
\Gm#layoutwidth=\dimen107
\Gm#layoutheight=\dimen108
\Gm#layouthoffset=\dimen109
\Gm#layoutvoffset=\dimen110
\Gm#dimlist=\toks15
)
! LaTeX Error: File `plex-otf.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.5 \renewcommand
*\familydefault{\sfdefault} %% Only if the base font of the...
*** (cannot \read from terminal in nonstop modes)
Here is how much of TeX's memory you used:
958 strings out of 494986
12180 string characters out of 6178606
68285 words of memory out of 5000000
4860 multiletter control sequences out of 15000+600000
6638 words of font info for 16 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
23i,0n,19p,246b,74s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
How do I make latex see this package?
Related
I have an RMarkdown document with the following content:
```{r setup, include=FALSE}
library(reticulate)
```
```{r}
#These lines don't seem to make a difference, but I have seen them suggested elsewhere
reticulate::use_python('/usr/local/Cellar/python#3.8/3.8.6_2/bin/python3.8')
knitr::knit_engines$set(python = reticulate::eng_python)
```
```{r}
py <- reticulate::py
```
```{python}
import sys
sys.version
a = 1
```
```{r python from r}
print(py$a)
b <- 2
```
```{python r from python}
print(r.b)
```
If I run this in RStudio, either interactively or by knitting the whole document, everything works and the last chunk prints "2". However, when running from the R console through render (or my production script that performs regular model trainings) it fails on the last chunk with the following error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: object 'b' not found.
Detailed traceback: File "", line 1, in File
"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/reticulate/python/rpytools/call.py",
line 21, in python_function
raise RuntimeError(res[kErrorKey])
Accessing Python variables from R seems to work properly, but I cannot access R variables in Python.
I am using Reticulate 1.18, Knitr 1.30, and rMarkdown 2.6. Calling py_config() from both RStudio and the R console returns the same result:
>py_config()
python: /usr/local/Cellar/python#3.8/3.8.6_2/bin/python3.8 libpython:
/usr/local/opt/python#3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin/libpython3.8.dylib
pythonhome:
/usr/local/Cellar/python#3.8/3.8.6_2/Frameworks/Python.framework/Versions/3.8:/usr/local/Cellar/python#3.8/3.8.6_2/Frameworks/Python.framework/Versions/3.8
version: 3.8.6 (default, Nov 20 2020, 18:29:40) [Clang 12.0.0
(clang-1200.0.32.27)] numpy:
/usr/local/lib/python3.8/site-packages/numpy numpy_version: 1.18.5
NOTE: Python version was forced by RETICULATE_PYTHON
It looks like this is broken in the current version of Reticulate. I downgraded to 1.16 and that fixed it, 1.17 and later are broken. I've submitted a ticket to the devs: https://github.com/rstudio/reticulate/issues/914
Edit: This is now fixed in the latest dev version, which can be installed with remotes::install_github("rstudio/reticulate")
It happened to me because I had the stupid idea to name an object r in a RMarkdown script
```{python}
import requests
r = requests.get('http://api.worldbank.org/v2/countries?incomeLevel=LMC')
r.content
```
will work in a python interpreter but might return an error in a RMarkdown document (because reticulate looks for the object content in python environment)
Best workaround: never naming an object r when using reticulate
I can't compile a pdf using R sweave. I keep getting the following error
Latex error: file 'ae.sty' not found
\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
Hello, world.
\end{document}
Why do I keep getting this error? Do I need to install another package with pdf compilation functions?
I'm using windows, and my tex install is the package tinytex.
packs <- c("`ae.sty'","`grfext.sty'")
for (i in 1:length(packs)) {
tinytex::parse_install(text = paste('! LaTeX Error: File', packs[i],'not found.'))
}
You can use the vector to add all the packages that you may need and then use the for loop to install all them from the R terminal.
packs <- c("`setspace.sty'", "`float.sty'", "`amssymb.sty'", "`utf8.sty'", "`fancyhdr.sty'", "`tabularx.sty'", "`hyperref.sty'", "`etoolbox.sty'", "`lmodern.sty")
for (i in 1:length(packs)) {
tinytex::parse_install(text = paste('! LaTeX Error: File', packs[i],'not found.'))
}
I've faced a problem with saving plotly diagram p as html file, when the filename name is not in English:
htmlwidgets::saveWidget(p, paste0(name, "_all.html"))
For English filenames it works just fine, but when name variable contains Russian characters it fails with error:
pandoc.exe: Could not fetch 28%E1_all_files/htmlwidgets-0.9/htmlwidgets.js
28пїЅ_all_files/htmlwidgets-0.9/htmlwidgets.js: openBinaryFile:
does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
In this example
> name
[1] "28б"
Is there a way to fix that problem?
Thank You very much.
I found some errors with umlauts in comments with knitr in latex. First my mini-example:
\documentclass[12pt, % ß
a4paper % page format
]{scrartcl}
\begin{document}
<<code>>=
rnorm(30)
#
\end{document}
And this errors a shown:
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,: Running 'texi2dvi' on 'minimalexample.tex' failed. LaTeX errors: ! LaTeX Error: Environment knitrout undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... ! Undefined control sequence. l.6 \definecolor {shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{... The control sequence at the end of the top line of your error message was never \def'ed. If you have ! Undefined control sequence. l.6 ...shadecolor}{rgb}{0.969, 0.969, 0.969}\color {fgcolor}\begin{kframe} The control sequence at the end of the top line of your error message was never \def'ed. If you have ! LaTeX Error: Environment kframe undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... ! LaTeX Error: Environment alltt undefined. See the La Calls: knit2pdf -> <Anonymous> -> texi2dvi In addition: There were 13 warnings (use warnings() to see them)
Execution halted
Process exited with error(s)
I use Texstudio (V 2.9.4) as my editor and my knitr version is 1.12.3.
Is there a chance to use umlauts in comments and avoid these errors?
Ok, finally I got the solution.
It didn't affected only the comments. Every umlaut caused that Error. The file was encoded in iso-8859-1 and R was running with utf-8. I found it out in R with:
Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=de_DE.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=C"
UPDATE
I have completed the package and it is hosted online at https://github.com/iembry-USGS/ie2misc.
Since the error message in the original post was not helpful, I attempted to roxygenize the package to see if that would work or not. Below are the commands and the error message.
library(roxygen2)
roxygenize(".", roclets = "rd")
# First time using roxygen2. Upgrading automatically...
# Error in parse(n = -1, file = file, srcfile = NULL,
# keep.source = FALSE) :
# 1:1: unexpected input
# 1: �
^
I am assuming that the unexpected input is referring to a character, but I don't know which file has the character in question.
Any assistance would be helpful.
Thank you.
UPDATE End
I am working on creating a package that contains 3 functions. I've been successful at creating 3 other packages using 1 function, but not with this package.
I have included the contents of the DESCRIPTION file below. Below that content is the code and the error that I am receiving when attempting to document this package.
Thank you.
Package: ie2misc
Title: Irucka Embry's Miscellaneous functions created while he was a
CNTS USGS Contractor.
Version: 1.0.0
Authors#R: person("Irucka", "Embry", , "", c("aut", "cre"))
Depends: R (>= 3.0.0), tcltk, data.table (>= 1.9.4)
Imports: openxlsx, gWidgets2, gWidgets2tcltk, stringi, qdap
Suggests: Rcpp (>= 0.11.5)
Maintainer: Irucka Embry <iembry#usgs.gov>
Description: Irucka Embry's Miscellaneous functions (processing exp files,
psf files, etc.) created while he was a Cherokee Nation Technology Solutions
(CNTS) USGS Contractor.
URL: https://gitlab.com/iembry/ie2misc
BugReports: https://gitlab.com/iembry/ie2misc/issues
License: CC0
Collate:
'ie2misc.R'
'psfFileChangeBATCH.R'
'psfFileChange.R'
'expFileOutput.R'
LazyData: true
Encoding: UTF-8
Then I run:
setwd("ie2misc"); library(devtools); document();
Updating documentation
Loading
Error in if (pkg$package == "devtools") { : argument is of length zero
I still don't know what the problem is, but I created an empty package with library(devtools). Then, I copied most of the ie2misc files into the newly created package. I also rewrote the DESCRIPTION file in RStudio. (Usually I use the Kate text editor for working on all files for R packages.) Once those steps were completed, I was able to document, check, and build the package.