8
\documentclass[12pt]{article}
\usepackage[paperwidth=8.5in,paperheight=14in,left=1.5cm,right=1cm,top=1cm,bottom=0cm]{geometry} %margins
\usepackage{amsmath,mathptmx,fixltx2e,graphicx,polyglossia,fontspec}
\setmainlanguage{english}
\setotherlanguage[numerals=western]{urdu}
\setmainfont{Times New Roman}
\newfontfamily\urdufont[Script=Arabic,Scale=1.2]{Jameel Noori Nastaleeq}
\begin{document}
\textsc{This is written in small caps}
\end{document}

This problem with this code is that the text is not written in small caps. Along with this how can i use "Times" font in polyglossia?

Shaheryar
  • 431
  • 1
    Sorry for my ignorance, but does have alphabets/fonts used for urdu language small caps at all in general? –  Jul 01 '14 at 05:51
  • Urdu language does not have small caps and the text i want in small caps is in English not in Urdu – Shaheryar Jul 01 '14 at 05:56
  • Unfortunately I can't test your example directly, since Times New Roman is not installed on my computer and I am also no expert in XeLaTeX at all, so I can only guess... the font you specified does not provide for small caps at all or the syntax for XeLaTeX is different, i.e. not \textsc or \scshape –  Jul 01 '14 at 06:56
  • 1
    Is the urdu part relevant to the question? I commented that out and surprisingly i have a TMR. But: LaTeX Font Warning: Font shapeEU1/TimesNewRoman(0)/m/sc' undefined (Font) using EU1/TimesNewRoman(0)/m/n' instead on input line 8. – Johannes_B Jul 01 '14 at 07:02

1 Answers1

9

A problem with XeLaTeX is that it will use the font that your operating system recognizes as “Times New Roman” and there are several variants thereof around. In my experience, the feature most of these variants share is the lack of small caps letters.

A clone of Times that has small caps and is available on TeX Live and MiKTeX is TeX Gyre Termes; its coverage of small caps letters is limited to the Latin Alphabet.

\documentclass{article}
\usepackage{fontspec}

\setmainfont[
  Ligatures=TeX,
  SmallCapsFont={TeX Gyre Termes},
  SmallCapsFeatures={Letters=SmallCaps},
]{Times New Roman}

\begin{document}
Abc \textsc{Small Caps}
\end{document}

enter image description here

With the most recent version of fontspec, the syntax of the command has become

\setmainfont{Times New Roman}[
  SmallCapsFont={TeX Gyre Termes},
  SmallCapsFeatures={Letters=SmallCaps},
]

(I'm not sure I like this form of input.)

egreg
  • 1,121,712
  • 1
    "(I'm not sure I like this form of input.)" I don't like it either! Inverting the order of required and optional arguments of \setmainfont is going to break a lot of programs. I wonder what made the authors of fontspec implement this change. – Mico Jul 01 '14 at 08:52
  • 1
    @Mico The old syntax is still understood. – egreg Jul 01 '14 at 09:01
  • Thanks. That's good news. (The latest fontspec manual doesn't mention the old syntax, so I had assumed it was no longer valid.) – Mico Jul 01 '14 at 09:45
  • 3
    @Mico Making the old syntax invalid would break thousands of existing documents! – egreg Jul 01 '14 at 09:50
  • @egreg I don't know much about the old syntax or the new syntax but if there is a better way to do all this then do tell me – Shaheryar Jul 02 '14 at 03:11
  • @egreg Why it doesn't work for me? I just use \setmainfont{TeX Gyre Termes} instead of your \setmainfont{...}, and then the problem seems to be solved. But I'm not sure this font is the same as Times New Roman. – Hyden Jan 16 '16 at 03:04
  • @Hyden The code works under the assumption you have a system font called “Times New Roman”. – egreg Jan 16 '16 at 11:02
  • The small caps doesn't work for me with this example. I get Package fontspec Warning: OpenType feature 'Letters=SmallCaps' (smcp) not (fontspec) available for font 'TeX Gyre Termes' with script '' (fontspec) and language ''. – Viesturs Jan 16 '19 at 16:57
  • @Viesturs Do you have TeX Gyre Termes installed as a system font? – egreg Jan 16 '19 at 17:09
  • No! ! Package fontspec Error: The font "Tex Gyre Termes" cannot be found. – Viesturs Jan 16 '19 at 17:10
  • @Viesturs Do you see the font in the font menus for other applications? – egreg Jan 16 '19 at 17:12