From 598c1e7c075058449d8ff8cdae59da6bc20bc61e Mon Sep 17 00:00:00 2001
From: "Davide P. Cervone" <dpvc@union.edu>
Date: Tue, 20 Jan 2015 14:21:34 -0500
Subject: [PATCH] When closing table cells, get new table pointer.  Resolves
 issue #1013.

---
 unpacked/extensions/TeX/AMScd.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/unpacked/extensions/TeX/AMScd.js b/unpacked/extensions/TeX/AMScd.js
index 901b0aec1..0051ac5ff 100644
--- a/unpacked/extensions/TeX/AMScd.js
+++ b/unpacked/extensions/TeX/AMScd.js
@@ -70,7 +70,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
       if (!c.match(/[><VA.|=]/)) {return this.Other(name)} else {this.i++}
 
       var top = this.stack.Top();
-      if (!top.isa(STACKITEM.array) || top.data.length) {this.CD_cell(name)}
+      if (!top.isa(STACKITEM.array) || top.data.length) {
+        this.CD_cell(name);
+        top = this.stack.Top();
+      }
       //
       //  Add enough cells to place the arrow correctly
       //