How to get revtex4-2 running in Ubuntu 22.04? - ubuntu-22.04

After downloading the file revtex-tds-2020-10-22.zip from https://journals.aps.org/revtex,
what should be done to get revtex4-2 up and running in Ubuntu 22.04?
Where exactly should one unzip the revtex4-2-tds.zip file?
After several trials, I keep getting the following error message which
I fail to understand (my files compile with no error in older revtex
implementations)
! Extra \endgroup. \document ->\endgroup
\document#inithook \true#sw {}\UseOneTimeHook {begindo...
l.74 \begin{document}
latex --version returns the following:
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian)
kpathsea version 6.3.4/dev
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01
Thank you for your help!

I had the same issue and solved by installing the full dependency of texlive, that is running apt install texlive-full. There is a way to install a single packages (https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) but I had other errors using the installer.

Related

R: Knitting error rticles \vadjust in vertical mode

I tried to use the package rticles within a Rmd file, in order to generate journal publications. When trying to knit the template as it is, I get following error
his is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
I was unable to find any missing LaTeX packages from the error log UC4_SupplySecurity.log.
! You can't use `\vadjust' in vertical mode.
l.300 \leavevmode\vadjust
pre{\hypertarget{ref-Neurobot2013}{}}%
Error: LaTeX failed to compile UC4_SupplySecurity.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See UC4_SupplySecurity.log for more info.
Execution halted
Within the log file, the same error is reported:
Package pdftex.def Info: UC4_SupplySecurity_files/figure-latex/Figure-1-1.pdf
used on input line 291.
(pdftex.def) Requested size: 241.86113pt x 241.86148pt.
! You can't use `\vadjust' in vertical mode.
l.300 \leavevmode\vadjust
I use following configurations
Latex
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021)
kpathsea version 6.3.3
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03
R 4.0.5
What am I doing wrong?
Unfortunately I cannot provide a reproductible example, as it corresponds to the raw Frontiers Journal Article. The same issue persists with the Elsevier Journal Article template.
The template compiles if I remove all references and citations [#XY], but a publication without references is a no-go.
I believe this issue with rticles has been reported in the Github repo already
https://github.com/rstudio/rticles/issues/383 and it has been fixed in rticles 0.20 which is not yet on CRAN.
So for now, one should do
remotes::install_github("rstudio/rticles")
Using the dev version, I can render without error the default template for Frontier article.
You cannot knit with code in an \texttt{enumerate} or \texttt{itemize} environment. Maybe this is your problem.

Emojis are not displayed in PDF generated by bookdown

I'm using bookdown to generate both a website and a pdf. I've added some emojies using the r package emo. There is no problem when building the site, they are displayed ok.
But when creating the pdf these emojis are not displayed, although they are shown in the .tex file. So my guess is the problem is converting from tex to pdf.
I'm using these commands:
rmarkdown::clean_site()
rmarkdown::render_site(output_format = 'bookdown::pdf_book', encoding = 'UTF-8')
Session info:
> rmarkdown::pandoc_version()
[1] ‘1.17.2’
> system('pdflatex --version')
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.29; using libpng 1.6.29
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 3.04
R version 3.4.1
macOS Sierra 10.12.6
rmarkdown_1.6
Thanks!

How to render LaTeX correctly within function help pane in Rstudio?

Mathematical equations written in LaTeX are often presented within the function documentation accessed in R via help() or ? and presented in the help pane in Rstudio. They do not render correctly within the help pane of Rstudio on my machine. I am however able to use LaTeX successfully in all other application and with knitR outputs.
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.3
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.3
Output from Terminal showing my LaTeX version
latex -v
pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)
kpathsea version 6.2.2
Copyright 2016 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.21; using libpng 1.6.21
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
E.g. when I input ?glm() the following function description loads in Rstudio:
Help in R renders essentially in HTML or LaTeX. The .Rd files that the documentation is written in are rendered as PDF manual, the help page showing upon ?topic or help("topic") call is the HTML one and this does not any math rendering, it is basically only enclosed in <i> </i> tags.
It is really a shame that the HTML form of the documentation that is used the most completely resigns over the math typesetting. One would think that R as "statistical environment" should definitely handle that. Long story short - this behaviour is no error.
However, actually, if you are a package developer and you care about your users' sanity, there is a way how to achieve that math correctly renders in RStudio Help pane, see https://github.com/wviechtb/mathjaxr.
EDIT: I have created a package that hacks Rd to HTML documentation "conversion" which enables proper math rendering for EVERY help page, see https://github.com/netique/documath. It is a sort of monkey patch, but works well. I am in contact with R developers, so maybe we'll see the feature in a proper release. However, that's for a long run.
EDIT2: R 4.2.0+ actually implements the feature from the aforementioned package, so if you want to see the math rendered properly in HTML help, update your R.

What hooks are needed to get CRAN binaries compiled using OpenMP? (on OS X)

When submitting a package to CRAN, how can one get the resulting binaries for Windows and Mac OSX to take advantage of OpenMP?
i.e., what make or compiler hooks do the CRAN machines look for to build for OpenMP code?
Unix source
R has good OpenMP support under unix. Just include the ifdef _OPENMP. (users must download package source and compile packages on their machine).
OS X binaries
Since mid-2018, R for OS X is compiled using clang, with a custom clang giving OpenMP support. Binary packages which take advantage of OpenMP (e.g. OpenMx) run in parallel. Source compilation is eased by the compiler installer provided at CRAN toolshttps://cran.r-project.org/bin/macosx/tools/clang-6.0.0.pkg
Using other non-CRAN compilers (e.g. homebrew) is strongly advised against.
Windows binaries
As of 2019, the windows toolchain supports OpenMP and pthreads, but it's slow and not enabled by default. Comments indicate this might change.
Refs
https://cran.r-project.org/doc/manuals/R-exts.html#OpenMP-support
As of R 3.5.3 manual:
Apple builds of clang on macOS currently have no OpenMP support, but
CRAN binary packages are built with a clang-based toolchain which
supports OpenMP.
http://www.openmp.org/resources/openmp-compilers-tools gives some idea
of what compilers support what versions.
Source-based installs of CRAN packages for most MacOS users will fail and/or not have openmp, unless they have installed, e.g. via homebrew, clang with openmp support. The method for doing evolves, so search for recent posts with terms like "homebrew clang openmp makevars R CRAN".

configure: WARNING: you cannot build info or HTML versions of the R manuals

I am trying to install R-3.1.1 on Fedora 20.
The "make" gives me the following warning
configure: WARNING: you cannot build info or HTML versions of the R manuals
What do I need to do to fix this?
Briefly:
You probably need the texinfo command, cf the R Installation and Administration
manual.
Fedora should have binaries in a repo as well. Question 2.6 of the R FAQ mentions
R binaries for Fedora, maintained by Tom “Spot” Callaway, are provided
as part of the Fedora distribution and can be accessed through yum,
the RPM installer/updater. Note that the “Software” application
(gnome-software), which is the default GUI for software installation
in Fedora 20, cannot be used to install R. It is therefore recommended
to use the yum command line tool.

Resources