LaTeX forum ⇒ Fonts & Character SetsTimes New Roman \texts{} with XeLatex not working!

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Chris_1996
Posts: 5
Joined: Thu Apr 02, 2020 10:45 pm

Times New Roman \texts{} with XeLatex not working!

Postby Chris_1996 » Thu Apr 02, 2020 10:52 pm

Hello,

I have a problem. I use the package fontspec to write an essay with the font Times New Roman. \textsc{} in XeLatex is not working.
If I use:
\setmainfont{Times New Roman}[
SmallCapsFont=TeX Gyre Termes,
SmallCapsFeatures={Letters=SmallCaps},
]
it is only working in LuaLatex but not in XeLatex. I can not use LuaLatex because some Inkscape pictures look weird when I
compile it with LuaLatex.

The error message of compiling with XeLatex always gives me Tex Gyre Termes not found.

Can anybody please help me?
Thx :)

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Times New Roman \texts{} with XeLatex not working!

Postby Ijon Tichy » Fri Apr 03, 2020 9:55 am

LuaLaTeX and XeLaTeX have different methods to find fonts by font name. Usually XeLaTeX doesn't have problems to find system fonts by name, but usually fonts in the TEXMF trees are not system fonts. However you can install them as system fonts. How this can be done depends on the system.

Instead of loading fonts by font name you can also try to load them by file name. See the fontspec manual for more information on how to load fonts by file name instead of font name.

BTW: Here the following does work without problems with LuaLaTeX and XeLaTeX:
\documentclass{article}

\usepackage{fontspec}
\setmainfont{texgyretermes-regular.otf}[
BoldFont=texgyretermes-bold.otf,
ItalicFont=texgyretermes-italic.otf
]

\begin{document}
Roman, \textbf{bold}, \textit{italic}, \textsc{Small Caps}
\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

Chris_1996
Posts: 5
Joined: Thu Apr 02, 2020 10:45 pm

Times New Roman \texts{} with XeLatex not working!

Postby Chris_1996 » Fri Apr 03, 2020 11:03 am

Thanks for the answer. That would work.
Is there a possibility to only use Tex Gyre Termes for \textsc{}?
The rest should be in the real Times New Roman.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Times New Roman \texts{} with XeLatex not working!

Postby Ijon Tichy » Fri Apr 03, 2020 11:20 am

I do not have the original Adobe font, so I cannot test it. Have you tried to load texgyretermes-regular.otf as the SmallCapsFont like shown for the BoldFont or ItalicFont together with the activation of the SmallCapsFeature?
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

Chris_1996
Posts: 5
Joined: Thu Apr 02, 2020 10:45 pm

Times New Roman \texts{} with XeLatex not working!

Postby Chris_1996 » Fri Apr 03, 2020 11:39 am

I tried:
\setmainfont{Times New Roman}[
SmallCapsFont=texgyretermes-regular.otf
]
But it didn't work.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Times New Roman \texts{} with XeLatex not working!

Postby Ijon Tichy » Fri Apr 03, 2020 11:51 am

Please use code tags to mark code in postings.

Have you tried:
\setmainfont{Times New Roman}[
  SmallCapsFont=texgyretermes-regular.otf,
  SmallCapsFeatures={Letters=SmallCaps},
]


Can you please show warnings and errors from the log file?
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

Chris_1996
Posts: 5
Joined: Thu Apr 02, 2020 10:45 pm

Times New Roman \texts{} with XeLatex not working!

Postby Chris_1996 » Fri Apr 03, 2020 12:01 pm

! Package fontspec Error: The font "texgyretermes-regular.otf" cannot be
(fontspec) found.

! Cannot use \XeTeXOTcountfeatures with nullfont; not an OpenType Layout font.

! Cannot use \XeTeXOTfeaturetag with nullfont; not an OpenType Layout font.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Times New Roman \texts{} with XeLatex not working!

Postby Ijon Tichy » Fri Apr 03, 2020 12:09 pm

Strange. If my complete example works, xelatex should find the font. However you can try to copy the font files in the document directory. Then it should always be found.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

Chris_1996
Posts: 5
Joined: Thu Apr 02, 2020 10:45 pm

Times New Roman \texts{} with XeLatex not working!

Postby Chris_1996 » Fri Apr 03, 2020 12:11 pm

I copied texgyretermes-regular.otf in the document directory but it didn't work.
Actually I already put it there and sent you the errors.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Times New Roman \texts{} with XeLatex not working!

Postby Ijon Tichy » Fri Apr 03, 2020 1:44 pm

Sorry, but I can only tell you that with Linux and TeX Live 2019 or TeX Live 2020-pretest following is working out of the box with XeLaTeX:
\documentclass{article}

\usepackage{fontspec}
\setmainfont[
  SmallCapsFont=texgyretermes-regular.otf,
  SmallCapsFeatures={Letters=SmallCaps}
]{LinLibertine_R.otf}

\begin{document}
Roman, \textsc{Small Caps}
\end{document}

pdffonts shows the used fonts as:
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
PJBCAJ+LinLibertineO-Identity-H CID Type 0C Identity-H yes yes yes 5 0
LGYHGZ+TeXGyreTermes-Regular-Identity-H CID Type 0C Identity-H yes yes yes 7 0

And the result is:
Image
I've used Linux Libertine because of the not available original Times New Roman.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:


Return to “Fonts & Character Sets”

Who is online

Users browsing this forum: No registered users and 3 guests