rstudio / tinytex

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

libertinus missing font is not found and not automatically installed #448

Closed cderv closed 1 month ago

cderv commented 1 month ago

From https://github.com/quarto-dev/quarto-cli/issues/10655

---
title: "Quarto and libertinus"
output:
  pdf_document: 
    keep_tex: true
    latex_engine: xelatex
fontfamily: libertinus
---

## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

xelatex is important here, because it will lead to install libertinus and libertinus-otf. But this is not enough because none of those package are containing the fonts. libertinus-fonts should be installed.

Log message is

Requested font "[LibertinusSerif-Regular.otf]/OT" at 9.99997pt
 -> font not found, using "nullfont"

! Package fontspec Error: 
(fontspec)                The font "LibertinusSerif-Regular" cannot be
(fontspec)                found; this may be but usually is not a fontspec
(fontspec)                bug. Either there is a typo in the font name/file,
(fontspec)                the font is not installed (correctly), or there is
(fontspec)                a bug in the underlying font loading engine
(fontspec)                (XeTeX/luaotfload).

And this is not found by the error detection.

> tinytex::parse_packages("test.log")
I was unable to find any missing LaTeX packages from the error log test.log.

So we need to add this to the detection so that the font search is ran

tinytex::tlmgr_search("LibertinusSerif(-(Bold|Italic|Regular).*)?[.](tfm|afm|mf|otf|ttf)")