rstudio / tinytex

A lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live
https://yihui.org/tinytex/
Other
986 stars 116 forks source link

How to solve? updating existing packages then finding package for fvextra.sty and more #426

Closed cavo789 closed 1 year ago

cavo789 commented 1 year ago

Hello

I'm (trying) to run Quarto (using TinyTex) from a Docker container. The Docker image has been built right now and the container is up and running.

I was expecting that everything was up-to-date. I mean, I just build the Docker image and one of the instruction is quarto tool install tinytex so that one is up-to-date

But, when running Quarto using my Docker container, using quarto render /project/input/readme.md --log /tmp/quarto.log --to pdf, I see the output below.

Of course, since it's a container, it has no sense to update packages in my container since once the conversion has been made, the container is removed so, on the next call, boum, update packages again and again ...

Did you know how can avoid this ? I mean : can I "force" TinyTex to update every dependencies during the creation of my Docker image or, if not possible, how can I disable packages update? Idea is thus to no more run updates when using my Docker image (but well when I'll rebuild it)

Many, many thanks!!

quarto render /project/input/readme.md --log /tmp/quarto.log --to pdf
pandoc
  to: latex
  output-file: readme.tex
  template: /project/templates/eisvogel/eisvogel.latex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf

running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

updating tlmgr

updating existing packages
finding package for fvextra.sty
> 1 package to install
> installing fvextra (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

finding package for footnotebackref.sty
> 1 package to install
> installing footnotebackref (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

finding package for pagecolor.sty
> 1 package to install
> installing pagecolor (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

finding package for sourcesanspro.sty
> 1 package to install
> installing sourcesanspro (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

finding package for sourcecodepro.sty
> 1 package to install
> installing sourcecodepro (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

finding package for titling.sty
> 1 package to install
> installing titling (1 of 1)
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

Output created: readme.pdf
cderv commented 1 year ago

I was expecting that everything was up-to-date. I mean, I just build the Docker image and one of the instruction is quarto tool install tinytex so that one is up-to-date

When you install quarto tool install tinytex, you are installing one of the bundle from https://github.com/rstudio/tinytex-releases/ This bundles is built at a certain date, and include a certain set of package but not all CTAN. For now, Quarto install a Monthly build using the TinyTeX bundle.

So if your document requires some specific packages from CTAN that are missing from the install, quarto will try to install them as part of the auto-install feature (https://quarto.org/docs/output-formats/pdf-engine.html#quarto-pdf-engine). And updating is part of the process, also because TeXLive is updated almost daily !

When using docker with LaTeX, you need to deal with installing everything you need once, or allowing updates indeed.

Several option for you:

Hope it helps understand how that works, and what you can do.

cavo789 commented 1 year ago

Hi Christophe and thanks for having taken time to give me a sooo complete answer.

I should admit; I'm new to Quarto and Latex (until now, I was using pandoc as a Docker image and it was easier; nothing to configure) but I would take a look to Quarto.

Ok, I've understood that I can disable auto-update by putting latex-auto-install: false in my yaml header (in my .md file). But, as you have said, now conversion fails for each of my missing packages like, the first one, fvextra.sty.

Can you explain me how I can install them so I will foresee these commands in my Dockerfile and rebuild the image.

I'm trying, right now, to convert simple markdown files so, I hope that after installing missing packages below it'll work.

finding package for fvextra.sty finding package for footnotebackref.sty finding package for pagecolor.sty finding package for sourcesanspro.sty finding package for sourcecodepro.sty finding package for titling.sty

Thanks!

cderv commented 1 year ago

See https://tug.org/texlive/doc/tlmgr.html#install-option...-pkg , tlmgr install <pkgname> is the command to run when a CTAN package is missing.

Though the error message won't give you the package name but the filename missing, which you need to look for it using tlmgr search --file --global <filename>

> tlmgr search --file --global /fvextra.sty
tlmgr.pl: package repository https://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet/ (verified)
fvextra:
        texmf-dist/tex/latex/fvextra/fvextra.sty

This tells you that fvextra is the package to install, which you can do with tlmgr install fvextra.

Once you have the list of all the package you need, you can have one call in your dockerfile tlmgr install fvextra footnotebackref

This is only TeX Live knownledge - nothing Quarto specific.

Though, Quarto do that for you through the auto install - if you want to have those install when building, you need to add them in your install.

I'm trying, right now, to convert simple markdown files so, I hope that after installing missing packages below it'll work.

What is your markdown file exactly ? Is there anything specific ? Or standard quarto document ?

If you are using quarto tool install tinytex I would think you would have all the default required package for Quarto to render in the installed bundled. But maybe we are missing some...

cderv commented 1 year ago

For reference, this has been asked already in Quarto discussion: https://github.com/quarto-dev/quarto-cli/discussions/7380

cavo789 commented 1 year ago

Merci infiniment Christophe ! Dockerfile updated with the next command:

# Install tinyTeX packages needed to convert to PDF.
# See https://github.com/rstudio/tinytex/issues/426 for explanation
RUN set -e -x && \
    ~/.TinyTeX/bin/x86_64-linux/tlmgr install fvextra footnotebackref pagecolor sourcesanspro sourcecodepro titling

Docker image rebuild and now, yes, the container isn't reinstalling these packages again and again and thus, execution is faster.

Your help was really perfect. Thanks !

What is your markdown file exactly ? Is there anything specific ? Or standard quarto document ?

In fact a very idiot readme.md (github one) so nothing really special except I'm using the eisvogel template (https://github.com/Wandmalfarbe/pandoc-latex-template) and, there, most probably, there are specific coding.

cderv commented 1 year ago

except I'm using the eisvogel template

Yes this is indeed why this happens. It seems to use some packages that are not included by default in the bundle.