Set Font Family and Font Size

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?

• Can you compile with xelatex? – Bernard Jan 24 '17 at 17:13
• I use pdflatex. – Masud Shrabon Jan 24 '17 at 17:15
• And can you use a Times clone, or does it have to be Times New Roman? – Bernard Jan 24 '17 at 17:18
• It has to be times new romans or should be looked similar. By the way, I have not used Times Clones. – Masud Shrabon Jan 24 '17 at 17:27
• Try \usepackage{newtxtext,newtxmath}. As for the font size, the command is \fontsize{14pt}{17pt}\selectfont. – Bernard Jan 24 '17 at 17:33

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, of course, 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. By 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.

• It also works with xelatex — actually, fontspec was initially developped for xelatex. – Bernard Jan 24 '17 at 19:09
\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}

• That at least does the size. – JPi Jan 24 '17 at 17:21
• In my MWE I added also \usepackage{times}. – Jan Jan 24 '17 at 17:21
• If I use \usepackage{times}, will the entire document be times new roman? – Masud Shrabon Jan 24 '17 at 17:24
• Yes. The answer by tex.stackexchange.com/users/59146/dgoodmaniii is more complete. – JPi Jan 24 '17 at 18:29