# To replace “var” greek symbols correctly

Need to use utf8 natural greek symbols in pdflatex. For modern letters I use package textalpha, var greek symbols i workout through replacement and do not know how to do this correctly. Now the text is :

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}

\usepackage{textalpha}

% GREEK Symbols var

\DeclareUnicodeCharacter{03F0}{$\varkappa$}

\DeclareUnicodeCharacter{03D1}{$\vartheta$}

\usepackage{amssymb}   %  \for varkappa

\begin{document}

α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω Α Β Γ Δ Ε Ζ Η Θ

Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω

ϑ   ϰ

\end{document}


It works but IF THE TEXT WILL BE JUST

$ϑ ϰ$


it does not work. So in math mode the replacement of var greek symbols does not work.

Can somebody help me?

The questions are really 2:

• is it any package for standard greek symbols instead of textalpha for text and math mode simultaneously?
• what latex commands are for var greek symbols for text mode? Then we can use \ifmmode or \TextOrMath in \DeclareUnicodeCharacter for text to be correct.

They are in math mode: \varepsilon ε \varkappa ϰ \varphi φ \varpi ϖ \varrho ϱ \varsigma ς \vartheta ϑ

• Sorry, I do not see the question here? Everything works perfectly. If not, please show us some screen shot of what you have and explain, what you want to get! This site is not about reviewing code but about helping with special issues. Please rephrase you post in order to show the problem. Thank you. – LaRiFaRi Jun 9 '15 at 9:41
• It's not really clear what your aim is. Can you be more specific about it? If you need to typeset Greek text there are different and better ways than abusing math mode. – egreg Jun 9 '15 at 9:46
• @egreg: not to say that for Greek tex,t there won't be any kerning. – Bernard Jun 9 '15 at 11:10

Your Problem is that you declare ϑ to mean $\vartheta$. Thus as long as you only use text-mode TeX shows no error.

Unfortunately your example $ϑ$ will lead to $$\vartheta$$. So you will end up with two (empty) parts of inline math and a \vartheta in text-mode what is not allowed as \vartheta is math-only.

As a quick fix one could suggest using

\DeclareUnicodeCharacter{03F0}{\ensuremath{\varkappa}}
\DeclareUnicodeCharacter{03D1}{\ensuremath{\vartheta}}


This construction will put the \vartheta inside math no matter whether it was issued in math-mode or text-mode.

A by far superior would be to use greek natively without math-mode as shown in this question or elsewhere.