LaTeX forum ⇒ 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)
Posts: 2
Joined: Fri Sep 21, 2018 3:04 pm

Use a local font in a class file

Postby knp » Fri Sep 21, 2018 3:16 pm

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 : ... 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 :

  1. \documentclass[a4paper]{article}
  2. \usepackage{fontspec}
  3. \usepackage{lipsum}
  4. \XeTeXdefaultencoding utf-8
  5. \defaultfontfeatures{Mapping=tex-text}
  6. \setmainfont{Ubuntu}
  7. \begin{document}
  8. \section{Custom fonts}
  9. \lipsum[1]
  10. \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.

Posts: 2
Joined: Fri Sep 21, 2018 3:04 pm

Postby knp » Fri Sep 21, 2018 5:17 pm

Some news on my attempt :

I've been trying to install two .sty files following this method :

Which consists on the execution of these lines in the terminal :
  1. sudo mkdir /usr/share/texmf/tex/latex/ubuntu
  2. sudo cp foo.sty /usr/share/texmf/tex/latex/ubuntu
  3. sudo texhash

But the use of the line \usepackage{ubuntu} in both my template or my .cls file give no results.

User avatar
Site Moderator
Posts: 3903
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Sep 22, 2018 8:10 am

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.

Return to “Fonts & Character Sets”

Who is online

Users browsing this forum: No registered users and 5 guests