4

When trying to use the inputenc package to enable utf8 characters in my document, I get the error inputenc Error: Unicode char 
 (U+2028) not set up for use with LaTeX. It is triggered by a display formula inside a quote environment. E.g., the following sample already triggers it:


 \documentclass{article}
 \usepackage[utf8]{inputenc}

 \begin{document}
   \begin{quote}
     blah:
\[ blah \]
   \end{quote}
 \end{document}

I thought about \DeclareUnicodeCharacter{2028}{} and that actually seems to work (defining it as \\ produced underfull hboxes), but this feels a bit dodgy; shouldn't this just work out-of-the-box? I'm using the latest version of TeXLive 2016.

6

why have you got line separator in your source?? :-) but anyway this is expected: Unicode has tens of thousands of characters, inputenc does not define tex code for them all, you just need to use \DeclareUnicodeCharacter for any additional ones that you need. So your suggestion of

\DeclareUnicodeCharacter{2028}{} 

is good, or perhaps

\DeclareUnicodeCharacter{2028}{\linebreak} 

depending on the intended meaning of the character. But really such a control character shouldn't be in a tex source at all.


If you paste blah:
\[ blah \] into

https://w3c.github.io/xml-entities/unicode-names.html

Then you will see the following, showing that you have the control character between : and \[

  U+000a LINE FEED (LF)     

  U+0020 SPACE     \space
  U+0020 SPACE     \space
  U+0020 SPACE     \space
  U+0020 SPACE     \space
  U+0020 SPACE     \space
  U+0062 LATIN SMALL LETTER B     b
  U+006c LATIN SMALL LETTER L     l
  U+0061 LATIN SMALL LETTER A     a
  U+0068 LATIN SMALL LETTER H     h
  U+003a COLON     : \mathcolon :
% U+2028 LINE SEPARATOR
  U+005c REVERSE SOLIDUS     \ \backslash \textbackslash
  U+005b LEFT SQUARE BRACKET     [ [ \lbrack [
  U+0020 SPACE     \space
  U+0062 LATIN SMALL LETTER B     b
  U+006c LATIN SMALL LETTER L     l
  U+0061 LATIN SMALL LETTER A     a
  U+0068 LATIN SMALL LETTER H     h
  U+0020 SPACE     \space
  U+005c REVERSE SOLIDUS     \ \backslash \textbackslash
  U+005d RIGHT SQUARE BRACKET     ] ] \rbrack ]
  U+000a LINE FEED (LF)     

  • Thanks, \linebreak is probably even better (2028 is a linebreak), however, if you do that then the output is different from the one without inputenc and that can't be right. The really weird thing is though that I do not have that character anywhere in my source so it must be generated internally by the combination of quote and \[ That's also why I think this is a bug. – Hayo Baan Jul 19 '16 at 9:12
  • @HayoBaan: You do have the character in your source, I can see it in a suitable editor if I copy your example. It is between the colon and the [. Delete this part of the text and retype and you will see that the error is gone. – Ulrike Fischer Jul 19 '16 at 9:46
  • @HayoBaan as Ulrike says you do have the control character after the colon. – David Carlisle Jul 19 '16 at 10:07
  • Awesome, that was it! Now, how I got that character in my code (even when I created the short example, albeit from the original) is another matter, but the mystery is solved. Many thanks! – Hayo Baan Jul 19 '16 at 11:26

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.