From henr|k@bengt@@on @end|ng |rom gm@||@com  Mon Dec  5 23:19:09 2022
From: henr|k@bengt@@on @end|ng |rom gm@||@com (Henrik Bengtsson)
Date: Mon, 5 Dec 2022 14:19:09 -0800
Subject: [Rd] 
 R-devel: toLatex() for sessionInfo needs to escape new 'Time
 zone' entry
In-Reply-To: <CAFDcVCSjtrHNOXMm7zDDau7FgyK=Chv1eTDVafj4hi0tRT6b_Q@mail.gmail.com>
References: <CAFDcVCSjtrHNOXMm7zDDau7FgyK=Chv1eTDVafj4hi0tRT6b_Q@mail.gmail.com>
Message-ID: <CAFDcVCS5L81zNDO4QVHDCLxeAaD7xEN9QXbur9gT0M-__ewWWA@mail.gmail.com>

I've moved this to https://bugs.r-project.org/show_bug.cgi?id=18443.

/Henrik

On Wed, Nov 30, 2022 at 2:03 PM Henrik Bengtsson
<henrik.bengtsson at gmail.com> wrote:
>
> BACKGROUND:
>
> In recent versions of R-devel, sessionInfo() has a 'tzone' element, e.g.
>
> > sessionInfo()$tzone
> [1] "America/Los_Angeles"
>
>
> ISSUE:
>
> Some time zones, like the one above, has an underscore.  This
> underscore is *not* escaped by utils:::toLatex.sessionInfo, e.g.
>
> $ TZ="America/Los_Angeles" Rscript --vanilla -e "toLatex(sessionInfo())"
> \begin{itemize}\raggedright
>   \item R Under development (unstable) (2022-11-30 r83391),
> \verb|x86_64-pc-linux-gnu|
>   \item Locale: \verb|LC_CTYPE=en_US.UTF-8|, \verb|LC_NUMERIC=C|,
> \verb|LC_TIME=en_US.UTF-8|, \verb|LC_COLLATE=en_US.UTF-8|,
> \verb|LC_MONETARY=en_US.UTF-8|, \verb|LC_MESSAGES=en_US.UTF-8|,
> \verb|LC_PAPER=en_US.UTF-8|, \verb|LC_NAME=C|, \verb|LC_ADDRESS=C|,
> \verb|LC_TELEPHONE=C|, \verb|LC_MEASUREMENT=en_US.UTF-8|,
> \verb|LC_IDENTIFICATION=C|
>   \item Time zone America/Los_Angeles
>   \item Running under: \verb|Ubuntu 20.04.5 LTS|
>   \item Matrix products: default
>   \item BLAS:   \verb|/home/hb/software/R-devel/trunk/lib/R/lib/libRblas.so|
>   \item LAPACK: \verb|/home/hb/software/R-devel/trunk/lib/R/lib/libRlapack.so|
>   \item Base packages: base, datasets, graphics, grDevices, methods,
>     stats, utils
>   \item Loaded via a namespace (and not attached): compiler~4.3.0
> \end{itemize}
>
> This causes LaTeX-based vignettes using toLatex(sessionInfo()) to fail
> their LaTeX compilation with an error, e.g.
>
> Error: processing vignette 'mypkg.Rnw' failed with diagnostics:
> Running 'texi2dvi' on 'mypkg.tex' failed.
> LaTeX errors:
> ! Missing $ inserted.
> <inserted text>
>                 $
> l.684   \item Time zone America/Los_
>                                     Angeles
> ! LaTeX Error: Command \item invalid in math mode.
>
>
> SUGGESTION:
>
> To fix this, either escape any underscores, e.g.
>
>   \item Time zone America/Los\_Angeles
>
> or use \verb as done elsewhere:
>
>   \item Time zone \verb|America/Los_Angeles|
>
> /Henrik



[Rd] R-devel: toLatex() for sessionInfo needs to escape new 'Time zone' entry
Henrik Bengtsson