Bioconductor / BiocStyle

Issues and pull requests for BiocStyle should go here.
12 stars 19 forks source link

MiKTeX compatibility issue on Windows #69

Open hpages opened 4 years ago

hpages commented 4 years ago

After a fresh reinstall of MiKTeX on tokay2 (BioC devel Windows builder), we started to see hundreds of vignettes failing with:

PS C:\Users\biocbuild\bbs-3.11-bioc\meat\BiocStyle\vignettes> ..\..\..\R\bin\R CMD Sweave LatexStyle2.Rnw
Output file:  LatexStyle2.tex
PS C:\Users\biocbuild\bbs-3.11-bioc\meat\BiocStyle\vignettes> ..\..\..\R\bin\R CMD pdflatex LatexStyle2.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
(LatexStyle2.tex
LaTeX2e <2019-10-01> patch level 3
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/10/25 v1.4k Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo"))
(C:/Users/biocbuild/bbs-3.11-bioc/R/library/BiocStyle/resources/tex/Bioconducto
r.sty

LaTeX Warning: You have requested package `C:/Users/biocbuild/bbs-3.11-bioc/R/l
ibrary/BiocStyle/resources/tex/Bioconductor',
               but the package provides `Bioconductor'.

("C:\Program Files\MiKTeX 2.9\tex/latex/base\ifthen.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\color.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics-cfg\color.cfg")
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def")
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\dvipsnam.def"))
("C:\Program Files\MiKTeX 2.9\tex/latex/hyperref\hyperref.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\ltxcmds.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/iftex\iftex.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/pdftexcmds\pdftexcmds.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\infwarerr.sty"))
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\etexcmds.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifluatex.sty")))
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\kvdefinekeys.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\pdfescape.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\hycolor.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\xcolor-patch.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\hopatch.sty")))
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\letltxmacro.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\auxhook.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\kvoptions.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/hyperref\pd1enc.def")
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\intcalc.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/00miktex\hyperref.cfg")
("C:\Program Files\MiKTeX 2.9\tex/latex/url\url.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\bitset.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\bigintcalc.sty"))
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\atbegshi.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifpdf.sty")))
("C:\Program Files\MiKTeX 2.9\tex/latex/hyperref\hpdftex.def"
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\atveryend.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/oberdiek\rerunfilecheck.sty"
("C:\Program Files\MiKTeX 2.9\tex/generic/oberdiek\uniquecounter.sty")))
(C:\Users\biocbuild\AppData\Roaming\MiKTeX\2.9\tex/latex/geometry-de\geometry.s
ty ("C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifvtex.sty")
("C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifxetex.sty")
(C:\Users\biocbuild\AppData\Roaming\MiKTeX\2.9\tex/latex/geometry\geometry.cfg)
)

Package geometry Warning: Over-specification in `h'-direction.
    `width' (384.1122pt) is ignored.

(C:\Users\biocbuild\AppData\Roaming\MiKTeX\2.9\tex/latex/bera\beramono.sty)
("C:\Program Files\MiKTeX 2.9\tex/latex/base\fontenc.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/base\t1enc.def"))
("C:\Program Files\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.sty")
(C:\Users\biocbuild\AppData\Roaming\MiKTeX\2.9\tex/latex/titlesec\titlesec.sty)
 (C:\Users\biocbuild\AppData\Roaming\MiKTeX\2.9\tex/latex/framed\framed.sty)

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.164 \let\@bi
              octitle\@empty
?

This seems to affect all Sweave vignettes using BiocStyle::latex(). Unfortunately the long error message displayed by R CMD build contains nothing useful, which is the reason why tokay2 has been temporarily taken off the daily build report for BioC 3.11: https://bioconductor.org/checkResults/3.11/bioc-LATEST/

After a long and painful investigation, it turns out that getting rid of the following patch in BiocStyle fixes the issue: https://github.com/Bioconductor/BiocStyle/blob/0c3a2af3b603c53f1bb12fd996224e8eb98c0871/inst/resources/tex/Bioconductor.sty#L92-L100

