3

How to insert U+20B4 unicode character in LaTeX text? I've read that it is possible with XeTeX, but can it be done in LaTeX? Ive tried \char"U+20B4, but obtained bad character code 8372.

Thanks in advance

3
  • 1
    You can use DeclareUnicodeCharacter (see tex.stackexchange.com/a/443042/38080). (Obviously, you need a font with that shape, or fake it somehow). Btw, the character is ₴ fileformat.info/info/unicode/char/20b4/index.htm
    – Rmano
    Oct 13, 2020 at 7:49
  • @Rmano, thanks for reply, but DeclareUnicodeCharacter does not work here because there is not such char in LaTeX font.
    – Spectorsky
    Oct 13, 2020 at 8:57
  • Yes, for that I said "or fake it somehow", as brilliantly shown by @egreg's answer...
    – Rmano
    Oct 13, 2020 at 9:21

1 Answer 1

5

As far as I know there is no font for pdflatex that has U+20B4 HRYVNIA SIGN ₴ (the symbol for the Ukrainian currency).

You can emulate it, with something like

\documentclass[a4paper]{article}
\usepackage[ukrainian]{babel}

\usepackage{graphicx}

\DeclareRobustCommand{\hryvnia}{{%
  \fontencoding{OT1}\upshape
  \settoheight{\dimen255}{S}%
  \vphantom{S}%
  \smash{\ooalign{%
    \hfil\reflectbox{S}\hfil\cr % a reflected S
    \hfil\raisebox{0.25ex}{--}\hfil\cr % upper bar
    \hfil\raisebox{-0.05ex}{--}\hfil\cr % lower bar
  }}%
}}

\DeclareUnicodeCharacter{20B4}{\hryvnia}

\begin{document}

Ви заборгували мені ₴2000.

\end{document}

The definition of \hryvnia maybe is not the best, but the idea is this: you find out how to print the symbol and then use \DeclareUnicodeCharacter to get it when you type in the Unicode character.

enter image description here

6
  • Thanks a lot, it works well in pdf (maybe some adjusting will be done). However, it does not work for yap (internal dvi previewer), separate S and - are displayed (it seems that box transformation does not work in yap).
    – Spectorsky
    Oct 13, 2020 at 8:44
  • 3
    @Spectorsky DVI previewers generally aren't able to reproduce these effects; have you ever tried to look at a TikZ diagram on yap? Use PDF and be happy.
    – egreg
    Oct 13, 2020 at 8:53
  • I use yap for preview. To precise: yap does it correct in ps mode, but does not in pk mode (which I usually switch on). In pk mode, \reflectbox move box horizontally but does not reflect it. Command \scalebox{-1}[1] does the same as \reflectbox.
    – Spectorsky
    Oct 13, 2020 at 9:07
  • 2
    @Spectorsky WIthout PostScript interpretation, you cannot get reflections and other effects that DVI mode is unable to make.
    – egreg
    Oct 13, 2020 at 9:21
  • 3
    @Spectorsky Sorry, but I can't see how DVI mode is helpful nowadays: there are fast and accurate PDF previewers (I'm obviously not thinking to Adobe Reader) around, for every OS. And, sorry again, I can't run yap, for lack of Windows, which I'm very satisfied of. ;-)
    – egreg
    Oct 13, 2020 at 9:47

You must log in to answer this question.

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