# possible bug in Mathematica TeXForm? Generating \left\left

I asked about this in the TeX chat. It seems Mathematica generate invalid Latex in this example.

ClearAll[y,x];
ode = D[y[x], x] - (y[x]^2 + 1)/(Abs[y[x] + (1 + y[x])^(1/2)]*(1 + x)^(3/2));
TeXForm[ode]


The output is

y'(x)-\frac{y(x)^2+1}{(x+1)^{3/2} \left\left| y(x)+\sqrt{y(x)+1}\right\right| }


Using \left\left is illegal. TeXLive 2014 will not compile it. MWE

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
$$y'(x)-\frac{y(x)^2+1}{(x+1)^{3/2} \left\left| y(x)+\sqrt{y(x)+1}\right\right| }$$
\end{document}


Compile:

 pdflatex foo.tex

! Missing delimiter (. inserted).
<to be read again>
\left
l.7 ...eft\left| y(x)+\sqrt{y(x)+1}\right\right| }

?


Just wanted to confirm with others if this is a bug before send email to supprt@wolfram.com unless someone finds a smart fix or an option to solve this.

V9.01 and V10.

Update:

If any one gets such a case, the fix in this example is to simply remove the extra \left at the outers. Like this

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}
$$y'(x)-\frac{y(x)^2+1}{(x+1)^{3/2} \left| y(x)+\sqrt{y(x)+1}\right| }$$
\end{document}


Compiles now ok. The output is

fyi, just send an email to support@wolfram.com as well. Experts in Latex at TeX forum confirmed the code generated by Mathematica is wrong.

-
The same here using 9.0.1.0 on Linux. –  Sigur Jul 15 at 1:33
The problematic part seems to be that inside Abs is an expression which possibly requires scaled boundaries, because the expression is too large. Therefore, this works TeXForm[Abs[x + 1]] while this TeXForm[Abs[x + 1/2]] is introducing the extra left/right pair. Can find more notation like Abs and Norm that surround an expression? –  halirutan Jul 15 at 1:46