0

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 ϑ

cgnieder
  • 66,645
vmk
  • 175
  • 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 09 '15 at 09:41
  • 1
    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 09 '15 at 09:46
  • @egreg: not to say that for Greek tex,t there won't be any kerning. – Bernard Jun 09 '15 at 11:10

2 Answers2

2

The alphabeta package from greek-fontenc supports the use of literal Greek characters in text and math mode under 8-bit TeX (pdflatex).

It extends "textalpha", so you may simply replace

- \usepackage{textalpha}
+ \usepackage[keep-semicolon,normalize-symbols]{alphabeta}

As the symbol variants have no semantic meaning in text and are have no separate code-points in the "LGR" font encoding,the distinction is lost in text mode. Select a font that contains your preferred letter shapes.

G. Milde
  • 259
1

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.