[Tex/LaTex] XeTeX \left and \right problem

delimitersmath-modeunicode-mathxetex

I have a problem with the and symbols (Unicode encoding: 27E8 and 27E9) which replace the \langle and \rangle, when I try to combine them with \left and \right commands. The following examples gives error although, if I change \left〈 some formula \right〉 with \left\langle some formula \right\rangle or \left( some formula \right), it works. What is more interesting is that if I change 〈〉 with (Unicode encoding: 2016 ) the following example also works.

\documentclass{book}
\usepackage{amsmath}
\usepackage{xltxtra}
\usepackage{unicode-math}

\unimathsetup{math-style=ISO}
\setmathfont{lmmath-regular.otf}

\begin{document}
 bla bla bla bla
 blabla blaaa
    \[
       \left‹ \dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5} \right›
    \]
bla bla bla bla
\end{document}

I already defined the commands \〈 and \〉 like this

\newcommand\〈{\langle}
\newcommand\〉{\rangle}

but I think this symbols should work with \left and \right in the same manner like |, {, [ and of course . I use Kile for the front-end and TeXLive 2011 manually installed on a x64 machine (Kubuntu operating system).

Because I can not answer my questions (for now) I'll put something here, so sorry for the long post.

It seems that XeTeX (or XeLaTeX, I'm new so sorry for may ignorance) produces the same output for \left< some formula \right> (where < > are the common less and greater) and \left\langle some formula \right\rangle but a totally different output for < some formula > and \langle some formula \rangle. Here is an example.

\documentclass{book}
\usepackage{amsmath}
\usepackage{xltxtra}
\usepackage{unicode-math}
 \XeTeXdelcodenum`‹=\XeTeXdelcodenum`<
 \XeTeXdelcodenum`›=\XeTeXdelcodenum`>
\unimathsetup{math-style=ISO}
\setmathfont{lmmath-regular.otf}

\begin{document}
bla bla bla bla
 blabla blaaa
 \begin{gather}
\left< \dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5} \right>\\
\left\langle \dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5} \right\rangle\\
\langle ϕ(x-k),Ψ(x)\rangle\\
<ϕ(x-k),Ψ(x)>\\
‹ϕ(x-k),Ψ(x)›\\
\left\langle ϕ(x-k),Ψ(x) \right \rangle\\
\left< ϕ(x-k),Ψ(x) \right>
\end{gather}
bla bla bla bla $<  ‹$
\end{document}

And about the 〈〉, I will drop using them, in the first place they do not make the desirable output (although in the unimath-symbols documentations they are represented with the \langle, \rangle Macros ), and they are cumbersome.

My question is now, whey 〈〉 do not behave like the macro command in the documentation.

Best Answer

Apparently unicode-math doesn't assign a delimiter code to and (it should, in my opinion). Add the following magic code after having loaded unicode-math

\XeTeXdelcodenum`〈=\XeTeXdelcodenum`<
\XeTeXdelcodenum`〉=\XeTeXdelcodenum`>

Now \left〈 and \right〉 will work.

One has to pay attention to the characters used. For example the following are different:

‹〈
› 〉

In the first line we have U+2039 (SINGLE LEFT-POINTING ANGLE QUOTATION MARK) and U+3008 (LEFT ANGLE BRACKET); in the second line there are U+203A (SINGLE RIGHT-POINTING ANGLE QUOTATION MARK) and U+3009 (RIGHT ANGLE BRACKET). Only U+3008 and U+3009.

In your example you are confusing the two. However it's possible to use also U+2039 and U+203A for the angle brackets:

\documentclass{book}
\usepackage{amsmath}
\usepackage{unicode-math}
\unimathsetup{math-style=ISO}
\setmathfont{lmmath-regular.otf}

\XeTeXmathcodenum`‹=\XeTeXmathcodenum`〈 % make U+2039 the same as U+3008
\XeTeXmathcodenum`›=\XeTeXmathcodenum`〉 % make U+203A the same as U+3009
\XeTeXdelcodenum`〈=\XeTeXdelcodenum`<   % use U+3008 after \left or \right
\XeTeXdelcodenum`〉=\XeTeXdelcodenum`>   % use U+3009 after \left or \right
\XeTeXdelcodenum`‹=\XeTeXdelcodenum`<   % use U+2039 after \left or \right
\XeTeXdelcodenum`›=\XeTeXdelcodenum`>   % use U+203A after \left or \right

\begin{document}
bla bla bla bla
 blabla blaaa
 \begin{gather}
\left〈\dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5} \right 〉\\
\left‹\dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5} \right ›\\
\left\langle \dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5}\right\rangle\\
\left< \dfrac{\frac{x+2}{y}+\frac{3}{4}}{x^2+y^2-5}\right>\\
〈a〉\\
‹a›
\end{gather}
bla bla bla bla $< 〈 ‹$
\end{document}