I use the class memoir
, the packages polyglossia
, fontspec
, compile in XeLaTeX in Linux and on macOS.
Based on XeTeX package fontspec: Use previously defined \newfontfamily with \setmainfont (there were not available answers to this), I would like to set an extra font coming from a new command of newfontfamily
to setmainfont
and setsansfont
because I find unnecessary to multiply the same path/localization of the fonts in each macro. I want to economise and optimise the codes. Here is the MWE:
\documentclass[12pt, a4paper, oneside, oldfontcommands, dvipsname]{memoir}
\usepackage{fontspec}
\newfontfamily\alegreya{Alegreya}[Path = ./fontes/,
FontFace = {xb}{n} {* Black},
FontFace = {xb}{it} {* Black Italic},
UprightFont = * Regular,
ItalicFont = * Regular Italic,
BoldFont = * Bold,
BoldItalicFont = * Bold Italic,
]
\setmainfont{\alegreya}
\setsansfont{\alegreya}
Only my newfontfamily
part works, but the set*font
does accept the defined newcommand.