Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to make cross references for sections to be symbols but after using the description given I got error report saying keyboard character used is undefined in inputencoding 'utf8'. What might be the way out?

share|improve this question
Welcome to TeX.SX! Can you please add an example of what you're trying to do? – egreg Sep 1 '12 at 20:59

2 Answers 2

If you attempt to typeset utf8 encoded test in LaTeX (with a standard TeX engine underneath) using the inputenc package then the following happens:

  • LaTeX will parse an utf8 character by reading in the right number of 8bit characters which may be one or more, depending which character is in the document.
  • This will give LaTeX a unicode character with a certain unicode number (after some calculation), say 00A1
  • Now LaTeX will attempt to typeset this character, but for doing so, there needs to be a font (loaded) that actually contains the glyph representing the unicode character and ...
  • LaTeX needs to know that fact.
  • LaTeX learns about this through a fairly large number of declarations of the form: \DeclareUnicodeCharacter{00A1}{\textexclamdown}.
  • This translates the unicode number to a LaTeX internal character representation (LICR).
  • But this wouldn't be very helpful if there is no glyph that can be used to print this character. Therefore the inputenc package only sets up those unicode characters for which there are fonts loaded that contain them.
  • For example, if you load T1 encoded fonts via \usepackage[T1]{fontenc} then internally LaTeX loads all the declarations defined in the file t1enc.dfu. (For every established LaTeX font encoding there is a corresponding .dfu file.)
  • But unicode covers a huge number of characters, so if you happen to put one into your document that is not in any font encoding used by LaTeX, then you will end up with the error message telling you this unicode character is not set up.

So what can be done to resolve this for a particular document?

  • first step is to identify the unicode number for the character that LaTeX doesn't know about (this should appear in the error message)
  • second step, which is a bit more complicated, is to determine if there is any TeX font that actualy contains this character and what the encoding is that this font has. No good advice here, but there are some documents that describe the standard LaTeX font encodings.
  • alternatively one can try to add at least the T1 and TS1 encodings to the document as this might resolve the issue (if it is a rather common "western" character).
  • it might also be the case that you can "fake" the character, say if you have some kind of hyphen (of which there are several different ones in unicode) and your editor adds one which is not known by LaTeX you might add a \DeclareUnicodeCharacter declaration with the second argument containing a replacement character that does exist.

Otherwise I fear the only answer is use a different character or use a TeX-based engine that is fully unicode enabled and can access unicode fonts with large charactersets natively.

A more elaborate documentation on this can be found in the documented source code: utf8ienc.pdf which is either in the LaTeX distribution or can be generated from the .dtx file.

share|improve this answer

I had the same problem when a friend wanted to typeset a book on Latin poetry and wanted to directly use vowels with length marks such as ō and ŏ (longa and brevis).

The trick I found has been wrapped up in a package, newunicodechar.



is exactly the same as doing


but spares from the burden of hunting through the Unicode table.

Of course one has to make sure that what's in the replacement text can indeed be produced by the fonts we are loading, which might be the case for a "section mark".

See also Macro to take a character as argument, make it active, then \def it.

Using this package has another advantage; suppose you want to switch to XeLaTeX or LuaLaTeX for processing the document; then a character such as 𝔽 may not correspond to something printable. This particular one depends whether you're loading unicode-math or not; let's assume you're not loading it. A declaration


will be correct in all cases: (pdf)LaTeX, XeLaTeX or LuaLaTeX.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.