Re: [R] Unicode chars

2022-08-25 Thread dulcalma dulcalma
Thank you for the reply I tried xeLatex at least once and possibly twice 
and it failed to compile


I now tried it again and found that I had missed the inputenc error when 
I tried before.

After removing the line it now compiles.

Thank you

Regards

Duncan


-- Original Message --
From: "Jeff Newmiller" 
To: r-help@r-project.org; "dulcalma dulcalma" ; 
r-help@R-project.org

Sent: Thursday, 25 Aug, 2022 At 1:25 PM
Subject: Re: [R] Unicode chars

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 
 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}
<>=
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
@ %%


<>=
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
              
 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@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.

__
R-help@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.


Re: [R] Unicode chars

2022-08-25 Thread Richard O'Keefe
PDFLaTeX does support Latin-1, and this is a Latin-1
character.

On Thu, 25 Aug 2022 at 15:35, Jeff Newmiller 
wrote:

> 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 
> 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}
> ><>=
> >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
> >@ %%
> >
> >
> ><>=
> >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
> >  
> > 1 zero  2  908.5.8440.1   4.14 1
> > 2 d 3  904.1.7140.6   2.52 2
> > 3 q 3  907.4.9240.2   3.80 3
> > 4 qd4  902.0   40.7   04
> > 5 qdi   5  903.0.632   40.5   1.60 5
> > 6 x 6  908.5.5840.2   5.53 6
> > 7 xq7  907.4.8140.3   5.36 7
> > 8 xd7  905.2.9640.5   5.04 8
> > 9 xqd   8  903.0.908   40.5   4.52 9
> >10 xqdi  9  904.1.8940.4   4.7010
> >\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@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.
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Unicode chars

2022-08-25 Thread Enrico Schumann
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}
> <>=
> 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
> @ %%
>
>
> <>=
> 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
>               
>  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(, 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 

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@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
__
R-help@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.


Re: [R] Unicode chars

2022-08-24 Thread Jeff Newmiller
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  
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}
><>=
>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
>@ %%
>
>
><>=
>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
>              
> 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@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.

__
R-help@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.