rr-markdownxelatextinytex

Cannot find font in RMarkdown PDF


I have dusted off an old LaTeX template that I used with RMarkdown some time ago (when it worked), updated to the latest R, RMarkdown, tinytex etc.

When I try to knit the document, it gives an error that it cannot find the Accanthis font:

! Package fontspec Error: The font "AccanthisADFStdNo3-Regular" cannot be (fontspec) found.

! name = AccanthisADFStdNo3-Regular, rootname = AccanthisADFStdNo3-Regular, pointsize =

! mktexmf: empty or non-existent rootfile! ...

This is called from the template with lines:

\usepackage{fontspec}

\setmainfont{AccanthisADFStdNo3}[ UprightFont = *-Regular, ItalicFont = *-Italic, BoldFont = *-Bold, BoldItalicFont = *-BoldItalic, Ligatures={TeX,NoRequired}, ]

TinyTex can see the font in that tinytex::tlmgr_search("/AccanthisADFStdNo3-Regular[.](tfm|afm|mf|otf)") locates an.otf file

but running from the command line mktextfm AccanthisADFStdNo3-Regular gives "mktexmf: empty or non-existent rootfile!" and is looking for a .mf file that does not exist.

Any idea what the cause of this is? Thanks


Solution

  • It seems to require a file extension after the font name, which it didn't in the past.

    I changed a line in the template to include .otf

    \setmainfont{AccanthisADFStdNo3.otf}[...
    

    and it works again.