I have the following MVP:
\documentclass[a4paper]{book}
\renewcommand{\contentsname}{Contents}
\usepackage{fontspec}
\usepackage{fullpage}
\usepackage{geometry}
\usepackage{sectsty}
\usepackage[hidelinks]{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\setmainfont{MyMonospaceFont}
\newlength{\characterwidth}
\settowidth{\characterwidth}{\normalfont x}
\geometry{margin=0.7in,textwidth=96\characterwidth,lines=48}
\AtBeginDocument{\raggedright\setlength{\parindent}{3\characterwidth}}
\frenchspacing
\begin{document}
\title{xyz}
\maketitle
\tableofcontents
\chapter{Foo}
\section*{A}
hello world
\section*{B}
\section*{C}
\chapter{Bar}
\end{document}
I would like for the default font character width to be let's say 12pt, and then have the section width be 18pt, and the chapter be 24pt. Or perhaps 12pt 24pt 48pt. But in either case, I'm wondering how to do it.
I looked at these places:
- Change size of section, subsection, subsubsection, paragraph and subparagraph title
- Font size of Chapter number and Chapter Title
- How to change section/subsection font size?
But they don't go far enough into answer it and I'm stuck. For example, they explain \chaptertitlefont{\Huge}
, but not how to use 48pt
there, like \chaptertitlefont{48pt}
just shows up as 48ptFoo
. I've run into many issues with the answers, so wondering if one could help.
\\fontsize{48pt}{60pt}\selectfont
in\titleformat
(fromtitlesec
) should to the trick.\titleformat*{\chapter}{\fontsize{48pt}{60pt}\selectfont}
or\titleformat*{\section}{\fontsize{48pt}{60pt}\selectfont}
don't have any effect on the corresponding text.\titleformat
(without *) which requires5
arguments.