# Tidying up my preamble for using Garamond throughout my thesis in Overleaf

I am quite inexperienced with LaTeX and am writing my PhD Thesis using it. I want to use Garamond throughout, and this has been a nightmare to implement. I have read lots of guidance on the various packages, and had to do a bit of a frankenstein implementation of \fontspec throughout the preamble in order to see an output anythign like what I wanted. Please could somebody help me tidy up my preamble, and help implement garamond throughout? I am so grateful for any help! Before anybody suggests it, I have tried the following:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}


Here is what I have (I am sorry it is so ugly). This gets me Garamond with normal numbers throughout everything except my Bibilography (which I would also like to have in this font!), hyperlinks for TOCs and local TOCs.

\documentclass[a4paper,12pt]{report}
\usepackage{luatextra}
\usepackage{fontspec}
\setmainfont[Numbers=Lining]{EB Garamond}
\usepackage{color}
\usepackage{graphicx}
\graphicspath{ {Figures/} }
\usepackage{subcaption}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{xcolor}
\usepackage{sectsty}
\allsectionsfont{\fontspec{EB Garamond}}
\definecolor{burgundy}{rgb}{0.5, 0.0, 0.13}
\chapterfont{\color{burgundy}}  % sets colour of chapters
\sectionfont{\fontspec{EB Garamond}} % sets colour of sections
\subsectionfont{\fontspec{EB Garamond}}
\subsubsectionfont{\fontspec{EB Garamond}}
\usepackage{caption}
\DeclareCaptionLabelSeparator{bar}{ | }
\DeclareCaptionFont{garabody}{\small \fontspec[Numbers=Lining]{EB Garamond}}
\DeclareCaptionFont{garalabel}{\small \fontspec[Numbers=Lining]{EB Garamond} \color{burgundy}}
\captionsetup{labelsep=bar,font=garabody, labelfont=garalabel}
\usepackage{etoc}
\etocsettocstyle{}{}{\fontspec[Numbers=Lining]{EB Garamond}}
\titleformat{\chapter}[display]
{\huge}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\renewcommand{\familydefault}{\sfdefault}
\titlespacing\chapter{0pt}{12pt plus 4pt minus 2pt}{12pt plus 4pt minus 2pt}
\usepackage[margin=1in]{geometry}
\usepackage[section]{placeins}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage[backend=bibtex,style=numeric-comp,sorting=none,giveninits=true, url=false, doi=false, isbn=false, eprint= false, maxbibnames=99]{biblatex}
\bibliography{1-PhD.bib}
\usepackage{hyperref}
\definecolor{darkgreen}{rgb}{0.0, 0.5, 0.0}
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\fontspec[Numbers=Lining]{EB Garamond}\selectfont\thepage} % except the center
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\onehalfspacing

\begin{document}
\fontspec[Numbers=Lining]{EB Garamond}
\onehalfspacing

.....

\newpage\chapter{Overall Discussion}
\input{chapters/Chapter9_Discussion.tex}

\appendix
\chapter{Appendix}
\input{chapters/Appendix}
\pagebreak

\newpage
\chapter{Bibliography}

• unrelated to your font question but do you really want \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 \hbadness=10000 which tells tex essentially to give up before it starts and not even try to linebreak in an acceptable way? – David Carlisle Oct 11 '19 at 10:57
• Which parts where not to your liking with only \setmainfont[Numbers=Lining]{EB Garamond}? – Ralf Stubner Oct 11 '19 at 15:59
• Remove \renewcommand{\familydefault}{\sfdefault}. – cfr Oct 11 '19 at 20:32