Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

! LaTeX Error: Command \@raggedtwoe@everyselectfont undefined. #69

Open
bschilder opened this issue Sep 4, 2023 · 12 comments
Open

! LaTeX Error: Command \@raggedtwoe@everyselectfont undefined. #69

bschilder opened this issue Sep 4, 2023 · 12 comments
Assignees
Labels
bug in dependency The root cause of the bug is in a dependency bug Something isn't working GitHub Actions Issue occurring on GitHub Actions

Comments

@bschilder
Copy link
Collaborator

bschilder commented Sep 4, 2023

1. Bug description

texi2dvi is failing to render certain Rnw files.

Setting up this library depends on r-lib/actions/setup-tinytex@v2

Console output

Error: Error: processing vignette 'GenomicRangesHOWTOs.Rnw' failed with diagnostics:
Running 'texi2dvi' on 'GenomicRangesHOWTOs.tex' failed.
LaTeX errors:
! LaTeX Error: Command \@raggedtwoe@everyselectfont undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
! Emergency stop.
 ...                                              
                                                  
l.529 \renewcommand{\@raggedtwoe@everyselectfont}
                                                 {%
!  ==> Fatal error occurred, no output PDF file produced!
--- failed re-building ‘GenomicRangesHOWTOs.Rnw’
--- re-building ‘GRanges_and_GRangesList_slides.Rnw’ using Sweave
Warning in .merge_two_Seqinfo_objects(x, y) :
  The 2 combined objects have no sequence levels in common. (Use
  suppressWarnings() to suppress this warning.)
--- finished re-building ‘GRanges_and_GRangesList_slides.Rnw’
--- re-building ‘Ten_things_slides.Rnw’ using Sweave
--- finished re-building ‘Ten_things_slides.Rnw’
SUMMARY: processing the following files failed:
  ‘ExtendingGenomicRanges.Rnw’ ‘GenomicRangesHOWTOs.Rnw’
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.
 ...                                              
                                                  
l.529 \renewcommand{\@raggedtwoe@everyselectfont}
                                                 {%
!  ==> Fatal error occurred, no output PDF file produced!
--- failed re-building ‘GenomicRangesHOWTOs.Rnw’

https://github.com/neurogenomics/GenomicRanges/actions/runs/6070391649/job/16466356573

Expected behaviour

All latex-based vignettes render.

2. Reproducible example

https://github.com/neurogenomics/GenomicRanges/actions/runs/6070391649/workflow

@bschilder
Copy link
Collaborator Author

bschilder commented Sep 4, 2023

Added a test #70 to see whether I could get the example BiocStyle sweave file to render, and encountered the same error!
https://github.com/neurogenomics/rworkflows/actions/runs/6071664665/job/16470143587

This suggests it's a system dependencies issues on the GHA VM.

Trying with different tinytex releases via the TINYTEX_INSTALLER env variable:

  • ❌ TinyTeX-0
  • ❌ TinyTeX (previous rworkflows default)
  • ❌ TinyTeX-1 (r-lib/actions/setup-tinytex@v2 default)
  • ❌ TinyTeX-2

None of these worked and produced the same error as before, with the exception of TinyTeX-0 which failed with a different error for each runner:
https://github.com/neurogenomics/rworkflows/actions/runs/6071982223/job/16471102351

On Ubuntu:

Running 'texi2dvi' on 'LatexStyle2.tex' failed.
Messages:
You don't have a working TeX binary (tex) installed anywhere in
your PATH, and texi2dvi cannot proceed without one.  If you want to use
this script, you'll need to install TeX (if you don't have it) or change
your PATH or TEX environment variable (if you do).  See the --help
output for more details.

On Mac:

* Checking package installation calls in R code...
Error in parse_block(g[-1], g[1], params.src, markdown_mode) : 
  Duplicate chunk label 'widefig', which has been used for the chunk:
par(mar=c(4,4,0.5,0.5))
plot(cars)
Calls: <Anonymous> -> BiocCheckRun -> parseFiles -> parseFile
Execution halted
Error: Process completed with exit code 1.

One Windows:

* creating vignettes ... ERROR
Error: --- re-building 'depgraph.Rmd' using rmarkdown
--- finished re-building 'depgraph.Rmd'
--- re-building 'docker.Rmd' using rmarkdown
--- finished re-building 'docker.Rmd'
--- re-building 'repos.Rmd' using rmarkdown
--- finished re-building 'repos.Rmd'
--- re-building 'rworkflows.Rmd' using rmarkdown
--- finished re-building 'rworkflows.Rmd'
--- re-building 'LatexStyle2.Rnw' using Sweave
Error: Error: processing vignette 'LatexStyle2.Rnw' failed with diagnostics:
pdflatex is not available
--- failed re-building 'LatexStyle2.Rnw'
SUMMARY: processing the following file failed:
  'LatexStyle2.Rnw'
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

@bschilder
Copy link
Collaborator Author

bschilder commented Sep 4, 2023

I've noticed I can successfully render the BiocStyle vignette Rnw on my local Macbook Pro (OS: Ventura 13.5.1 (22G90)) without any issues.

Versions

Here's the versions I have installed:

tlmgr

(base) bms20@IC-WPG44XK9L1 ~ % tlmgr --version
tlmgr revision 62273 (2022-02-28 09:52:17 +0100)
tlmgr using installation: /usr/local/Cellar/texlive/20220321_3/share

tex

(base) bms20@IC-WPG44XK9L1 ~ % tex -v
TeX 3.141592653 (TeX Live 2022/Homebrew)
kpathsea version 6.3.4
Copyright 2022 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

BiocStyle

> packageVersion("BiocStyle")
[1] ‘2.26.0

tinytex

> packageVersion("tinytex")
[1] ‘0.45> tinytex::tlmgr_version()
tlmgr revision 62273 (2022-02-28 09:52:17 +0100)
tlmgr using installation: /usr/local/Cellar/texlive/20220321_3/share

GHA VM versions

The latest MacOS runner currently is a bit outdated, but not sure if that's the issue here.
https://github.com/neurogenomics/rworkflows/actions/runs/6071982223/job/16471102586#step:1:1

Screenshot 2023-09-04 at 11 20 31

@bschilder
Copy link
Collaborator Author

bschilder commented Sep 4, 2023

Was able to fix the original bug by downgrading the tinytex version (2023 version apparently has some bugs).
Bioconductor/BiocStyle#105

But now I get a different error, which has come up in the past:
https://github.com/neurogenomics/rworkflows/actions/runs/6072872545/job/16473658048

--- re-building ‘LatexStyle2.Rnw’ using Sweave
Error: processing vignette 'LatexStyle2.Rnw' failed with diagnostics:
Running 'texi2dvi' on 'LatexStyle2.tex' failed.
LaTeX errors:
! LaTeX Error: File `beramono.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
! Emergency stop.
<read *> 
         
l.93 \RequirePackage
                    [T1]{fontenc}^^M
!  ==> Fatal error occurred, no output PDF file produced!
--- failed re-building ‘LatexStyle2.Rnw’
SUMMARY: processing the following file failed:
  ‘LatexStyle2.Rnw’
Error: Vignette re-building failed.
Execution halted
Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

Documented the issue here:
#32 (comment)

I also let the authors of BiocStyle know that this was a problem, but it doesn't look like anyone has addressed it since.
Bioconductor/BiocStyle#69
Bioconductor/BiocStyle#15

@bschilder
Copy link
Collaborator Author

Previously, the solution was to install the extra deps via tlmgr install. But this no longer seems to be sufficient:

- name: Install additional LaTeX packages (non-Windows)

@bschilder
Copy link
Collaborator Author

Trying to install bera via R pkg didn't seemed to help either:

 - name: Install latex 🛠
      if: inputs.has_latex == 'true'
      run: |
        tinytex::tlmgr_install(pkgs = "bera")
      shell: Rscript {0}
          

@bschilder
Copy link
Collaborator Author

Manually installing the following did not help:

sudo apt-get install texlive texlive-fonts-extra

OR 

sudo apt-get install texlive-full texlive-fonts-extra

@bschilder
Copy link
Collaborator Author

Tried installing deps via R pkg tinytext instead of r-action + tmlgr CLI:

 name: Install latex 🛠
      if: inputs.has_latex == 'true'
      env:
        tinytex_installer: ${{ inputs.tinytex_installer }}
        tinytex_version: ${{ inputs.tinytex_version }}
      run: | 
        install.packages("tinytex")
        extra_packages <- c("bera","nowidow","parnotes","marginfix","etoolbox",
        "titlesec","sectsty","framed","enumitem","parskip","soul","placeins",
        "footmisc","changepage","xstring","caption","mathtools")
        tinytex::install_tinytex(
        bundle = Sys.getenv("tinytex_installer"), 
        version = Sys.getenv("tinytex_version"),
        extra_packages = extra_packages
        )
        tinytex::check_installed("bera")
      shell: Rscript {0}

However this gives an error:
https://github.com/neurogenomics/rworkflows/actions/runs/6074331528/job/16478094400

--- re-building ‘LatexStyle2.Rnw’ using Sweave
Warning in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  texi2dvi script/program not available, using emulation
Error: processing vignette 'LatexStyle2.Rnw' failed with diagnostics:
pdflatex is not available
--- failed re-building ‘LatexStyle2.Rnw’
SUMMARY: processing the following file failed:
  ‘LatexStyle2.Rnw’
Error: Vignette re-building failed.
Execution halted
Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted

@bschilder
Copy link
Collaborator Author

Now getting a random error which seems to be an Issue on GitHub's server atm.
actions/checkout#1448

Fixed by upgrading to checkout@v4

@bschilder
Copy link
Collaborator Author

bschilder commented Sep 4, 2023

Combining the r-lib/actions/setup-tinytex@v2 action to install text with the tinytex R package to install the extra deps seems to yield the best results. ie i get a new error, which i know how to fix at least! (install the "fancyhdr" latex package).

* checking for file ‘.../DESCRIPTION’ ... OK
* preparing ‘rworkflows’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
--- re-building ‘depgraph.Rmd’ using rmarkdown
--- finished re-building ‘depgraph.Rmd’
--- re-building ‘docker.Rmd’ using rmarkdown
--- finished re-building ‘docker.Rmd’
--- re-building ‘repos.Rmd’ using rmarkdown
--- finished re-building ‘repos.Rmd’
--- re-building ‘rworkflows.Rmd’ using rmarkdown
--- finished re-building ‘rworkflows.Rmd’
--- re-building ‘LatexStyle2.Rnw’ using Sweave
Error: processing vignette 'LatexStyle2.Rnw' failed with diagnostics:
Running 'texi2dvi' on 'LatexStyle2.tex' failed.
LaTeX errors:
! LaTeX Error: File `fancyhdr.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
! Emergency stop.
<read *> 
         
l.166 \pagestyle
                {fancy}^^M
!  ==> Fatal error occurred, no output PDF file produced!
--- failed re-building ‘LatexStyle2.Rnw’
SUMMARY: processing the following file failed:
  ‘LatexStyle2.Rnw’
Error: Vignette re-building failed.
Execution halted
Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

Note that when I tried installing texlive with tinytex::install_tinytex, the VM was unable to find texlive when rendering the sweave file.

@bschilder
Copy link
Collaborator Author

This site is helpful for finding which bundles each latex package is part of.
For example, "authblk" isn't recognised when you try to install it with tlmgr. Instead, you need to install the 'preprint' bundle which it is part of.
https://ctan.org/pkg/preprint

@bschilder
Copy link
Collaborator Author

bschilder commented Sep 14, 2023

Some other suggestions have been made to fix Biocstyle itself, which seems to be the root problem:
Bioconductor/BiocStyle#105 (comment)

In the meantime, I've also added some more tidytex pkgs to the rworkflows action that I found here:
https://github.com/Bioconductor/BiocStyle/blob/7c0e0935315267d796a7bf5a3cd51abe87cfbb5b/.github/workflows/test-pandoc-versions.yml#L57

^ This at least ensures that the errors observed on all 3 VM are the same (ie. errors no longer due to OS-specific missing deps).

@bschilder bschilder added the bug in dependency The root cause of the bug is in a dependency label Sep 14, 2023
@bschilder
Copy link
Collaborator Author

bschilder commented Sep 14, 2023

There is also a pandoc/actions/setup action, tho it seems almost identical for the r-lib/actions/setup-pandoc action:
https://github.com/pandoc/actions/tree/main/setup

However, notably, neither have a default argument that users can pass.
GHA doesn't currently handle "empty" arguments either.
actions/runner#924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug in dependency The root cause of the bug is in a dependency bug Something isn't working GitHub Actions Issue occurring on GitHub Actions
Projects
Status: In Progress
Development

No branches or pull requests

1 participant