nesi / eri-ood-rstudio-server-app

(Beta) OOD RStudio-server for app for eRI
MIT License
0 stars 1 forks source link

PDF output #3

Closed MattBixley closed 3 months ago

MattBixley commented 3 months ago

requires installation of latex for PDFs to be created in Markdown and Quarto. both render to html ok

`output file: testmarkdown.knit.md

! sh: pdflatex: command not found

Error: LaTeX failed to compile testmarkdown.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See testmarkdown.log for more info. In addition: Warning message: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) : error in running command Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

Otherwise consider MiKTeX on Windows - http://miktex.org

MacTeX on macOS - https://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome strongly recommended)

Linux: Use system package manager`

MattBixley commented 3 months ago

possible solution - pandoc module from mahuika

DininduSenanayake commented 3 months ago

Since it is specifically looking for pdflatex command as per pdflatex: command not found, we might not be able to solve it with pandoc module as it only has pandoc pandoc-citeproc binaries.

Solution is to install some form TexLive ( minimal level should do)

$ apptainer shell latex-edege.simg Singularity> pdflatex test.tex This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./test.tex LaTeX2e <2022-11-01> patch level 1 L3 programming layer <2023-02-22> (/opt/texlive/texdir/texmf-dist/tex/latex/base/article.cls Document Class: article 2022/07/02 v1.4n Standard LaTeX document class (/opt/texlive/texdir/texmf-dist/tex/latex/base/size10.clo)) (/opt/texlive/texdir/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def) No file test.aux. [1{/opt/texlive/texdir/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )</opt/texlive/texdir/texmf-dist/fonts/type1/public/amsfonts/cm/cm r10.pfb> Output written on test.pdf (1 page, 12868 bytes). Transcript written on test.log.


* I suppose we can take a look at building a lightweight module based on the container and see whether it will get around this for the moment. 
DininduSenanayake commented 3 months ago

@MattBixley I have added a TeXLive/2022 module which should fix the problem.

$ module load TeXLive/2022

$ pdflatex test.tex 
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-02-22>
(/opt/texlive/texdir/texmf-dist/tex/latex/base/article.cls
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
(/opt/texlive/texdir/texmf-dist/tex/latex/base/size10.clo))
(/opt/texlive/texdir/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file test.aux.
[1{/opt/texlive/texdir/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux) )</opt/texlive/texdir/texmf-dist/fonts/type1/public/amsfonts/cm/cm
r10.pfb>
Output written on test.pdf (1 page, 12868 bytes).
Transcript written on test.log.

This wasn't created by using EasyBuild. Instead,

awk '{print "\"" $0 "\""}' binary.list > quotes-binary.list | sed 's/$/,/' quotes-binary.list > commasep-binary.list

MattBixley commented 3 months ago

Added to script.sh.erb and Markdown will now output to PDF.

# load additional Modules module load TeXLive/2022 Relaunched app and then required within R to run tinytex::install_tinytex() unsure if all users will need to do this or just pushing/rsync my library with the 4.3 library will fix that for everyone.

> .libPaths() [1] "/mnt/gpfs/persist/home/agresearch.co.nz/<USERID>/R/foss-2023a/4.3" [2] "/mnt/gpfs/persist/apps/eri_rocky8/software/R/4.3.3-foss-2023a/lib64/R/library"

edit: doing library installs as admin after testing as local.