I want to set font family Times new roman with font size 24 pt for the title of a paper.
\documentclass[conference]{IEEEtran}
\title{Only this TITLE should be 24pt in Times New Roman font}
How can this font be set?
Well, classically, you find the TFM file name for the font you want, assign it a control sequence, and then tell TeX what font that control sequence means. E.g.:
\font\foo=bar12
You'd then issue \foo
to start using the font bar
in whatever size the file provided (in this case, the file name, bar12
, indicates that it's probably a twelve-point font).
LaTeX2e made this all much easier with the New Font Selection Scheme (NFSS). Instead, you can select a font in a number of different ways. For example, to select Times:
\documentclass{article}
\begin{document}
\thispagestyle{empty}
Now is the time...
\fontfamily{ptm}\selectfont
Now is the time...
\end{document}
That will give you this:
The first line is Computer Modern (the default), the second is in Times. The downside of this method is that you need to know the sometimes esoteric font family name; e.g., here Times is ptm
, which is far from intuitive. (The p
refers to the foundry, Adobe; the tm
means Times.)
For that reason, if you want your whole document set in another font, it's best to use a package designed for that purpose. E.g., for Times, the recommended package is mathptmx
:
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
This will set your whole document to using Times, including math.
If you're using LuaTeX or one of its progeny, there's an even simpler way using the fontspec
package. You can use a human-readable name for the font using this system, namely whatever name the font uses on your computer. To find out what those names are, run luaotfload-tool --update
and then luaotfload-tool --list=*
. This will give you a list of all the fonts on your system that LuaTeX knows about. So for my system, I found an easily-recognized one (Roboto Medium) and did this:
\documentclass{article}
\usepackage{lipsum}
\usepackage{fontspec}
\setmainfont{Roboto Medium}
\begin{document}
\thispagestyle{empty}
\lipsum[1]
\end{document}
And got this:
The fontspec
documentation will tell you lots more; this is really a very powerful package. Be sure, when using fontspec
, that you compile with lualatex
, not pdflatex
, or it simply won't work; fontspec
's ability to use any system font is limited to luatex
-based systems.
xelatex
— actually, fontspec
was initially developped for xelatex.
\documentclass[conference]{IEEEtran}
\usepackage{lipsum}
\begin{document}
\title{\fontsize{24}{20}\selectfont{}Only this TITLE should be 24pt in Times New Roman font}
\maketitle
\lipsum{1-3}
\end{document}
xelatex
?\usepackage{newtxtext,newtxmath}
. As for the font size, the command is\fontsize{14pt}{17pt}\selectfont
.