7

I want this Unicode symbol , left-pointing angle bracket, to be interpreted as \langle.

On TeX Live on my Mac, I tried this:

\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}

\DeclareUnicodeCharacter{2329}{\langle}

\begin{document}
$ 〈  $
\end{document}

which produces this error:

./foo.tex:7: Package ucs Error: Unknown Unicode character 9001 = U+2329,
(ucs)                possibly declared in uni-35.def.
(ucs)                Type H to see if it is available with options.
Unicode character 9001 = U+2329:
Unicode character 9001 = U+2329:
LEFT-POINTING ANGLE BRACKET
BRA
Character available with following options:
   postscript.

But I don't want to use the option postscript, I just want to define that Unicode character 2329 should emit \langle.

What am I doing wrong?

Søren Debois
  • 173
  • 1
  • 5
  • 1
    The U+2329 character is deprecated by Unicode; according to the specs, U+3008 should be used. However, ucs supports this one only by enabling the options cjkbg5 or cjkjis. I'm not sure why you need ucs, can you explain? – egreg Jul 29 '13 at 13:25
  • I get the same results for U+3008. I use usepackage[mathletters]{ucs} because it conveniently defines a host of Unicode symbol for math, particularly Greek letters. I tried enabling cjkjis, but that just broke Unicode support in different ways. – Søren Debois Jul 29 '13 at 13:38
  • @egreg, for mathematical use, shouldn’t U+27e8 “⟨” and U+2789 “⟩” (Mathematical Left/Right Angle Bracket) be preferred? – J. C. Salomon Jul 29 '13 at 15:56
  • @J.C.Salomon Probably you're right. – egreg Jul 29 '13 at 16:03
  • It's 2013. Please use a Unicode-aware TeX engine, i.e. [tag:XeTeX] or [tag:LuaTeX]. – Martin Schröder Jul 30 '13 at 09:03
  • @egreg Tried those also; no luck. – Søren Debois Jul 31 '13 at 11:18
  • @MartinSchröder I'm collaborating with people that I can't expect to update their engines. – Søren Debois Jul 31 '13 at 11:19

2 Answers2

7

You can use the newunicodechar package, but not with the utf8x option to inputenc:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{〈}{\langle}

\begin{document}
$〈$
\end{document}

If you want to use ucs and utf8x (which I can't recommend), you have to load ucs with the Postscript option. The definition associated to U+2329 is however faulty, because it produces nothing even when loading pifont, that seems required. I provide a workaround.

\documentclass[11pt]{article}
\usepackage[postscript]{ucs}
\usepackage[utf8x]{inputenc}

\makeatletter
\AtBeginDocument{%
  \sbox0{\let\Pisymbol\relax〈}% this loads uni-35.def and defines the character
  \@namedef{u-postscript-9001}#1{\langle}% we can now change the definition
}
\makeatother

\begin{document}

$a〈b$
\end{document}
egreg
  • 1,121,712
  • Thanks. However, in my actual document, I wish to use also ucs, which requires inputenc with utf8x. And besides, I still desperately wish to know why my original approach did not work. – Søren Debois Jul 29 '13 at 12:58
  • Thanks. I'll drop my insistence on using ucs and define the symbols I need by hand, using your example above. – Søren Debois Jul 31 '13 at 11:21
0
\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}
%\DeclareUnicodeCharacter{2329}{bad}
\DeclareUnicodeCharacter{9001}{okay}
\begin{document}
$ 〈  $
\end{document}