You can use
otfinfo to get the proper name of fonts installed on your system.
otfinfo -i /usr/share/fonts/TTF/FreeSans.ttf
provides the following information:
Full name: FreeSans
PostScript name: FreeSans
Version: Version 0412.2268
Unique ID: GNU: FreeSans Normal: 2012
Vendor URL: https://savannah.gnu.org/projects/freefont/
Copyright: Copyright 2002, 2003, 2005, 2008, 2009, 2010, 2012 GNU Freefont contributors.
License URL: http://www.gnu.org/copyleft/gpl.html
License Description: This computer font is part of GNU FreeFont. It is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This font is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this font. If not, see
As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
Vendor ID: GNU
The full name,
FreeSans, can then be used to set the document font:
Of course, this particular choice would obviously be a poor one since you should not set the body of your document in sans-serif. (Unless you are producing slides or something like that.) But it works for purposes of demonstration:
You need to use either LuaLaTeX or XeLaTeX. The output above was compiled with LuaLaTeX which works much better for me than XeLaTeX.
I'm using TeX on GNU/Linux, so perhaps it is worth a word of warning about XeTeX.
If you try XeLaTeX, do not leave your computer during compilation just in case - XeLaTeX tends to hang and, at least for me, spins up the CPU in ways which quickly spiral out of control. While your OS should kill the process before your computer overheats, I personally prefer not to depend on this. Make sure that you know how to kill the process and have a terminal ready. If you are compiling from the command line, have a second terminal open as you cannot use the usual control characters to interrupt the process.