While investigating the whole thing I came across the following document that warns against using the \makeatletter and \makeatother commands within .sty or .cls files. Could this be the problem? (I'm not a TeX/LaTeX expert.)

Anyway, after the fresh MiKTeX reinstall on tokay2, we now have titlesec 2.13 there. Some quick testing seems to indicate that this new version of titlesec addresses the original problem (loss of section numbering) introduced in titlesec 2.10.1. Also the version of titlesec that is currently on malbec2 and celaya2 (BioC devel Linux and Mac builders, respectively) is 2.10.2 and doesn't seem to have this problem either. So if the above patch cannot be fixed (i.e. preserved but modified so vignettes can build with the latest MiKTeX), an easy way out would be to just get rid of it.

Thanks, H.

hpages commented 4 years ago
> sessionInfo()
R Under development (unstable) (2019-12-14 r77569)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 R2 x64 (build 9600)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] BiocStyle_2.15.2

loaded via a namespace (and not attached):
 [1] BiocManager_1.30.10 compiler_4.0.0      htmltools_0.4.0
 [4] tools_4.0.0         yaml_2.2.0          Rcpp_1.0.3
 [7] rmarkdown_2.0       knitr_1.26          digest_0.6.23
[10] xfun_0.11           rlang_0.4.2         evaluate_0.14
aoles commented 4 years ago

Thanks a lot @hpages for taking the time to look into this!

I have removed the patch as this has been a temporary solution anyway.

Cheers, Andrzej

hpages commented 4 years ago

Thanks Andrzej!

hpages commented 4 years ago

Note: it's important to realize that on Ubuntu 16.04 LTS (still used by many people, including me), TeX Live still contains the broken titlesec 2.10.1 so people building Sweave vignettes with BiocStyle::latex() on this OS won't get section numbers.

aoles commented 4 years ago

Thanks @hpages for the follow up. In order to debug this I will probably need to replicate the problem on a Windows machine. Did you encounter the issue on any other systems?

hpages commented 4 years ago

I didn't encounter the issue on other systems. But I wouldn't be surprised if the issue were reproducible on any system where all the TeX/LaTeX packages are at their most current version (which is what you get by installing a fresh MiKTeX on Windows). However, on Linux and Mac, TeX/LaTeX packages are typically lagging a few months/years behind their most current version.

bschilder commented 1 year ago

@aoles @hpages Just a heads up, this still happening on Windows. I'm trying to troubleshoot some workaround solutions to this in my GH Action, rworkflows, but it's slow going since it only tells me one latex subpackages is missing per run:

https://github.com/neurogenomics/GenomicRanges/actions/runs/3718719179/jobs/6336709056#step:4:3173

Would be much appreciated to have BiocStyle work out of the box for Windows again.

bschilder commented 1 year ago

In the meantime, is there a way I can list out all the latex libraries i need for BiocStyle to work with Sweave files? That way I can at least install them myself all in one go.

vjcitn commented 1 year ago

Very speculative -- I think I have seen tinytex iterate through errors and installations until all errors are resolved. I didn't ask it to do that and I don't know how to demonstrate it but it may be worth a look if you are not already using tinytex.

vjcitn commented 1 year ago

As for listing the requirements I would love to know how to do that but I am not sure it is possible.

bschilder commented 1 year ago

As for listing the requirements I would love to know how to do that but I am not sure it is possible.

Probably not the best long-term solution (in case things change), but could just make a new function that spits out a character vector of these: https://github.com/Bioconductor/BiocStyle/issues/15

vjcitn commented 1 year ago

Yes, that's helpful. I wonder whether the bioc build system has a list of all relevant tex libraries. @jwokaty

grimbough commented 1 year ago

As for listing the requirements I would love to know how to do that but I am not sure it is possible.

