# Error when merging Arial with Small Caps comptatible font within Xelatex on Sharelatex

I'm having some issue trying to combine an Arial font with some non-arial fonts for small caps in ShareLatex.

I've managed to get some setup working, but not what I need the most : 1. Have a working true smallcaps font 2. Use Arial for the main font.

Accoring to this help page, I'd need to add the TTF files for Arial withing my project and put this code :

\setsansfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf
]{arial.ttf}


As I want it for my main font, I've copied to TTF and I've simply edited it to as below. But I don't get any small caps, normal as Arial have none

\setmainfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf,
]{arial.ttf}


Using some examples here, I've tried to use another "sans serif" typeface, with a compatible Small caps font, available on sharelatex. This code works, it is sans serif, has small caps, but is not Arial (my requirement say Arial is needed, no idea why, but I need to comply). So this command can create a mix of Latin Modern Sans, with "TeX Gyre Termes" for Small Caps.

\setmainfont[SmallCapsFont=TeX Gyre Termes,SmallCapsFeatures={Letters=SmallCaps}]{Latin Modern Sans}


Now I wanted to try to merge the 2, which would give me :

\setmainfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf,
SmallCapsFont={TeX Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
]{arial.ttf}


And I've also tried with the ligature option, following this post here

\setmainfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf,
SmallCapsFont={TeX Gyre Termes},
SmallCapsFeatures={Letters=SmallCaps},
Ligatures=TeX,
]{arial.ttf}


But all my tryout are vain, as I get a compilation error. This is strange as the tex gyre is working otherwise fine, but my guess is that I'm mixing a command with filename with the one with font name.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "TeX Gyre Termes" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.64 ]{arial.ttf}


In short, I'm really lost. Do you have any idea on why I'm getting this error and how I should fix my last command ?

# Edit 1 :

Following Ulrike's proposition, I tried this, which compiles fine on Sharelatex, but this do not add small caps but regular fonts. Is there any -smallcaps or am I missing some parameters ?

\setmainfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf,
SmallCapsFont=texgyretermes-regular.otf,
SmallCapsFeatures={Letters=SmallCaps},
Ligatures=TeX,
]{arial.ttf}

• Why don't you use TG Termes for the whole document? Does it make any difference? I just says you don't have the font installed. Just install it, the same way you installed Arial (maybe your system didn't have it, or if you're using sharelatex, upload it to your project). – Joseph May 21 '18 at 22:52
• I can reproduce the error. lualatex and xelatex is looking for a .ttf file, but as tex gyre termes is an .otf it isn't found. – Ulrike Fischer May 22 '18 at 7:30
• Hey Ulrike, thanks for reproducing, this is relieving that I'm not the only one with this issue. By any chance, do you have any idea on how I could solve this one? Can I actually mix TTF and OTF fonts inside a fontspec command? Or Should I find the Tex Gyre in TTF (but where?) and import it as a TTF like the others fonts ? – XaWin May 22 '18 at 8:09
• I just added an answer. – Ulrike Fischer May 22 '18 at 8:14

When you start to declare fonts with extensions you should continue with it. fontspec don't like if you mix the search methods. That means you should select TeX Gyre Termes as texgyretermes-regular.otf.

But beside this I don't understand why you want to switch to a different font for small caps. I just tried on sharelatex after uploading the four font files and this worked like a charm:

\documentclass[11pt]{article}
\usepackage{fontspec}

\setmainfont[
BoldFont=arialbd.ttf,
ItalicFont=ariali.ttf,
BoldItalicFont=arialbi.ttf,
]{arial.ttf}

\begin{document}
blub \textsc{Blub}
\end{document}


I'm using the arial versions from an up-to-date win10 computer. If your arial fonts don't have small caps, consider to get newer versions of the fonts.

• As I wrote: I tried on sharelatex and it worked. I uploaded the arial fonts from my win10 PC. – Ulrike Fischer May 22 '18 at 8:32
• Well "win7" probably means older fonts. Get fonts from a newer computer. – Ulrike Fischer May 22 '18 at 8:39
• How should I know? My crystal ball is on holiday. – Ulrike Fischer May 22 '18 at 8:54
• I added a sentence about font versions. – Ulrike Fischer May 22 '18 at 9:06
• @XaWi, can you spot any difference between TG Heros and Arial? Can your inquisitors spot the difference? It will just save you a lot of hassle. – Joseph May 22 '18 at 12:17