tags:

views:

10198

answers:

6

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?

A: 

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).

It looks like one Unicode package for LaTeX is no longer supported, although it may still be the best thing out there.

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

TimB
A: 

Unfortunately Latex doesn't directly do the unicode thing. The closest you get are language or encoding specific packages and tools to produce characters outside of the ASCII character set.

caskey
+9  A: 

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.

ChrisN
+20  A: 

"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}

(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.

Will Robertson
\usepackage[utf8]{inputenc} worked for me, cheers
Grzenio
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
I suggest creating a minimal example and asking a new question.
Will Robertson
+3  A: 

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

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

\begin{document}
    The vorticity $ω$ is defined as $ω = ∇ × u$.
\end{document}
Roberto Bonvallet
+2  A: 

Look here how to use unicode letters in Latex without switching to XexTex

http://www.osfight.de/archives/654

osfight.de
That doesn't work for arbitrary unicode, just characters that latex already has commands for.
humble coffee