Re: [jlatexmath] NullpointException in MatrixAtom

classic Classic list List threaded Threaded
1 message Options
Calixte Denizet-2 Calixte Denizet-2
Reply | Threaded
Open this post in threaded view
|

Re: [jlatexmath] NullpointException in MatrixAtom

Hi Graeme,

Thanks for this bug.

I just add a "case aligned :" before "case align :" and idem for ...at
since according to the doc I found, env. align and aligned are the same
but aligned is inside equation env. (idem for ...at). I committed:
http://forge.scilab.org/index.php/p/jlatexmath/source/commit/06eb600af6231e2fecccca2e986e5b6c22ca8287/

So, you can "git pull".

Regards,

Calixte

Le jeudi 16 décembre 2010 à 19:21 +0000, Graeme Kidd a écrit :

>
> Hi
>
> I was just trying to convert the following latex into a EPS:
>
> \begin{aligned}
>   \text{A } & \text{ =  x}^\text{2} \text{  +  4xh} \\  
>    & \text{ =  x}^\text{2} \text{  +  4x} \times \frac{{\text{4000}}}
> {{\text{x}^\text{2} }} \\  
>    & \text{ =  x}^\text{2} \text{  +  }\frac{{\text{16000}}}
> {\text{x}} \\  
> \end{aligned}
>
> But when it tried to created a TeXIcon I got the following
NullPointerException:
>
> Exception in thread "main" java.lang.NullPointerException
>         at
org.scilab.forge.jlatexmath.MatrixAtom.createBox(MatrixAtom.java:364)
>         at
org.scilab.forge.jlatexmath.TeXFormula.createBox(TeXFormula.java:386)
>         at
org.scilab.forge.jlatexmath.TeXFormula.createTeXIcon(TeXFormula.java:401)

>         at embedding.latex.Convert.toSVG(Convert.java:55)
>         at embedding.latex.Latex2TIFF.main(LatexConvert.java:68)
>
> After looking into the code I believe I may have a simple fix for it:
> Simply change line 286 to 289 in the MatrixAtom class from this
> if (w == Float.POSITIVE_INFINITY) {
>     arr[0] = nullBox;
>     arr[col] = arr[0];
> }
>
> To this:
> if (w == Float.POSITIVE_INFINITY) {
>     arr[0] = nullBox;
>     arr[col-1] = arr[0];
>     arr[col] = arr[0];
> }
>
> Would this fix be acceptable?
>
> Thanks,
> Graeme
>
>
>