TransWikia.com

Using environment variables in fontspec path

TeX - LaTeX Asked by Bolpat on January 5, 2021

Fontspec font inclusions can be lengthy, so I wanted to create a template that has the fonty stuff already done. I have a working template, but it uses an absolute path Path = C:/Users/Bolpat/Documents/FontName setting in fontspec’s font inclusion mechanism. (I include the fonts by file, not installed ones.) The user profile name is in that absolute path, which I couldn’t avoid, since the template should Just Work™ without change wherever the derived document is located. It works perfectly on my machine and my profile. I’d like to have a way to make it more flexible so I could use the template on different machines or even share it with others.
I thought about environment variables like USERPROFILE and found this, but when testing it, it didn’t work, i.e. setting Path = $USERPROFILE/Documents/FontName didn’t do the job. While it may work on other OSes, ~/Documents/FontName doesn’t work on Windows.

I think I could expect peers to have the font files in a specific folder; but mainly, this is for myself.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP