# Entering Unicode characters in LaTeX

How do I enter Unicode characters in LaTeX? What packages do I need to install and what escape sequence do I type to specify Unicode characters in an ASCII source file?

• is there a reason you can't encode the source file in UTF8?
– bene
Oct 20 '08 at 21:05
• @bene, even with that: inputenc with UTF-8 is more of a hack (and a very long sequence of translations between byte sequences and correspondig LaTeX commands). It's not pretty.
– Joey
Jan 26 '11 at 1:14
• Why is everyone recommending XeTeX and not LuaTeX? Nov 12 '11 at 22:50
• Yeah, LuaTeX FTW! Aug 30 '12 at 22:04
• If you're a Mac user, you might be interested in this answer, which describes how I made a custom keyboard layout full of math symbols, greek letters, and so on. Apr 22 '13 at 20:47

Have you considered using XeTeX? This is an adaptation of TeX that adds Unicode support, and is included in the latest TeX Live and MiKTeX distributions. This Wikipedia article gives a good introduction.

• Not only Unicode support (that was partially available as an ugly hack-job before) but proper modern font support as well. Very nice, but a pain to get working, at least here :-)
– Joey
Jul 25 '11 at 12:48
• Can you post a minimal example of using xetex that illustrates what you mean? At minimum, it seems you need to set the default font to something that covers the range of characters you want -- otherwise, characters not covered are simply (and silently!) ignored. Jan 16 '12 at 5:54
• Unlike the other answers, this doesn't seem to answer the question. Feb 27 '13 at 19:35
• You need to add \usepackage{unicode-math}, see tex.stackexchange.com/a/394109/85164 Apr 17 '19 at 3:21
• Then use \char" followed by the four digit Unicode value: stackoverflow.com/a/56707992/1458208 Jun 21 '19 at 17:26

"Unicode" in this context could mean either in the input or in the output. I assume you're looking to insert something like "©" into your source and have it do something meaningful.

For full support for unicode input and unicode fonts, take a look at XeTeX; it's easy to get started — just select an appropriate font and the unicode characters in your input are directly typeset as unicode glyphs in the output. Switching engines is not always a possibility, however, and sometimes you'll want to stick with pdfTeX for its other useful features.

The best that regular LaTeX (i.e., based from pdfTeX in a modern distribution) can do is recognise UTF-8 sequences in the text and expand macros based on what it sees. Load the inputenc package to select the UTF-8 input encoding:

\usepackage[utf8]{inputenc}


Note that the resulting input file must not have a byte-order mark (BOM) at the beginning, or else it won't compile. (You can also use the [utf8x] option which has more extensive coverage but is not as well supported. I don't have any experience using this option.)

To define behaviour for unicode characters, use the \DeclareUnicodeCharacter command that is then defined. Here's an example for binding the control sequence \dash to the input character "—"; i.e., a literal em-dash, U+2014, in the source:

\DeclareUnicodeCharacter{2014}{\dash}


\dash can then be defined in the usual manner; I use:

\DeclareRobustCommand\dash{%
\unskip\nobreak\thinspace\textemdash\allowbreak\thinspace\ignorespaces}


This defines a dash that has a small space on either side and will only allow a line break after it.

• \usepackage[utf8]{inputenc} worked for me, cheers Mar 21 '09 at 15:50
• Doesn't work for me. \DeclareUnicodeCharacter has no effect, whether it's in or not, the \dash command works. OTOH, if \DeclareRobustCommand is missing, \dash doesn't work. And where does the Unicode character enter anyways? \DeclareRobustCommand uses \textemdash. (Of course this works in a way for the dash, but I tried to transfer it to another Unicode character, U+2318, the "twiddle" known from the Apple command key.)
– Jann
Nov 19 '09 at 9:04
• I suggest creating a minimal example and asking a new question. Nov 19 '09 at 13:24
• Note though that in practice there seem to be no constraints against line breaks either before or after an (em-/en-)dash used for parenthetical purposes. See my now updated answer to this question about hyphens and dashes. Jul 24 '12 at 19:42
• @user14996 I'm fairly sure this is discussed in the TeXbook, and I have no problem consulting Knuth as an authority in this area. Happy to concede that most publications don't do it though — possibly due to the software they use. Jul 26 '12 at 3:03

This is a minimal example that finally worked for me without using XeTeX:

\documentclass{article}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}

\begin{document}
The vorticity $ω$ is defined as $ω = ∇ × u$.
\end{document}

• Thanks Roberto, this is a nice trick when you are bound to use no XeTeX. E.g. with texi2dvi which I used in R I did not know how to switch the engine. I had to reprogram my rendering functions if it wasn't for your hint here, mathletters did the trick, YAY! Nov 23 '12 at 18:44
• Also works for pdflatex Aug 27 '13 at 11:58
• Not great to use utf8x. I have an MWE for xelatex, but I can't publish it, unfortunately. Let me know if you want me to "ask the right questions" that might prompt the right answers for you.
– user152148
Jan 23 '19 at 2:19
• This is a great solution! For those who oppose this solution, I would like to know better what exactly can go wrong with utf8x. Even if I was willing to use "better" compilers, I really need backward compatibility to be 100% sure that my co-authors will be able to compile my files, so yes I'll be using good old pdflatex for a long time Apr 22 '19 at 1:33
• Remark: Unlike unicode-math, x²³ will create "double superscript error", which causes problem (incorrect typesetting) with x²³₄₅ for example. Sep 13 at 15:34

Try \char"hexcode like \char"2012 for the ‒ (figure-dash). This command works in XeLaTeX and probably other engines

