0

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}
XaWin
  • 483
  • 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). –  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 07: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 08:09
  • I just added an answer. – Ulrike Fischer May 22 '18 at 08:14

1 Answers1

3

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}

enter image description here

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.

Ulrike Fischer
  • 327,261
  • The reason I need to change is that I must have small caps as long with Arial font (hard requirements, no for me to change). But Arial has no true small caps... So I needed a workaround either with a fake small caps or with the addition of a real small caps font. – XaWin May 22 '18 at 08:22
  • My example gives real small caps. I added a picture to prove it. – Ulrike Fischer May 22 '18 at 08:25
  • Is it on Sharelatex ? I'm from my work laptop, so I don't see the picture, they are blocked, but then I don't understand what I'm missing, I used the instructions from Sharelatex and this do not work : https://www.sharelatex.com/learn/XeLaTeX – XaWin May 22 '18 at 08:30
  • 1
    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 08:32
  • Yes, sorry you wrote it on the answer. I tried the exact same approach, new blank project, copy your code, select xelatex, tested it to get the missing font error, upload the arial fonts frmo my work laptop, and got only normal caps. This do not work from my work laptop with win7, I'll try with another one. – XaWin May 22 '18 at 08:37
  • 1
    Well "win7" probably means older fonts. Get fonts from a newer computer. – Ulrike Fischer May 22 '18 at 08:39
  • yes, just tried with the font from a Win10 computer and these ones contains the font. Your example worked, but not my full document. I'll need to investigate further... – XaWin May 22 '18 at 08:49
  • 4
    How should I know? My crystal ball is on holiday. – Ulrike Fischer May 22 '18 at 08:54
  • Well, when you take a step back and breath, you can always find the solution! This was indeed the win10 vs win7 issue. So you've rightly guided me to the correct answer! Plus I'm a fan of the (german?) sarcasm, you made my day with the crystal ball! – XaWin May 22 '18 at 09:00
  • I'd like to accept your answer, but this is not clear where the issue was coming from. Could you edit your answer so that it includes this source of font points. The example in sharelatex is apparently propagating an outdated version of Arial, without small caps – XaWin May 22 '18 at 09:04
  • 1
    I added a sentence about font versions. – Ulrike Fischer May 22 '18 at 09:06
  • 1
    @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. –  May 22 '18 at 12:17
  • 1
    @Joseph Well I can spot the differences. https://www.webdesignerdepot.com/2013/03/arial-vs-helvetica-can-you-spot-the-difference/ – Ulrike Fischer May 22 '18 at 12:35
  • @Joseph, I sense some tension in your comment. First I wanted to thank for the mention of TG heros and for your answer. Secondly I just wanted to give some context: my professional background dictates that requirements are not subject to personal taste, you fulfill them or you don't but live with consequences of rejected delivery or contractual breaches. On a very personal perspective, I'm not a fan of Arial, and especially not a fan of sans-serif for report on paper. – XaWin May 22 '18 at 13:26
  • @XaWi, There is no tension. I just asked because maybe if it is for print most people won't tell the difference, and even in pdf most people won't bother looking into the details. And for most people, there isn't much of a difference between Helvetica and its knock-off Arial/TG Heros. Of course it doesn't mean there are no differences. If your bosses can spot the differences, then... –  May 22 '18 at 16:15