[Tex/LaTex] \textsc not working inside \setmainfont

small-caps

I am trying to make my surname on my CV to be \textsc.

Since I wish it to have a different font from the rest of the CV, I wrap it within \setmainfont. Once I did that, the \textsc effect was gone.

MWE of \textsc not working

\documentclass[letterpaper, 11pt]{article} % Default font size and paper size

\usepackage{fontspec} % For loading fonts
\defaultfontfeatures{Mapping=tex-text}
% LaTeX default font = Computer Modern Roman
%\setmainfont{Garamond}
%\setmainfont{Calibri}
%\setmainfont{Times New Roman}
%\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}

\usepackage{longtable}

\usepackage[hidelinks]{hyperref} % hide the links

% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\begin{document}

%\centering

\pagestyle{empty} % Removes page numbering

\font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section

\setmainfont{Times New Roman}{
\par{
\centering
\Huge
{
Firstname \textsc{Surname}
}
\bigskip\par
}}
\par{
\Mundus\enspace http://sites.google.com/site
\hfill
\MVAt\enspace g@icloud.com
\smallskip
\FilledHut\enspace 25 Park
\hfill
\phone\enspace 1234567
}

\end{document}

enter image description here

MWE of \textsc working

\documentclass[letterpaper, 11pt]{article} % Default font size and paper size

\usepackage{fontspec} % For loading fonts
\defaultfontfeatures{Mapping=tex-text}
% LaTeX default font = Computer Modern Roman
%\setmainfont{Garamond}
%\setmainfont{Calibri}
%\setmainfont{Times New Roman}
%\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin}

\usepackage{longtable}

\usepackage[hidelinks]{hyperref} % hide the links

% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\begin{document}

%\centering

\pagestyle{empty} % Removes page numbering

\font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section

\par{
\centering
\Huge
{
Firstname \textsc{Surname}
}
\bigskip\par
}
\par{
\Mundus\enspace http://sites.google.com/site
\hfill
\MVAt\enspace g@icloud.com
\smallskip
\FilledHut\enspace 25 Park
\hfill
\phone\enspace 1234567
}

\end{document}

enter image description here

Best Answer

The problem is due to the fact that no Times New Roman font I know has small caps.

You can obviate the problem, at least for Latin characters, by substituting it with a font that has small caps.

In order to use a different font than the main one for just a short part of a document, don't reset \setmainfont, but use \newfontfamily in the preamble. The ifsym fonts have nothing to do with the problem.

\documentclass[letterpaper, 11pt]{article} % Default font size and paper size

\usepackage{fontspec} % For loading fonts
% LaTeX default font = Computer Modern Roman

\newfontfamily\times{Times New Roman}[
  % the font has no small caps, so we use another one for them
  SmallCapsFont=TeX Gyre Termes,
  SmallCapsFeatures={Letters=SmallCaps}
]

\usepackage{longtable}

\usepackage[hidelinks]{hyperref} % hide the links

% For the symbols
\usepackage{wasysym}
\usepackage{marvosym}
\usepackage[alpine]{ifsym}

\begin{document}

\pagestyle{empty} % Removes page numbering

\begin{center}
\times
{\Huge Firstname \textsc{Surname}\par}

\bigskip

\Mundus\enspace http://sites.google.com/site
\quad
\MVAt\enspace g@icloud.com
\quad
\FilledHut\enspace 25 Park
\quad
\phone\enspace 1234567

\end{center}

\end{document}

enter image description here