I want to put the following phrase into a book.

Khabarovsk (Russian: Хабаровск)
is located 30 kilometers (19 mi) 
from the Chinese border.

The source is NOT UTF-8 and I don't have the option to make it UTF-8. I want to enter the Russian characters in a robust way that will not be distorted when the file is transferred between different people, and so I am limited to ASCII.

I have entered this:

Khabarovsk (Russian: \char"0425 \char"0430 \char"0431 \char"0430 
\char"0440 \char"043E \char"0432 \char"0441 \char"043A )
is located 30 kilometers (19 mi) 
from the Chinese border.

This works in XeLaTeX (which is what I am using). Is this really the best way to enter these Unicode character code-points into LaTeX source?

Is there a standard way to specify a Unicode character that will work across all versions of LaTeX? If not, any comments on why there is no such standard notation for this? I am just trying to understand where all this is going.


Let me expand upon the excellent answer given by David Carlisle below. The caret notation would be like this:

Khabarovsk (Russian: 
is located 30 kilometers (19 mi) 
from the Chinese border.

This is superior for a number of reasons:

  1. The \char form 'eats' a space after the command (the way TeX normally does) and that means that if you want a space, you have to do something special, like put an extra slash-space (standard TeX command behavior). The caret notation is exactly like a character: put a space between them and that space works like a space between characters.
  2. This conversion is done at the initial parsing level, which means these characters can be used for anything in TeX, including spelling of commands. They simply represent characters in the input stream for any purpose.
  3. David implied that the \char notation might be picking a code point in a font. I suppose most fonts use Unicode so this might or might not be a problem, but in any case using the caret notation allows the character to be processed by all the following logic exactly as if you typed the character into the source file.
  4. The notation is slightly more compact: 8 characters instead of 10.

Only note: the hex digits MUST use lower case letters. I don't know for sure, but I assume this only works on XeTeX and variants of that.

See further discussion at blog post on Adding Unicode Characters to LaTeX documents

1 Answer 1


It's probably better to use ^^^^043a which produces a character token, rather than use \char"043A which is a non expandable primitive accessing a font position. The character token is usable in more contexts (such as writing to tables of contents) and generally has less restrictions than \char.

the ^^^^ notation (and \char"043A) will work in luatex or xetex, neither work in pdftex which can not access slots above "FF To use unicode naturally in pdftex you really want to use utf8 encoding and inputenc.

  • 1
    Thanks for the pointer to quad-^ notation. I saw double-^ notation mentioned elsewhere, but I have not been able to find documentation on it. How does the syntax work: is it exactly 4 hex digits following it? I also am not familiar with the " and how that works. Where could I look up more on this?
    – AgilePro
    Commented Apr 6, 2015 at 1:34
  • 2
    @AgilePro Four ^ want four hexadecimal digits (with a-f lowercase); five want five and six want six.
    – egreg
    Commented Apr 6, 2015 at 8:45
  • Even in PDFTeX you can still ^^ individual UTF8 byte and \usepackage[utf8]{inputenc}. ____________________________________________________________________________________________ The double-^ notation is documented in the TeXBook (chapter 8: The Characters You Type, page 47.
    – user202729
    Commented Oct 23, 2021 at 2:31
  • The extended syntax is documented in LuaTeX manual: "The ^^ notation has been extended: after ^^^^ four hexadecimal characters are expected and after ^^^^^^ six hexadecimal characters have to be given." ■ @egreg Note that five ^ doesn't work in LuaTeX. ■ It's also in the XeTeX companion: "extension of TEX primitives" → "four-digit notation using the syntax ^^^^abcd", although oddly enough it explicitly say that characters not in BMP aren't supported, although it's supported well (despite some minor bugs).
    – user202729
    Commented Oct 23, 2021 at 2:44
  • @user202729 beware commenting on old answers, xetex and luatex normalised their ^^^^ usage a while ago, 5 ^ used to be supported, the xetex manual was also probably correct when it was written and missed an update when ^^^^^^ support added. aslo for pdflatex you don't need \usepackage[utf8]{inputenc} UTF-8 is the default (although it wasn't when this answer was written) Commented Oct 23, 2021 at 3:18

You must log in to answer this question.

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