10

I have this code which I compile with xelatex.

\documentclass[a4paper]{article}
\usepackage{polyglossia}
\newfontfamily{\armenianfont}{DejaVu Serif}
\setmainlanguage{armenian}

\begin{document}
հայերեն english
$հայերեն english հայերեն$
\end{document}

The Armenian words inside $$ do not appear in the resulting PDF file.

How do I correct this?

3
  • Welcome to TeX.SX! You mean that you would like to use Armenian letters as math variables?
    – egreg
    Dec 29, 2013 at 11:12
  • +1 for the idea. However, it might be confusing for non-Armenian readers...
    – Dror
    Dec 29, 2013 at 11:39
  • @Dror: the armenian text is going to be confusing for this non-armenian. i suspect there's a sub-text "this document is for readers who can read armenian"... Dec 29, 2013 at 13:59

1 Answer 1

12

You have to define a symbol font and assign a math code to the Armenian letters.

Here's how one could do it; it's important that the code is just after the \newfontfamily command. You can use another font, provided it has the required glyphs. Probably the best approach is to use a different name altogether, maybe pointing to the same font:

\documentclass[a4paper]{article}
\usepackage{polyglossia}
\newfontfamily{\armenianfont}{DejaVu Serif}

\newfontfamily{\armenianmathfont}{DejaVu Serif}
\ExplSyntaxOn
\DeclareSymbolFont{armenianletters}{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{m}{it}
\int_step_inline:nnnn { "531 } { 1 } { "556 }
 {
  \Umathcode #1 = "0 \symarmenianletters #1 % low level call
 }
\int_step_inline:nnnn { "561 } { 1 } { "587 }
 {
  \Umathcode #1 = "0 \symarmenianletters #1
 }
\ExplSyntaxOff

\setmainlanguage{armenian}

\begin{document}


Text: հայերեն english

Math: $հայերեն english հայերեն^2$
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .