Fonts & Character SetsUse a local font in a class file

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
knp
Posts: 2
Joined: Fri Sep 21, 2018 3:04 pm

Use a local font in a class file

Post by knp »

Hi everyone,

I'm a beginner on LaTeX and I've been spending too much time on that small issue that I can't give up. That's pretty basic I guess, but I can't manage to find the accurate instruction despite hours of trying.

I want to create my own CV from this template : https://www.latextemplates.com/template ... s-resumecv

What I want to do is to remove the original font of the template by a local font of my computer, let's say the "Ubuntu" font.

I understand XeLaTex is needed. I installed it. Now if in a TexMaker blank file I type :

Code: Select all

\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{lipsum}
\XeTeXdefaultencoding utf-8
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Ubuntu}
\begin{document}
\section{Custom fonts}
\lipsum[1]
\end{document}

I then get a file with the Ubuntu font. However there is no way to get this Ubuntu font on that CV, in the .tex file. "setmainfont" doesn't work, "renewfamilykinda" neither.

I guess instructions should be written in the class file .cls of the CV, but everything I tried did not work.

Please, help me :)
Last edited by knp on Fri Sep 21, 2018 5:18 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
knp
Posts: 2
Joined: Fri Sep 21, 2018 3:04 pm

Use a local font in a class file

Post by knp »

Some news on my attempt :

I've been trying to install two .sty files following this method : https://ubuntuforums.org/showthread.php?t=2341382

Which consists on the execution of these lines in the terminal :

Code: Select all

sudo mkdir /usr/share/texmf/tex/latex/ubuntu
sudo cp foo.sty /usr/share/texmf/tex/latex/ubuntu
sudo texhash
But the use of the line \usepackage{ubuntu} in both my template or my .cls file give no results.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Use a local font in a class file

Post by Johannes_B »

If the fonts are properly installed on the system, XeLaTeX should have no problems finding them. There shouldn't be any need to change a class file, which is discouraged anyway due to license issues.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply