function parse_equation(intxt);
% Produces a graphical analysis of the parenthetic sructure of a equation
% In addition, a text string suitable for revising the equation is generated
% Kent Conover, 14-Jan-2004
outxt = intxt;
[nr,nc] = size(intxt);
for c = 1:nc;
ot1(1,c) = intxt(1,c);
end;
d = 0;
for c = 1:nc;
if intxt(1,c) == '(';
d = d + 1;
end;
if intxt(1,c) == ')';
d = d - 1;
end;
dl(c) = d;
end;
p_max = max(dl)+1;
p_col(1:p_max,1) = ' ';
d = 0;
for c = 1:1;
p_map = p_col;
if intxt(1,c) == '(';
d = d + 1;
td = num2str(d);
ot2(1,c) = td(1);
ot2(2,c) = '+';
p_map(d+1:p_max,c) = '|';
p_map(d+1,c) = '/';
p_col(d+1,1) ='-';
end;
if intxt(1,c) == ')';
td = num2str(d);
ot2(1,c) = td(1);
ot2(2,c) = '-';
p_map(d+1:p_max,c) = '|';
p_map(d+1,c) = '\';
p_col(d+1,1) =' ';
d = d - 1;
if d < 0;
d=0;
end;
end;
end;
for c = 2:nc;
p_map = [p_map,p_col];
if intxt(1,c) == '(';
d = d + 1;
td = num2str(d);
ot2(1,c) = td(1);
ot2(2,c) = '+';
p_map(d+1:p_max,c) = '|';
p_map(d+1,c) = '/';
p_col(d+1,1) ='-';
end;
if intxt(1,c) == ')';
td = num2str(d);
ot2(1,c) = td(1);
ot2(2,c) = '-';
p_map(d+1:p_max,c) = '|';
p_map(d+1,c) = '\';
p_col(d+1,1) =' ';
d = d - 1;
if d < 0;
d=0;
end;
end;
end;
r = 1;
for c = 1:nc;
if intxt(1,c) == '(';
r = r + 1;
end;
ot3(r,c) = [intxt(1,c)];
if intxt(1,c) == ')';
r = r - 1;
if r < 1;
r = 1;
end
end;
end;
%ot2 = [ot2,' '];
[nri,nci] = size(inputname(1));
outxt = [p_map;ot1];
[nro,nco] = size(outxt);
pad_txt(1:nro,1:nci+7) = ' ';
ed_string = [inputname(1),' = ''',intxt,'''']
outxt = [pad_txt,outxt]