4

I am trying to use a cyrillic glyph as a symbol for a proportionality factor. It's the ӄ and its unicode number is 04C4 (see unicode page). So i crawled the english web for information on this, and after about 3 hours i managed to include the glyph in my text with

\usepackage[T2B, T1]{fontenc}   <- so it selects T1 as standard, but has T2B available
\usepackage{lmodern}            <- don't know if this is needed, but i guessed it might me useful for having a font with cyrillic support.

within the document:
`{\fontencoding{T2B}\selectfont \CYRKHK}`

This prints the glyph in ordinary text. In math mode it's possible to get it with a nifty workaround: enclose the above in \text{} (see here. This solution works somehow, but it is really crappy. For instance it doesn't work for lots of other good looking cyrillic letters, like ҟ U+049F (-> "Undefined control sequence." error). And i don't even want to think about, how agonising it would be, to include Japanese glyphs as well.

So the real question is: is there a simple and robust way to include any kind of glyph, i can find in unicode? Say a Katakana like ャ U+30E3, next to a cyrillic glyph, next to a Bengali ন U+09A8. Typing this into stackexchange without any problem raises an obvious second question: is Firefox actually better at typesetting unicode symbols, than latex? O.o

What i've tried, that didn't work somehow:

  • using \DeclareUnicodeCharacter{<number>}{\<command to place the thing>} with \usepackage[utf8]{inputenc} -> \DeclareUnicodeCharacter isn't defined for some reason (beyond my latex horizon). There was another method with \newunicodecharacter or something like that (can't remember). That did nothing at all.

  • using XeTeX -> no change, exept that other stuff broke. I returned to pdflatex. So this would not work.

  • using the package mathtext -> nothing happend

  • using the package cyrillic -> fails to load, even though it is installed with TeXlive.

My current configuration:

\RequirePackage{fix-cm}
\documentclass[12pt,index=totoc,bibliography=totoc,ngerman, BCOR=12mm]{scrreprt}

%header
\usepackage[T2B, T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[reqno]{amsmath}
\usepackage{amssymb}

\usepackage[svgnames,table,hyperref]{xcolor}
\definecolor{dblue}{rgb}{0 0.447 0.741}
\usepackage{lipsum}
\usepackage{graphicx}

\usepackage{listing}
\usepackage{matlab-prettifier}
\usepackage{rotating}
\usepackage{flafter}
\usepackage{subfig}
\usepackage{makeidx}
\usepackage[german,noprefix]{nomencl}
\usepackage[format=hang,labelformat=simple,font={small,sf},labelfont={small,sf},textfont={small,sf}]{caption}
\usepackage{booktabs}
\usepackage{setspace}
\usepackage{subfloat}
\usepackage[colorlinks,linkcolor=dblue,pagebackref]{hyperref}

2 Answers 2

5

If you're not short of math symbol fonts, you can define a new one:

\documentclass{article}
\usepackage[X2,T1]{fontenc}

\DeclareSymbolFont{cyrillic}{X2}{cmr}{m}{n}
\SetSymbolFont{cyrillic}{bold}{X2}{cmr}{bx}{n}

\DeclareMathSymbol{\khk}{\mathord}{cyrillic}{139}

\begin{document}

$a+\khk(b)_{\khk(b)}$

\end{document}

The advantage of the X2 encoding is that it covers all (well, almost all) glyphs in the various Cyrillic encodings.

enter image description here

If you're short of symbol fonts, a less efficient solution is to use \text.

\documentclass{article}
\usepackage[X2,T1]{fontenc}
\usepackage{amsmath}

\DeclareRobustCommand{\khk}{%
  \mathord{\text{\usefont{X2}{cmr}{m}{n}\symbol{139}}}%
}

\begin{document}

$a+\khk(b)_{\khk(b)}$

\end{document}

You can change the type of the math atom, if it is not \mathord, into something else (\mathrel, if it should be a relation symbol).

You can also use directly the letter in the formulas, with UTF-8. This is for the second solution, the first one will work the same.

\documentclass{article}
\usepackage[X2,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\DeclareUnicodeCharacter{04C3}{\khk}

\DeclareRobustCommand{\khk}{%
  \mathord{\text{\usefont{X2}{cmr}{m}{n}\symbol{139}}}%
}

\begin{document}

$a+Ӄ(b)_{Ӄ(b)}$

\end{document}

Sorry, no Japanese or Bengali, this way. Think to your readers who would have a hard time in deciphering those symbols.

5
  • Yup, thanks. That works for the cyrillics. Though i'd really like to use a few symbols of other languages as well. The sad truth is that most of the Latin, and Greek glyphs are overloaded with meaning. In my oppinion using strange symbols isn't a problem for the reader, as long as a nomenclature is provided. I will probably include a phonetic remark in there.
    – Malibu
    Feb 14, 2017 at 0:12
  • 1
    @Malibu I think the opposite.
    – egreg
    Feb 14, 2017 at 0:20
  • +1, How do I find the list of {\mathord}{cyrillic}? How do you know what is {139} and which one is Zhe Ж ж ?
    – wonderich
    May 20, 2019 at 1:43
  • @wonderich See the fonttable package.
    – egreg
    May 20, 2019 at 6:16
  • thank you -- but I do not find a link, do you have a link to? Zhe Ж ж ?
    – wonderich
    May 20, 2019 at 20:31
0

Got it to work with XeLaTeX and a unicode-supporting font -- while I prefer libertinus (and it does beautiful math-mode Cyrillic and some Middle-Eastern scripts), it does not have good Asian coverage so for this I used my fallback Unifont. All you need to do get your glyph to display in math mode is to wrap it in \hbox (or even, apparently, \mathrm -- does someone know why?). To make it size properly with subscripts, we provide definitions with \mathchoice.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Unifont} % \usepackage{libertinus} has no Asian

\newcommand{\MM}[1]{\mathchoice{\hbox{#1}}{\hbox{#1}}{\hbox{\scriptsize{#1}}}{\hbox{\tiny{#1}}}}

\begin{document}

blah $\hbox{x}$ blah $a\MM{ャ}T = 2নy+3\hbox{ж}^5-x_{\MM{ж}}$ blah ャনж

\begin{equation}
  d_0 \mathbf{i}\mathrm{নT} = \forall 2x \MM{ャ}
\end{equation}

\end{document}

I also briefly tried the package unicode-math but 1. It only works with OT math fonts, of which 2. None seem to have Asian support.Output of GNU Unifont Bengali, Kana, and Cyrillic in text and math-mode

1
  • 1
    To comment above, I wholly endorse using Sanskrit-Hindi, Persian, Cyrillic, Chinese numerals, and the Mayan zero (all important in history of math) as alternatives to especially blackboard bold and script Latin. It's at the point where some books will readily use book both bbb and boldface (for fields and tensors say) or both curly and fancy script (for Lagrangian and L-density vs ang-mom in one book). I for one welcome a bit of fresh culture.
    – Kompootor
    Jul 30, 2019 at 11:08

You must log in to answer this question.

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