\documentclass{article}
\usepackage{titlesec}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\titleformat{\thesection}
{\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\titlelabel{\thetitle.\quad}
\begin{document}
\section{Test Section}
test
\subsection{Subsection}
test
\end{document}
I achieved to change font type to Arial but bold appearances of titles are gone. Is there a way to solve it?
Best Answer
Using fontspec
The
fontspec
package can load any TrueType or OpenType font, which include all the fonts you can use in a word processor. It only works withlualatex
orxelatex
, notpdflatex
.You can change
TeX Gyre Heros
toArial
if you want to use Arial. They are similar, but not quite the same. Heros is closer to what you get when you selectphv
, and computers with no Microsoft software might not have Arial installed.Using NFSS
The web page you found that claims that code will switch to Arial is not correct. Arial and Helvetica are similar, but not the same.
You want the
helvet
package, which is part ofpsnfss
. You are telling the system to use the default PostScript Helvetica font, which on many systems is TeX Gyre Heros, but you do not load any of the font encodings it supports. If you check, you should be getting an error message that says the shape phv/bx/n is not available (because it’s looking for them in the wrong encoding). Here, I load the encodings T1 and TS1.If you want to control which Helvetica clone the document uses, you can replace
\usepackage{helvet}
with\usepackage{tgheros}
. A version of Arial from URW might also be available, as\usepackage{uarial}
.I also took the liberty of redefining
\familydefault
rather than\rmdefault
.