0

Hello I am using Sharelatex and I use these commands in the preamble in order to be able to write in greek.

\usepackage{xltxtra}
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{GFSDidot.otf}
\setsansfont[Mapping=tex-text]{GFSDidot.otf}

How can I change the font?

Edit I:

\documentclass[12pt]{article}

\usepackage{xltxtra}
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{GFSDidot.otf}
\setsansfont[Mapping=tex-text]{GFSDidot.otf}

\begin{document}

Text Here!

Κείμενο εδώ!

\end{document}
  • Have you tried specifying a font other than GFSDidot? If your question is more complex than it appears please post complete compilable code i.e. a Minimal Working Example so that people can understand your setup. – cfr Mar 24 '14 at 23:13
  • No I have never tried to change the font and as I searched, every site had a different preamble to offer so I feared that there would be a problem with mine. Also I don't know any other fonts. – Adam Mar 24 '14 at 23:15
  • The Minimal Example? – cfr Mar 24 '14 at 23:17
  • What do you mean by that? I just want to change the font in some documents. What example should I provide? – Adam Mar 24 '14 at 23:18
  • A small document containing a sentence or 2 of Greek which people can compile. It saves people having to start from scratch. It also enables people to check an answer even if they don't know Greek since you provide the example text! – cfr Mar 24 '14 at 23:20
4

The LaTeX Font Catalogue provides samples and instructions for various fonts supported by TeX packages.

Serifs - look for those starting GFS for a start since that is Greek Font Society.

Sans - again, there's one GFS offering. (I doubt you want the same font for both serif and sans.)

Obviously other fonts also support Greek. Since you are using XeLaTeX or LuaLaTeX, you can use any font installed on your system which supports Greek. In the LaTeX Font Catalogue or on CTAN, look for fonts which are available in opentype or truetype format.

Without knowing more about your document or what you are trying to do, it is hard to say anything very useful.

TeX Live includes the following Greek Font Society offerings in opentype format:

  • GFS Artemisia
  • GFS Baskerville
  • GFS Bodoni
  • GFS Complutum
  • GFS Didot
  • GFS Neohellenic
  • GFS Porson
  • GFS Solomos

In addition Iwona, Kurier, AntykwaTorunska, cm-unicode, EBGaramond12, Libertine, GNU FreeFont, Stix, OldStandard, Philokalia, PlayFair etc. support the Greek script. You can check this using

otfinfo -s <fontfile>

Selected sample of opentype fonts from TeX Live

Sampler for Greek

\documentclass[12pt,twocolumn]{article}

\usepackage{xltxtra}
\usepackage{xgreek}

\begin{document}

\setmainfont[
  Mapping=tex-text,
  BoldFont=GFSArtemisiaBold.otf]{GFSArtemisia.otf}
\section{GFS Artemisia}
Text Here!

Κείμενο εδώ!

\setmainfont[
  Mapping=tex-text,
  BoldFont=LibreBaskerville-Bold.otf]{LibreBaskerville-Regular.otf}
\section{Libre/GFS Baskerville}
Text Here!

\setmainfont[
  Mapping=tex-text]{GFSBaskerville.otf}
Κείμενο εδώ!

\setmainfont[
  Mapping=tex-text,
  BoldFont=GFSBodoniBold.otf]{GFSBodoni.otf}
\section{GFS Bodoni}

Text Here!

Κείμενο εδώ!

\section{GFS Complutum}

\setmainfont[
  Mapping=tex-text]{GFSPolyglot.otf}
Κείμενο εδώ!

\setmainfont[
  Mapping=tex-text,
  BoldFont=GFSDidotBold.otf]{GFSDidot.otf}
\section{GFS Didot}

Text Here!

Κείμενο εδώ!

\setsansfont[
  Mapping=tex-text,
  BoldFont=GFSNeohellenicBold.otf]{GFSNeohellenic.otf}
\section{\textsf{GFS Neohellenic}}
{\sffamily
Text Here!

Κείμενο εδώ!}

\section{GFS Porson}

\setmainfont[
  Mapping=tex-text]{GFSPorson.otf}
Κείμενο εδώ!

\section{\sffamily GFS Solomos}

\setmainfont[
  Mapping=tex-text]{GFSSolomos.otf}
Κείμενο εδώ!

\setmainfont[
  Mapping=tex-text,
  BoldFont=STIX-Bold.otf]{STIX-Regular.otf}
\section{STIX}
Text Here!

Κείμενο εδώ!

\setsansfont[
  Mapping=tex-text,
  BoldFont=Iwona-Bold.otf]{Iwona-Regular.otf}
\section{\sffamily Iwona}
{\sffamily
Text Here!

Κείμενο εδώ!}

\setsansfont[
  Mapping=tex-text,
  BoldFont=Kurier-Bold.otf]{Kurier-Regular.otf}
\section{\sffamily Kurier}
{\sffamily
Text Here!

Κείμενο εδώ!}

\end{document}
  • Thank you very much! Why we use both \setmainfont and \setsansfont? – Adam Mar 25 '14 at 0:16
  • 1
    @Adam I used \setsansfont when the font was sans and \setmainfont when the font was roman/serif. Normally, TeX uses three families of fonts for most purposes: serif/roman which is the default/main document font; sans which is what you get with \sffamily or \textsf{}; and typewriter which is what you get with \ttfamily or \texttt{}. Unless you want your entire document to be in sans (not recommended), you don't want to select a sans font with \setmainfont. Normally, you'd specify font families which complement each other. Often the font documentation will include suggestions. – cfr Mar 25 '14 at 0:38

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.