4

I use the \usepackage{newunicodechar} to enter easily some unicode characters in math mode.

For example I used unicode curled phi ( ϕ ) to insert phi in math mode. The problem is that any Unicode word in text mode starting with this phi is changed to math mode! So my question is: How could I use the ifmmoder or other TeX commands to make a suitable defitition of \newunicodechar{ϕ} that behaves diferently in each mode? (Unfortunately, I don't know TeX well ..)

% -*- coding: utf-8 -*-
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek]{babel}
\usepackage{newunicodechar}
\usepackage{Kerkis}

\newunicodechar{ϕ}{\varphi}


\begin{document} ϕαγητό \textlatin{means food}
$ϕ$
\end{document}
6

I don't have Kerkis package so this isn't tested but

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek]{babel}
\usepackage{newunicodechar}
\usepackage{Kerkis}

\newunicodechar{ϕ}{\ifmmode\varphi\else\textphi\fi}


\begin{document} ϕαγητό \textlatin{means food}
$ϕ$
\end{document}

I've use \textphi here but if your text Greek font has both phi forms you could substitute a command that defined var phi in text mode.

  • Thank you David! My next problem is... which fonts have \textvar phi or something like that? Could you please give some ideas or maybe ask the Community? – kornaros Nov 24 '14 at 9:23
  • @kornaros sorry I have no idea. My Greek language skills are restricted to math use. Do you have any greek text setup where both phis work? Perhaps you should ask a new question specifically on that. – David Carlisle Nov 24 '14 at 9:42

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.