0

I'm using the Kerkis font family in XeLatex, but math-mode uses the default font. I have installed the OTF font files and it works fine for text when I am specifying it as the main font like this:

\setmainfont[
UprightFont = Kerkis,
ItalicFont = KerkisItalics,
SlantedFont = KerkisItalics,
BoldFont = Kerkissb,               
BoldItalicFont = Kerkissbi,        
BoldSlantedFont = Kerkissbi,       
SmallCapsFont = KerkisSmallCaps]   
{Kerkis}

I am writing in greek, and when i use the kmath package it messes up the enconding and the document no longer displays correctly. Is there a way to use kmath or at least to have math mode use the kerkis font?

edit: This is what i get when i am using kmath:

enter image description here

\documentclass[11pt,a4paper,titlepage]{article}


\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{kmath}
\usepackage[no-math]{fontspec}
\usepackage{polyglossia}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{graphicx}
\usepackage{xltxtra}
\usepackage{makeidx}
\usepackage{enumerate}
\usepackage{caption}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{hyperref}
\usepackage{grffile}
\usepackage{adjustbox}
\usepackage{wrapfig}

\setmainfont[
UprightFont = *,
ItalicFont = *Italics,
SlantedFont = *Italics,
BoldFont = *sb,               
BoldItalicFont = *sbi,
BoldSlantedFont = *sbi,       
SmallCapsFont = *SmallCaps
]{Kerkis}

\newfontfamily{\greekfont}[
UprightFont = *,
ItalicFont = *Italics,
SlantedFont = *Italics,
BoldFont = *sb,               
BoldItalicFont = *sbi,
BoldSlantedFont = *sbi,       
SmallCapsFont = *SmallCaps
]{Kerkis}

\setmainlanguage[variant=modern]{greek}

% A lot of document structuring omitted

\begin{document}

    \maketitle
    \section{Ερώτημα 1}
    % Omitted text
    Όντας πλέον γραμμικό το σύστημα μπορεί να γραφτεί στη μορφή $\dot{x} = Ax+B\upsilon$:
    $$
    \dot{x} = \begin{bmatrix} 0 & 3 \\ -5 & -2\end{bmatrix}x + \begin{bmatrix}0 \\ 1\end{bmatrix}\upsilon
    $$
    όπου $x=\begin{bmatrix}x_1 & x_2\end{bmatrix}^T$ το διάνυσμα των καταστάσεων και $\dot{x}=\begin{bmatrix}\dot{x}_1 & \dot{x}_2\end{bmatrix}^T$ το διάνυσμα των παραγώγων τους.

edit 2: I fixed math-mode not using kerkis, by removing: \usepackage{unicode-math}, but the text enconding is still wrong.

  • Please, show the code that produces that gibberish. Of course unicode-math mustn't be used, because kmath doesn't provide a Unicode math font. – egreg Dec 1 '15 at 0:01
  • I tried using your own code verbatim, and it still produced garbage. If I uninstall the kerkis from MiKTex Settings, and not use kmath text works fine, but the second I install kmath it installs kerkis and i get the above. – svart Dec 1 '15 at 0:04
  • 1
    That's not a minimal example of code. Please, add it: it will be easier to help you. – egreg Dec 1 '15 at 0:06
0

I see no real problem:

\documentclass{article}
\usepackage{amsmath}
\usepackage{kmath}
\usepackage[no-math]{fontspec}
\usepackage{polyglossia}

\setmainfont[
  UprightFont = *,
  ItalicFont = *Italics,
  SlantedFont = *Italics,
  BoldFont = *sb,               
  BoldItalicFont = *sbi,
  BoldSlantedFont = *sbi,       
  SmallCapsFont = *SmallCaps
]{Kerkis}

\newfontfamily{\greekfont}[
  UprightFont = *,
  ItalicFont = *Italics,
  SlantedFont = *Italics,
  BoldFont = *sb,               
  BoldItalicFont = *sbi,
  BoldSlantedFont = *sbi,       
  SmallCapsFont = *SmallCaps
]{Kerkis}

\setmainlanguage[variant=modern]{greek}

\begin{document}

Η Αθήνα είναι η πρωτεύουσα και μεγαλύτερη πόλη της Ελλάδας. Είναι 
από τις παλαιότερες πόλεις του κόσμου, με την καταγεγραμμένη
ιστορία της να φθάνει ως το 3.200 π.Χ.
\[
a\sin\varphi=\int_{0}^{\pi} f(\eta)\,d\eta
\]

\end{document}

enter image description here

Here's what I get from your example file:

enter image description here

  • I just tried replacing my code with yours, and it gave me the following error: Option clash for package fontspec. \usepackage – svart Nov 30 '15 at 23:34
  • I moved the package directives to the top and i got rid of the error, but now the enconding is messed up again. Also the math font remains the default . – svart Nov 30 '15 at 23:38
  • 1
    @svart A minimal example for the failure is needed – egreg Nov 30 '15 at 23:41
  • How is your setup different than mine? Are you using MikTex? How did you install the Kerkis font? – svart Dec 1 '15 at 0:21
  • @svart No, I'm not with MiKTeX, which is notorious for mixing up, when fonts are concerned. I installed the Kerkis OT fonts long ago, while kmath is provided by TeX Live. – egreg Dec 1 '15 at 0:24

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.