latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

Font File Path #340

Closed craigbass76 closed 5 years ago

craigbass76 commented 5 years ago

Description

Just wondering how to declare where an otf file is. I'd like to be able to zip up anything (font files included) someone would need to recreate what I'm trying to do (convert markdown walkthroughs to pdf with a shell script) with little hassle.

I have put it in a fonts directory, relative to where I am running my command, in a fonts directory within where the LaTeX template sits, and I've tried sticking it right in the same directory as the template. I'm running this: pandoc -s --template="xyz.latex" markdown.md --pdf-engine=xelatex -o pdfs/xyz.pdf

This is the WHOLE template file:

%!TEX TS-program = xelatex
\documentclass[11pt,oneside,a4paper]{article}
\usepackage{hyperref}
\def\tightlist{}

\usepackage{fontspec}
    \setmainfont{"OmnesLight.otf"}
\begin{document}
$body$
\end{document}

And this all works fine if I have Omnes installed on my system, and stick \setmainfont{Omnes Light} in there instead. Like I said though, I'd like this setup to be portable. It's going to be something dumb I'm missing, I already know it. :)

stone-zeng commented 5 years ago

\setmainfont{OmnesLight.otf}[Path=./fonts/]. assuming that your fonts is in the fonts directory.

wspr commented 5 years ago

Yep, agreed with Xiangdong Zeng. I also agree with the sentiment that using the filename is more portable and reliable.

Note if you might also like to look at the .fontspec file possibility to streamline the source.

craigbass76 commented 5 years ago

Awesome. I knew it was something simple. I'm going to need to specify a monospace font too, so I like the idea of the fonts directory. Then I can keep whatever I'll need in there.

Thanks folks. This little project is starting to shape up...

On 12/3/18 10:31 PM, Will Robertson wrote:

Yep, agreed with Xiangdong Zeng. I also agree with the sentiment that using the filename is more portable and reliable.

Note if you might also like to look at the .fontspec file possibility to streamline the source.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wspr/fontspec/issues/340#issuecomment-443957997, or mute the thread https://github.com/notifications/unsubscribe-auth/AMOYL6mPnvmeTfGdWEuU_0Yq_ZxpN_lOks5u1eyWgaJpZM4Y_sJ5.