7

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

  • \setmainfont only takes one mandatory argument as far as I know. If you want to use a font just for a small part of the text, define a new font - not the main font as that will change it indefinitely. Obvious question: do you have a version of TNR installed which provides small capitals? What does the output on the console say? (Look for warnings about fonts/shapes which cannot be found or substitutions.) I would suggest not using ifsym if you can help it as I don't think it provides type1 fonts. Assuming people will read your CV in PDF metafont fonts are not a good idea. – cfr Oct 12 '14 at 03:30
  • @cfr not using ifsym only disables those symbols, right? If that is the case, I can live without ifsym. After all, those symbols are just for fun. The warning says that LaTeX Font Warning: Font shape EU1/Garamond(0)/m/sc undefined (Font) using EU1/Garamond(0)/m/n instead on input line 103. (I actually did \setmainfont{Garamond}) – Sibbs Gambling Oct 12 '14 at 03:36
  • Yes. It'll just disable those symbols. The thing is, if you use them, they are likely to appear pixelated in some PDF viewers, especially Adobe's. That warning is telling you that Garamond either doesn't have small caps or that fontspec can't figure out how it should be done. Do you have Garamond in small caps installed for your system? Is it available in other applications? – cfr Oct 12 '14 at 11:19
  • @cfr I really like those symbols. So I guess as long as they do not screw up other places, I am good even if they are pixelated. :) I have just installed several Garamond sc fonts, but the problem persists. The sc fonts I installed are all Garamond with some other names, e.g., Garamond Classico SC, I am not sure whether these will work. Oh, if let's say I manage to get Garamond SC on my CV, and their computer doesn't have this font, will this cause a problem? Thanks a lot! – Sibbs Gambling Oct 12 '14 at 12:11
  • That would not not be a problem, no. So long as the fonts are embedded (which is the default), it doesn't matter whether the recipient has the fonts or not. If the fonts are differently named, you will need to use the optional argument to \setmainfont to tell fontspec about it. The manual explains how to do this. – cfr Oct 12 '14 at 12:14

1 Answers1

8

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

egreg
  • 1,121,712