Dear All I was trying the supplementary file?GS_main.R from https://esajournals.onlinelibrary.wiley.com/doi/abs/10.1002/ecy.3475 I have tried to prevent latex compilation from failing using Sweave after trying all the online fixes I could find including using Rterm? I could fix it if it was in the input but not in the output? I am using R version 4.2 on windows 11 with 64 GB memory Sweave code \begin{small} <<r0>>library(emdbook) # version 1.3.12 library(bbmle) # version 1.0.23.1 library(pbmcapply) # version 1.5.0? library(tidyverse) # version 1.3.0 library(ggpubr) # version 0.4.0 @ %% <<r7>>summaryTable <- tibble(model = m.names, ? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? ? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? ? ? ? ?delScore = score - min(score),? ? ? ? ? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? ? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = 1:length(dim)) summaryTable @ %% Output \begin{Schunk} \begin{Sinput} ? summaryTable <- ? tibble(model = m.names, ? ? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? ? ? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? ? ? ? ? ?delScore = score - min(score),? ? ? ? ? ? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? ? ? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = 1:length(dim)) ? summaryTable \end{Sinput} \begin{Soutput} # A tibble: 10 ? 7 ? ?model? ?dim score delScore se_ose se_mod index ? ?<chr> <int> <dbl>? ? <dbl>? <dbl>? <dbl> <int> ?1 zero? ? ? 2? 908.? ? 5.84? ? 40.1? ?4.14? ? ?1 ?2 d? ? ? ? ?3? 904.? ? 1.71? ? 40.6? ?2.52? ? ?2 ?3 q? ? ? ? ?3? 907.? ? 4.92? ? 40.2? ?3.80? ? ?3 ?4 qd? ? ? ? 4? 902.? ? 0? ? ? ?40.7? ?0? ? ? ? 4 ?5 qdi? ? ? ?5? 903.? ? 0.632? ?40.5? ?1.60? ? ?5 ?6 x? ? ? ? ?6? 908.? ? 5.58? ? 40.2? ?5.53? ? ?6 ?7 xq? ? ? ? 7? 907.? ? 4.81? ? 40.3? ?5.36? ? ?7 ?8 xd? ? ? ? 7? 905.? ? 2.96? ? 40.5? ?5.04? ? ?8 ?9 xqd? ? ? ?8? 903.? ? 0.908? ?40.5? ?4.52? ? ?9 10 xqdi? ? ? 9? 904.? ? 1.89? ? 40.4? ?4.70? ? 10 \end{Soutput} \end{Schunk} The problem is the output from tibble? # A tibble: 10 ? 7 the \times character is Unicode?U+00D7 or hex \xd7 and pdflatex lualatex etc fail where this occurs Is there a way of adding "sanitizing" code in the output before compiling? Or do I have to change it manually before compiling I do not want to switch to knitr.? Regards Duncan Mackay [[alternative HTML version deleted]]
Are you aware that pdfLatex does not support Unicode? You need to use xeLatex. But I don't use Sweave, so I don't know how you go about making that choice. On August 24, 2022 8:03:02 PM PDT, dulcalma dulcalma <dulcalma at bigpond.com> wrote:> >Dear All > > >I was trying the supplementary file?GS_main.R from >https://esajournals.onlinelibrary.wiley.com/doi/abs/10.1002/ecy.3475 > >I have tried to prevent latex compilation from failing using Sweave >after trying all the online fixes I could find including using Rterm? >I could fix it if it was in the input but not in the output? >I am using R version 4.2 on windows 11 with 64 GB memory > > >Sweave code > >\begin{small} ><<r0>>>library(emdbook) # version 1.3.12 >library(bbmle) # version 1.0.23.1 >library(pbmcapply) # version 1.5.0? >library(tidyverse) # version 1.3.0 >library(ggpubr) # version 0.4.0 >@ %% > > ><<r7>>>summaryTable <- >tibble(model = m.names, >? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? >? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? >? ? ? ?delScore = score - min(score),? ? ? ? >? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? >? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = >1:length(dim)) >summaryTable >@ %% > > >Output >\begin{Schunk} >\begin{Sinput} >? summaryTable <- >? tibble(model = m.names, >? ? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? >? ? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? >? ? ? ? ?delScore = score - min(score),? ? ? ? >? ? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? >? ? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = >1:length(dim)) >? summaryTable >\end{Sinput} >\begin{Soutput} ># A tibble: 10 ? 7 >? ?model? ?dim score delScore se_ose se_mod index >? ?<chr> <int> <dbl>? ? <dbl>? <dbl>? <dbl> <int> >?1 zero? ? ? 2? 908.? ? 5.84? ? 40.1? ?4.14? ? ?1 >?2 d? ? ? ? ?3? 904.? ? 1.71? ? 40.6? ?2.52? ? ?2 >?3 q? ? ? ? ?3? 907.? ? 4.92? ? 40.2? ?3.80? ? ?3 >?4 qd? ? ? ? 4? 902.? ? 0? ? ? ?40.7? ?0? ? ? ? 4 >?5 qdi? ? ? ?5? 903.? ? 0.632? ?40.5? ?1.60? ? ?5 >?6 x? ? ? ? ?6? 908.? ? 5.58? ? 40.2? ?5.53? ? ?6 >?7 xq? ? ? ? 7? 907.? ? 4.81? ? 40.3? ?5.36? ? ?7 >?8 xd? ? ? ? 7? 905.? ? 2.96? ? 40.5? ?5.04? ? ?8 >?9 xqd? ? ? ?8? 903.? ? 0.908? ?40.5? ?4.52? ? ?9 >10 xqdi? ? ? 9? 904.? ? 1.89? ? 40.4? ?4.70? ? 10 >\end{Soutput} >\end{Schunk} > > >The problem is the output from tibble? ># A tibble: 10 ? 7 > > >the \times character is Unicode?U+00D7 or hex \xd7 and pdflatex lualatex >etc fail where this occurs >Is there a way of adding "sanitizing" code in the output before >compiling? >Or do I have to change it manually before compiling > > >I do not want to switch to knitr.? > > >Regards > > >Duncan Mackay > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
On Thu, 25 Aug 2022, dulcalma dulcalma writes:> Dear All > > > I was trying the supplementary file?GS_main.R from > https://esajournals.onlinelibrary.wiley.com/doi/abs/10.1002/ecy.3475 > > I have tried to prevent latex compilation from failing using Sweave > after trying all the online fixes I could find including using Rterm? > I could fix it if it was in the input but not in the output? > I am using R version 4.2 on windows 11 with 64 GB memory > > > Sweave code > > \begin{small} > <<r0>>> library(emdbook) # version 1.3.12 > library(bbmle) # version 1.0.23.1 > library(pbmcapply) # version 1.5.0? > library(tidyverse) # version 1.3.0 > library(ggpubr) # version 0.4.0 > @ %% > > > <<r7>>> summaryTable <- > tibble(model = m.names, > ? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? > ? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? > ? ? ? ?delScore = score - min(score),? ? ? ? > ? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? > ? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = > 1:length(dim)) > summaryTable > @ %% > > > Output > \begin{Schunk} > \begin{Sinput} > ? summaryTable <- > ? tibble(model = m.names, > ? ? ? ? ?dim = m.dims[model],? ? ? ? ? ? ? ? ? > ? ? ? ? ?score = m.loo[model],? ? ? ? ? ? ? ?? > ? ? ? ? ?delScore = score - min(score),? ? ? ? > ? ? ? ? ?se_ose = se_ose[model],? ? ? ? ? ? ?? > ? ? ? ? ?se_mod = se_mod[model]) %>% arrange(dim) %>%? mutate(index = > 1:length(dim)) > ? summaryTable > \end{Sinput} > \begin{Soutput} > # A tibble: 10 ? 7 > ? ?model? ?dim score delScore se_ose se_mod index > ? ?<chr> <int> <dbl>? ? <dbl>? <dbl>? <dbl> <int> > ?1 zero? ? ? 2? 908.? ? 5.84? ? 40.1? ?4.14? ? ?1 > ?2 d? ? ? ? ?3? 904.? ? 1.71? ? 40.6? ?2.52? ? ?2 > ?3 q? ? ? ? ?3? 907.? ? 4.92? ? 40.2? ?3.80? ? ?3 > ?4 qd? ? ? ? 4? 902.? ? 0? ? ? ?40.7? ?0? ? ? ? 4 > ?5 qdi? ? ? ?5? 903.? ? 0.632? ?40.5? ?1.60? ? ?5 > ?6 x? ? ? ? ?6? 908.? ? 5.58? ? 40.2? ?5.53? ? ?6 > ?7 xq? ? ? ? 7? 907.? ? 4.81? ? 40.3? ?5.36? ? ?7 > ?8 xd? ? ? ? 7? 905.? ? 2.96? ? 40.5? ?5.04? ? ?8 > ?9 xqd? ? ? ?8? 903.? ? 0.908? ?40.5? ?4.52? ? ?9 > 10 xqdi? ? ? 9? 904.? ? 1.89? ? 40.4? ?4.70? ? 10 > \end{Soutput} > \end{Schunk} > > > The problem is the output from tibble? > # A tibble: 10 ? 7 > > > the \times character is Unicode?U+00D7 or hex \xd7 and pdflatex lualatex > etc fail where this occurs > Is there a way of adding "sanitizing" code in the output before > compiling? > Or do I have to change it manually before compiling > > > I do not want to switch to knitr.? > > > Regards > > > Duncan Mackay >You could try to automatically clean the code, by using ?iconv, say. But the results by not be satisfactory, depending on what characters were used. Sweave itself does not compile the LaTeX code. If you run (in R) Sweave(<filename.Rnw>, encoding = "utf8") then it will produce the TeX file, which you can then compile via LuaLaTeX or XeLaTeX [see e.g. https://www.ctan.org/pkg/lualatex-doc]. For instance, on the command line, just say lualatex <filename.tex> or another programme (such as latexmk) that your TeX distribution provides. If this is a vignette, you can specify a Makefile, see https://cran.r-project.org/doc/manuals/R-exts.html#Writing-package-vignettes> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net