• Welcome to Stack Overflow! This will only work in certain TeX engines, especially the unicode-capable ones (XeTeX, LuaTeX). Could you add to your answer in which engine your example worked? Nov 12 '11 at 18:19
• and how to insert a hexidecimal? Jan 30 '15 at 13:32
• Thank you. I have been searching for hours, only to be misdirected to things that don't work. This is the first solution that works at least for XeLaTeX. It is kind of shocking, really, that there is NO standard way to simply specify a unicode codepoint in a document and have it work everywhere. Apr 5 '15 at 23:04
• This does not work for me in XeLaTeX
– 71GA
May 26 '20 at 15:21
• Note that •(1) this does not work in PDFlatex, it's explicitly mentioned in the TeXBook that "AB only work for at most 2 hexadecimal characters, and •(2) in most case it's possible to simply type out the Unicode character directly (⌀ instead of \char"2300 and it will work), •(3) If the character is not available in the font, it will be silently skipped, see tex.stackexchange.com/questions/45796/… Sep 13 at 15:50

In case anyone is not satisfied with any of the answers: I just had the same problem and came up with my own little solution. I didn't want to dig into another distribution but stay with pdflatex. So I created a textfield in inkscape, put the character in, cropped it, and saved as pdf. You can include the pdf in your document like this:

\includegraphics[width=1em]{symbol.pdf}

• Welcome to TeX.SE! Yes the solution of using an image has been mentioned a few times on this site recently (e.g. at this question), but it hasn't been mentioned at this question from 2008 so I've upvoted your answer. Of course, this would be a highly impractical solution in other cases, such as when one has a large number of Unicode characters one wants to enter. May 16 '17 at 21:29
• Problem is that images can't be text-searched.
– user152148
Jan 23 '19 at 2:21
• Odds are, when you trying to include non ASCII characters, people don’t want to search for them. In my case it was the “airplane” character. Of course, I don’t know how popular Tex is in non ASCII-languages. Jan 24 '19 at 7:17
• Use replace inkscape with Xelatex. Just generate the character you want in Xelatex as a standalone document class and proceed include it as you mentioned above. Jun 29 '20 at 20:54

In order to use XeLaTeX (and even both pdflatex and xelatex on the same document), you can use the simple unixode package:

\documentclass{article}
\usepackage{unixode}

\begin{document}
The vorticity $ω$ is defined as $ω = ∇ × u$.
\end{document}


You may then compile your document either with pdflatex or with xelatex.

Note: the package is in development; the aim is to support as many unicode equivalents as possible.

• Looking at the code, it only supports Unicode math symbols. Sep 6 '18 at 19:47

As of today, both XeTeX and LuaTeX will let you input unicode without complaining.

• Whether it "complains" depends on HOW you enter it. You need to be specific on exactly what you mean by "will let you input". Apr 5 '15 at 21:13
• @ℝaphink Could you show an example on how you would input unicode in LuaLaTeX ? Mar 30 '18 at 19:46

Sorry, I'm not an expert on this, but hope I can at least provide some useful leads.

A lot of the early multi-lingual support for LaTeX predates the widespread adoption of Unicode, although it looks like there's been some consolidation around Unicode recently. So you might find something useful in specific language support packages, e.g. CJK LaTeX (for Chinese, Japanese and Korean).

Another Unicode package for LaTeX has a new name (formerly unicode; now ucs). For a list of Unicode packages, see https://ctan.org/topic/unicode .

You might also have a look at the excellent book The LaTeX Companion, which includes a section on multilingual text.

• unicode.sty was renamed ucs.sty, and the old name was kept as an alias. ucs.sty acquired a new maintainer, and it was decided that the alias would be dropped. Aug 31 '12 at 8:29
• Thanks for answer +1, though ucs is incompatible with biblatex :_( Aug 24 at 9:36

As of 2020, Arthur Reutenauer says that XeTeX has “gone into maintenance mode,” and the future of TeX development is LuaTeX. I would therefore recommend using LuaTeX when you can, then XeTeX if you have to, and PDFTeX if it’s all that your publisher supports.

Now that LuaTeX supports complex scripts, the main XeTeX feature I use that LuaTeX does not have (as of July 2020) is interchar tokens. There are, on the other hand, many LuaTeX features that XeTeX does not have. I use microtype font expansion in nearly every document I create.

If you’re asking what syntax to use to enter Unicode characters, you can use the syntax ^^^^abcd for U+ABCD, \char"ABCD, \symbol{"ABCD}, or any of the macros defined by the LaTeX kernel or unicode-math.

This question is really ambiguous, and I believe the answers are to the wrong interpretation. To have LaTeX handle Unicode is what is being answered, what I understand is being asked is how to enter such characters into the file. And that depends on the editor used... I've even copy&pasted some from Wikipedia pages into xemacs to go around that. The methods given in the Unicode FAQ clash with xemacs definitions or get interpreted at random by gnome-terminal :-(

If you are looking for unicode characters defined in a standard font, you can do: Use either XeLaTeX or LuaLaTeX.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\begin{document}
Print some leaves: {\fontspec{Symbola} %the font name
\symbol{"1F343}} %unicode symbol code
\end{document}


• Thank you! This finally solved the problem I was struggling for a long time. On Ubuntu I had to first manually download the Symbola font with sudo apt install fonts-symbola. Aug 8 '20 at 10:13
• I'm still struggling to be able to do this on non-standard fonts, particularly in Overleaf. Aug 19 '20 at 19:23