This is a follow up to How to make non-breaking spaces (ties) in Org-mode that exports properly to LaTeX. One answer to the question is a solution that uses UTF-8 non-breaking spaces but these cause package errors even though the document compilation finishes.

I have boiled it down to the following. The UTF-8 non-breaking space may not be possible to copy from the example. Therefore, it may have to be manually entered. In Emacs it can be entered with C-x 8 Space.



e.g.~ example% non-breaking \240 space between ~ and example


This example gives the following error:

! Package inputenc Error: Unicode char \u8:  not set up for use with LaTeX.

Note that there is an UTF-8 non-breaking space after the colon in that error message.

How can fix this error?

I use TeX Live 2011 updated (which I updated today).


You can use

\newunicodechar{ }{~}

(where in the first argument there's the non-breaking space). This has the advantage that it can be used without any modification also with XeLaTeX and LuaLaTeX, where a non-breaking space would give a space that doesn't stretch or shrink with the other spaces in the same line.

See also Replacing Unicode non-breakable spaces by normal spaces

  • Just wanted to add: it seems that this method does not work with texlive package as supplied by Debian/Ubuntu. Probably the newunicodechar package is missing from the distribution. (It could be added manually in /usr/local/share/texmf.) – snap Feb 18 '12 at 11:07
  • @snap The TeX Live/Debian distribution is based on the October 2009 snapshot of TeX Live and is largely outdated. – egreg Feb 18 '12 at 11:15

Write in the preamble



The macro DeclareUnicodeCharacter is defined in the file utf8.def (the file used by inputenc to define the utf8 mapping) to define the meaning of Unicode characters. The first argument is the hexadecimal code for the character, and the second is the replacement LaTeX code.

The non breaking space is U+00A0, therefore the first argument is 00A0.

In LaTeX, a non-breaking space is generated with a tilde, therefore the second argument is a single tilde.

You can more clearly see what happens if you change the command to

\DeclareUnicodeCharacter{00A0}{\emph{-- non-breaking space --}}

Now in place of the non-breaking space, the text "‒ non-braking space ‒" is inserted.

  • That works. Could you please include an explanation of what that bit of code does in your answer? – N.N. Feb 16 '12 at 20:06
  • I came across this problem and was lucky to find it answered just yesterday. I wanted to add that this method works perfectly with Ubuntu/Debian texlive installation. – snap Feb 18 '12 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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