# Changing typesetting language without command

I have a problem with typesetting LaTeX using both Greek and English characters. All this time, I've been using the polyglossia+fontspec packages which allowed me to change between Greek and English just by changing language on my keyboard.

This combination allows me to choose the fonts that I will use, but when letters in math mode mix with letters outside of math mode, the result is not so aesthetic. A solution to this is to substitute all math mode letter with \textrm, but I hope to find something less tiresome.

I actually want to change the font that I am using to, say, Kerkis. What I found online is that I have to add the following two packages

\usepackage{kmath,kerkis}
\usepackage[T1]{fontenc}


Adding these two packages (while removing fontspec) makes the file to not even compile.

So, my question is: how can I change the typesetting font in and out of math mode (let's say to Kerkis) while keeping the ability to change language without having to use a TeX command?

Edit: I used the mathspec package instead of fontspec, downloaded Kerkis fonts and manually added them using these:

\usepackage[MnSymbol]{mathspec}
\setmainfont{KerkisSans}
\setmathsfont(Digits,Latin)[Scale=MatchLowercase]{Kerkis}
\setmathsfont(Greek)[Scale=MatchLowercase]{Kerkis}
\usepackage{polyglossia}


Still, it feels like a half-measure since I'm feeling like I should just load a "Kerkis" package or something that would do the job for me, shouldn't I?

• When the alfabet is Latin, glyphs in math mode should also look different as those in text mode. – Przemysław Scherwentke Jan 8 '18 at 13:53
• Please give a real, compilable example of font combinations you find unsatisfactory. – Mico Jan 8 '18 at 14:13
• @mico any font i try in greek language except from the latex defaults does not seem fine. – royal with cheese Jan 8 '18 at 14:22
• Does my answer in this question helps? :(tex.stackexchange.com/q/396528/120578 ) It is about XeLaTeX for these languages and you can chose font for math and for text at any time... – koleygr Jan 8 '18 at 14:25
• Nice approach but I do not know if it answers my question exactly. I still only use greek letters outside of math mode. For math mode I restrict myself to latin characters. – royal with cheese Jan 8 '18 at 15:34

## 1 Answer

Here is the solution I suggested in the comment above:

\documentclass[11pt,oneside]{article}
\usepackage{amsmath}
\usepackage{mathspec}%[MnSymbol]{mathspec} %<-No need for this in this example
%\usepackage{MnSymbol}
\defaultfontfeatures{Ligatures=TeX}
\setallmainfonts{Linux Libertine O}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguage{english}
\setmainfont{Linux Libertine O}
%\newfontfamily\greekfont{Linux Libertine O}

% Definitions of Greek (in math mode)
\def\alpha{α}
\def\beta{β}
\let\oldgamma\gamma %<-see the difference below
\def\gamma{γ}
\def\delta{δ}
\def\epsilon{ε}
\def\zeta{ζ}
\def\eta{η}
\def\theta{θ}
\def\iota{ι}
\def\kappa{κ}
\def\lambda{λ}
\def\mu{μ}
\def\nu{ν}
\def\xi{ξ}
%\def\ο{o}
\def\pi{π}
\def\rho{ρ}
\def\sigma{σ}
\def\tau{τ}
\def\upsilon{υ}
\def\phi{φ}
\def\varphi{ϕ}
\def\chi{χ}
\def\psi{ψ}
\def\omega{ω}
\def\varsigma{ς}
\def\varrho{ϱ}
\def\vartheta{ϑ}

\def\Alpha{Α}
\def\Beta{Β}
\def\Gamma{Γ}
\def\Delta{Δ}
\def\Epsilon{Ε}
\def\Zeta{Ζ}
\def\Eta{Η}
\def\Theta{Θ}
\def\Iota{Ι}
\def\Kappa{Κ}
\def\Lambda{Λ}
\def\Mu{Μ}
\def\Nu{Ν}
\def\Xi{Ξ}
%\def\Ο{O}
\def\Pi{Π}
\def\Rho{Ρ}
\def\Sigma{Σ}
\def\Tau{Τ}
\def\Upsilon{Υ}
\def\Phi{Φ}
\def\Chi{Χ}
\def\Psi{Ψ}
\def\Omega{Ω}

\begin{document}
\selectlanguage{english}

English text

$$α=\frac{β}{γ_s \text{ or }\oldgamma_s} \text{ or }\alpha=\frac{\beta}{\gamma_\sigma} \text{ and } 6_p$$

\selectlanguage{greek}

Ελληνικό κείμενο εδώ

$$α=\frac{β}{γ_s \text{ or }\oldgamma_s} \text{ or }\alpha=\frac{\beta}{\gamma_\sigma} \text{ and } 6_p$$

\setmainfont{FreeSans}
\selectlanguage{english}

English text

$$α=\frac{β}{γ_s \text{ or }\oldgamma_s} \text{ or }\alpha=\frac{\beta}{\gamma_\sigma} \text{ and } 6_p$$

\selectlanguage{greek}

Ελληνικό κείμενο εδώ

$$α=\frac{β}{γ_s \text{ or }\oldgamma_s} \text{ or }\alpha=\frac{\beta}{\gamma_\sigma} \text{ and } 6_p$$

\end{document}


Output: PS: The package MnSymbol didn't used here and see the correction on the \oldgamma spacing.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8622708,"math_prob":0.6842423,"size":1446,"snap":"2019-35-2019-39","text_gpt3_token_len":363,"char_repetition_ratio":0.116504855,"word_repetition_ratio":0.0,"special_character_ratio":0.20401107,"punctuation_ratio":0.08778626,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99940836,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-25T18:22:05Z\",\"WARC-Record-ID\":\"<urn:uuid:b304648c-1d9d-45d9-b90d-b03c697b0e4e>\",\"Content-Length\":\"138930\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a5eeb43e-6bda-4224-841f-ac6dfc389d39>\",\"WARC-Concurrent-To\":\"<urn:uuid:b4861eb9-3f81-4223-9403-4cd135dca5ff>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/409347/changing-typesetting-language-without-command\",\"WARC-Payload-Digest\":\"sha1:KOKFIHKX5MSSD3JQYU3I4X5SQKB6YM6P\",\"WARC-Block-Digest\":\"sha1:H3CLHAGMN7HMNT2S4MMKHCI3P3DPC3W3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027330786.8_warc_CC-MAIN-20190825173827-20190825195827-00012.warc.gz\"}"}