You can also add \listfiles to the Rnw document to list the full set of dependencies

For example, if I make the start of in the BiocStyle Rnw vignette:

%\VignetteIndexEntry{Bioconductor LaTeX Style 2.0}
%\VignettePackage{BiocStyle}
%\VignetteEngine{utils::Sweave}

\documentclass{article}
\listfiles
<<style, eval=TRUE, echo=FALSE, results=tex>>=
BiocStyle::latex()
@ 

The LatexStyle2.log output shows:

 *File List*
 article.cls    2021/10/04 v1.4n Standard LaTeX document class
  size10.clo    2021/10/04 v1.4n Standard LaTeX file (size option)
/mnt/data/R-lib/4.2-bioc_3.16/BiocStyle/resources/tex/Bioconductor.sty    2016/
06/22 Bioconductor LaTeX Style
  ifthen.sty    2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)
   color.sty    2021/12/07 v1.3c Standard LaTeX Color (DPC)
   color.cfg    2016/01/02 v1.6 sample color configuration
  pdftex.def    2020/10/05 v1.2a Graphics/color driver for pdftex
dvipsnam.def    2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)
hyperref.sty    2021-06-07 v7.00m Hypertext links for LaTeX
 ltxcmds.sty    2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
   iftex.sty    2020/03/06 v1.0d TeX engine tests
pdftexcmds.sty    2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
kvsetkeys.sty    2019/12/15 v1.18 Key value parser (HO)
kvdefinekeys.sty    2019-12-19 v1.6 Define keys (HO)
pdfescape.sty    2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
 hycolor.sty    2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
letltxmacro.sty    2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
 auxhook.sty    2019-12-17 v1.6 Hooks for auxiliary files (HO)
kvoptions.sty    2020-10-07 v3.14 Key value format for package options (HO)
  pd1enc.def    2021-06-07 v7.00m Hyperref: PDFDocEncoding definition (HO)
hyperref-langpatches.def    2021-06-07 v7.00m Hyperref: patches for babel langu
ages
 intcalc.sty    2019/12/15 v1.3 Expandable calculations with integers (HO)
etexcmds.sty    2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
   puenc.def    2021-06-07 v7.00m Hyperref: PDF Unicode definition (HO)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  bitset.sty    2019/12/09 v1.3 Handle bit-vector datatype (HO)
bigintcalc.sty    2019/12/15 v1.5 Expandable calculations on big integers (HO)
atbegshi-ltx.sty    2021/01/10 v1.0c Emulation of the original atbegshi
package with kernel methods
 hpdftex.def    2021-06-07 v7.00m Hyperref driver for pdfTeX
atveryend-ltx.sty    2020/08/19 v1.0a Emulation of the original atveryend packa
ge
with kernel methods
rerunfilecheck.sty    2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2019/12/15 v1.4 Provide unlimited unique counter (HO)
geometry.sty    2020/01/02 v5.9 Page Geometry
  ifvtex.sty    2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
beramono.sty    2004/01/31 (WaS)
 fontenc.sty
  t1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
etoolbox.sty    2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
titlesec.sty    2021/07/05 v2.14 Sectioning titles
  framed.sty    2011/10/22 v 0.96: framed or shaded text with page breaks
fancyhdr.sty    2021/01/28 v4.0.1 Extensive control of page headers and footers

enumitem.sty    2019/06/20 v3.9 Customized lists
 parskip.sty    2021-03-14 v2.0h non-zero parskip adjustments
 nowidow.sty    
parnotes.sty    2019/07/23 rev. 3b Notes after every paragraph, or elsewhere
 authblk.sty    2001/02/27 1.3 (PWD)
    soul.sty    2003/11/17 v2.4 letterspacing/underlining (mf)
