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
Current Output
Expected Output
- I don't understand the missing number error. I am new to LaTeX and not sure what number is expected and where.
- The text reads "n/24.88n/ ..."-- I expected it to read "Custom Font Text!" and be in Calibri font, not the default font.
- 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
\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