I'm new to TeX. I have the following problem: How can I load a font from a file in a directory, which is located in the root of the project?
Say I have something like:
/project /fonts DancingScript-Regular.ttf main.tex DancingScript-Regular.ttf
Loading it when it's right on the root seems to work.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper,12pt]{book}
\usepackage{fontspec}
\setromanfont{DancingScript-Regular.ttf}
\begin{document}
hello world
\end{document}
However I can't figure how to load it when it's in the fonts
directory. I've tried ./fonts/DancingScript-Regular.ttf
, fonts/DancingScript-Regular.ttf
, "fonts/DancingScript-Regular.ttf"
and file:./fonts/DancingScript-Regular.ttf
. None of them work.
All guides seem to focus on some sort of "how to install the font" but I can't work with that since the fonts may change (regularly) and would cause a sort of font version hell; it's also not very version control friendly. The Fonts section in the LaTeX WikiBook doesn't seem to cover using your own fonts either.
Also, can I load the fonts as a sort of preset/alias? Since for a lot I have basically font families, so around 10 variants (oblique, bold, bold oblique, regular, etc). I would like to avoid repeating a declaration if possible.