2

I have some text in my document in primary font what is in LaTeX but I would like to get some text in font Times New Roman but just some text between primary text, as a local command (something as \textit{}, \textbf{} etc.), an example below.

My cat has black skin. % in primary font

My second cat has white skin. % I would like to get in Times New Roman

Thanks for help.

  • You can choose pretty much any font you want at pretty much any time using the features of package fontspec. – Johannes_B Sep 24 '16 at 7:24
  • Can you write me some examples. I don't understand. :) – Ľubomír Masarovič Sep 24 '16 at 7:28
  • 1
    I cannot, i have to leave no. Have a look at the package documentation or search the site for fontspec. – Johannes_B Sep 24 '16 at 7:29
  • But I use pdftex. It doesn't work. – Ľubomír Masarovič Sep 24 '16 at 7:36
6

Option 1: LaTeX

Select the Times font, which looks a lot like Times New Roman. More info here.

MWE

\documentclass{article}

\begin{document}
My cat has black skin. % in primary font

{\fontfamily{ptm}\selectfont
My second cat has white skin.} % I would like to get in Times New Roman
\end{document}

Result

enter image description here

Option 2: XeLaTeX/LuaLaTeX

Select fonts installed on you computer using fontspec as Johannes_B suggested. Now you have to compile using XeLaTeX or LuaLaTeX though. (thanks clemens)

MWE

\documentclass{article}
\usepackage{fontspec}
% Compile with XeLaTeX

\newfontfamily\myfont{times.ttf}
\begin{document}
My cat has black skin. % in primary font

{\myfont
My second cat has white skin.} % I would like to get in Times New Roman
\end{document}

Result

enter image description here

  • Now you have to compile using XeLaTeX though. misses a “or LuaLaTeX” :) – clemens Sep 24 '16 at 13:27
  • @clemens thanks. Never used it. Added it to the answer. – Roald Sep 24 '16 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.