0

There is a question I have since the day I started using LaTeX but even now I can't find an answer online.

From the beginning I am using this piece of code which governs everything related to the language I write and the fonts I use:

\usepackage[english]{babel}

\setmainfont
[
    Ligatures=TeX,
    Extension=.otf,
    UprightFont=*,
    BoldFont=*Bold,
    ItalicFont=*It,
    BoldItalicFont=*BoldIt,
    Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}
\setmathfont{latinmodern-math.otf}
\setmathfont[range=\varnothing]{Asana-Math.otf}
\setmathfont[range=\int]{latinmodern-math.otf}

The problem is that I have created this piece of code out of little pieces ,a lot of times from this site, so I don't understand if all of these lines are needed and I don't quite understand what those lines are needed for (every time I create a new document I just copy and paste them). Also I believe that overall there is a better way to handle the language and the fonts as a lot of times I had problems with that specific piece of code (I am not even sure if this code is right).

In case it is needed I use TeX Live.

  • Please give us a complete example and tell us what you want that code to do. Better to specify the variant of English you want as the default is not the same on all systems. – cfr Oct 22 '15 at 23:53
  • \setmainfont is not defined by default so (presumably) you have \usepackage{fontspec} before this (make sure you copy that when you copy the quoted lines:-) – David Carlisle Oct 22 '15 at 23:55
  • @DavidCarlisle yes I have fontspec too :) – Adam Oct 23 '15 at 0:00
  • 1
    It is very hard to answer your question. none of those lines are needed, take them all out and your document (most likely) will still work. They are just forcing that you use luatex or xetex rather than pdftex and forcing a (slightly idiosyncratic) font setup. If you want to use GFSArtemisia font then you need something like that but no one else can tell you whether you need to use that font, similarly you are using latin-modern for all characters except \varnothing which you take from Asana-Math (which is OK but is far from being a default setup) (presumably, you are using unicode-math – David Carlisle Oct 23 '15 at 0:00
  • @DavidCarlisle I started using them because I was writing in a language other that english. Also I was told that I had to set a sans font and a font for math. – Adam Oct 23 '15 at 0:07
3

As said in comments, those lines are connected with fontspec. Wether those setmainfont options are needed or not depends on your system and the font. You could first try to load simply the font

\setmainfont{GFSArtemisia}

If you get an error message, you will have to show fontspec where to find fonts file. This is what those

[Extension=.otf,
UprightFont=*,
BoldFont=*Bold,
ItalicFont=*It,
BoldItalicFont=*BoldIt,]

are for.

[Ligatures=TeX,
 mapping=tex-text]

are fontspec options that might be redundant under XeLaTeX. From fontspec documentation:

Note the additional features accessed with Ligatures=TeX. These are not actually real OpenType features, but additions provided by luaotfload (i.e.,LuaTEXonly) to emulate TEX’s behaviour for ascii input of curly quotes and punctuation. In XETEX this is achieved with the Mapping feature (see Section 11.1 on page 39) but for consistency Ligatures=TeX will perform the same function as Mapping=tex-text.

These options affects the way your font will make ligature. Here you should get the standard TeX ligatures. There are plenty of options you can pass to an otf font. Please read fontspec doc and try (if you are on an Unix-like system)

otfinfo -f GFSArtemisa.otf

on your console to see what otf features might be passed to fontspec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.