placeins.sty    2005/04/18  v 2.2
ragged2e.sty    2021/12/15 v3.1 ragged2e Package
footmisc.sty    2011/06/06 v5.5b a miscellany of footnote facilities
marginfix.sty    2020/05/06 v1.2 Fix Margin Paragraphs
graphicx.sty    2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2021/08/11 v1.11 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
changepage.sty    2009/10/20 v1.0c check page and change page layout
 caption.sty    2020/10/26 v3.5g Customizing captions (AR)
caption3.sty    2020/10/21 v2.2e caption3 kernel (AR)
 xstring.sty    2021/07/21 v1.84 String manipulations (CT)
titletoc.sty    2021/07/05 v2.14 TOC entries
mathtools.sty    2021/02/02 v1.28 mathematical typesetting tools
    calc.sty    2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
 mhsetup.sty    2021/03/18 v1.4 programming setup (MH)
 amsmath.sty    2021/10/15 v2.17l AMS math features
 amstext.sty    2021/08/26 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2021/08/26 v2.02 operator names
  Sweave.sty    
fancyvrb.sty    2021/12/21 4.1b verbatim text (tvz,hv)
textcomp.sty    2020/02/02 v2.0n Standard LaTeX package
booktabs.sty    2020/01/12 v1.61803398 Publication quality tables
l3backend-pdftex.def    2022-01-12 L3 backend support: PDF output (pdfTeX)
supp-pdf.mkii
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 nameref.sty    2021-04-02 v2.47 Cross-referencing by name of section
refcount.sty    2019/12/15 v3.6 Data extraction from label references (HO)
gettitlestring.sty    2019/12/15 v1.6 Cleanup title references (HO)
aoles commented 1 year ago

Please note that a list of LaTeX packages loaded directly in BiocStyle style file can be found in Appendix B of Bioconductor LaTeX Style 2.0 vignette. The list seems to have quite some overlap with the one posted in here by @lgatto.

jwokaty commented 1 year ago

@vjcitn We don't have a list for Windows machines.

Is this the same issue originally reported or a different issue, where MikTeX wants an update, which is what I see when looking at GenomicRanges on Palomino4 (3.16 win). I had scheduled the update for next week (I am trying to do them monthly) but I can do it tomorrow to see if it will clear up on the build report for the next day.

bschilder commented 1 year ago

@vjcitn We don't have a list for Windows machines.

I believe it's the same latex deps as the other platforms. I got it working on all 3 OS with these extra steps in my GH action (lines 183-201), thanks to @lgatto (#15): https://github.com/neurogenomics/rworkflows/blob/7beb0c6934406652c39967d3275f3321c15d2078/action.yml#L183

So I think it should be pretty straightforward adding a function to BiocStyle that outputs all latex deps as a character vector.

Next step after that would be ensuring BiocStyle call install or include all necessary latex deps by itself. Or at least run checks at the beginning of the BiocStyle::latex function to see whether all necessary latex deps are available.

vjcitn commented 1 year ago

Thanks @bschilder . We will discuss how to manage this internally and then come back to this issue.

bschilder commented 1 year ago

Just checking in to see if anyone has tried to address this since.

bschilder commented 10 months ago

To give you an update, the dev branch of the rworkflows R package now has the function dependencies_latex(). https://github.com/neurogenomics/rworkflows/blob/dev/R/dependencies_latex.R

This provides a static list of latex deps that are needed by BiocStyle (at least the ones I'm aware of so far). It then installs them using tinytex::tlmgr_install at this step in the rworkflows action: https://github.com/neurogenomics/rworkflows/blob/a8b7509144fdc9281ffa0451721564e8ad4df2cf/action.yml#L289

It would be even better to pull this list of latex deps from an up-to-date remote source: e.g. a text file stored somewhere in the BiocStyle GitHub repo.

@aoles provided a link to a PDF with some of these deps, and I can see some of them are scattered throughout this inst/resources file. But it would be great to have a simple machine-readable text file I could pull into rworkflows::dependencies_latex directly. @grimbough is this something you might be able to add to the BiocStyle GitHub repo?

Thanks! Brian