1

I am creating a chapter report template in LaTeX that will be used by others, mostly in Overleaf. There are requirements for fonts, etc. that are in a Word template that I am coding into a LaTeX template.

There are a few questions on StackExchange here about how to use a custom font in Overleaf. Many suggest using the XeLaTeX compiler which is too slow. I want to use pdfLaTeX.

Overleaf has instructions here and here on how to use a custom font with pdfLaTeX, and and answer to LuaLaTeX + fontspec: Font not found also has some tips, but I am still stuck.

Code

\documentclass{report}
\usepackage{lipsum}

% from Overleaf example at https://www.overleaf.com/project/61800a1dd7200c9a50af629b
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\newcommand\customfont[1]{{\usefont{T1}{fonts/calibri}{m}{n} #1 }}


\title{template}
\author{none}
\date{November 2021}

\begin{document}

\maketitle

\chapter{Introduction}
\Huge\customfont{Custom Font Text!}

\section{Section}
\lipsum[1]

\subsection{Subsection}

\end{document}

Project Setup

enter image description here

Current Output

enter image description here

Expected Output

  1. I don't understand the missing number error. I am new to LaTeX and not sure what number is expected and where.
  2. The text reads "n/24.88n/ ..."-- I expected it to read "Custom Font Text!" and be in Calibri font, not the default font.
  3. Following text remained "Huge", and I expected it to return to the default

End Goal

I am trying to set the chapter and section headers to Calibri font, in Report document class, with pdfLaTeX compiler. I expect to use something like this in my preamble:

\usepackage{titlesec}
\titleformat{\chapter}{\customfont\fontsize{12}{14}\bfseries}{\thechapter}{1em}{}

Open to suggestions on a better way to do this. Thank you

4
  • 3
    You can't just use TTF font files with pdfLaTeX directly. You need to convert them into a format that LaTeX understands. You can, however, use TTF font files with XeLaTeX and with LuaLaTeX. I would suggest that you browse through the relevant packages on CTAN and chose a font you like, if you really want to stick to pdfLaTeX. Nov 1, 2021 at 16:18
  • @JasperHabicht thank you, that is a much better idea. I ended up using Carlito. If you write this up as an answer, I will accept it
    – a11
    Nov 1, 2021 at 16:26
  • David Carlisle did this already (and they added some more information about Calibri). You may just accept their answer. Nov 1, 2021 at 16:27
  • 1
    note if you go \Huge{abc} one two three all the text will be Huge to the end of the document, the syntax is {\Huge abc} one two three Nov 1, 2021 at 16:34

1 Answer 1

4

Note also that calibri isn't licenced for use off windows (unless you have bought it) you can use the chrome OS font clone carlito which uses the same font metrics as calibri and has already been set up for use with pdflatex with the carlito package.

https://ctan.org/pkg/carlito

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .