1

I am trying to have bold in the sections and sub sections using Arial font, all I managed is non-bold titles, here is my conde:

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{setspace}
\onehalfspacing

\setromanfont{Times New Roman}
\usepackage{titlesec}
\title{Thesis}
\date{July 2020}
\font\myfont=Arial at 28pt
\font\myfontsub=Arial at 17pt
\font\myfontsubsub=Arial at 13pt
\usepackage{blindtext}

\titleformat{\section}{\myfont}{\thesection}{1em}{}
\titleformat{\subsection}{\myfontsub}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\myfontsubsub}{\thesubsubsection}{1em}{} 

i am using overleaf. Thank you!

5
  • Welcome to TeX SX!Try \titleformat{\section}{\bfseries\myfont}{\thesection}{1em}{}, &c.
    – Bernard
    Jul 17, 2020 at 11:31
  • @Bernard thank you for the reply! The code doesn't produce an error , but it does not make the title bold either.
    – econ
    Jul 17, 2020 at 11:54
  • What happens if you try Arial with pdflatex (i.e. without fontspec)?
    – Bernard
    Jul 17, 2020 at 12:01
  • @Bernard i tried , it doesn't even appear the sections
    – econ
    Jul 17, 2020 at 12:12
  • But did you install the urw-arial package?
    – Bernard
    Jul 17, 2020 at 16:11

1 Answer 1

1

Define Arial as your sans-serif font with fontspec and use LaTeX formatting commands. Select the font family wirh \sffamily, the bold weight with \bfseries, etc.

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{setspace}
\onehalfspacing

\setromanfont{Times New Roman}
\setsansfont{Arial}

\usepackage{titlesec}
\title{Thesis}
\date{July 2020}
\usepackage{blindtext}

\titleformat{\section}{\sffamily\upshape\bfseries\huge}{\thesection}{1em}{}
\titleformat{\subsection}{\sffamily\upshape\bfseries\large}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\sffamily\upshape\bfseries}{\thesubsubsection}{1em}{} 

\begin{document}
\maketitle

\section{A Section}
\subsection{A Subsection}
\subsubsection{A Sub-Subsection}
\end{document}

Arial font sample

If you want to use specific font sizes, use the \fontsize command instead of \huge, etc. Be aware that the point sizes in LaTeX are not exactly the same as the point sizes in Word.

I commonly load my main font with Scale=1.0 so that it is at its natural size, and set \defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }, so all other fonts have the same x-height,`but you might or might not want to do that here.

You must log in to answer this question.

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