function LatexMatrices(d)

% LatexMatrices(d) spews forth Latex versions of P and Q LatexMatrices for
% B-spline wavelets of degree d, from level 1 until the general pattern
% appears.

disp(['% B-spline scaling function and wavelet matrices of degree ' ...
    num2str(d)]);
disp('% (automatically generated by Matlab code in LatexMatrices.m)');
nums = str2mat('one{','two{','three{','four{','five{','six{','seven{');

% Show all the P's.
jmax = ceil(log(d + 3) / log(2)) + 2;
for j = 1:jmax-2
  disp(['\def\P' nums(j,:)]);
  LatexP(d, j);
  disp('}');
end;
disp('\def\Pj{');
LatexP(d, jmax, 'pattern');
disp('}');

% Show all the Q's.
jmax = ceil(log(2*d + 3) / log(2)) + 1;
for j = 1:jmax-1
  disp(['\def\Q' nums(j,:)]);
  LatexQ(d, j);
  disp('}');
end;
disp('\def\Qj{');
LatexQ(d, jmax, 'pattern');
disp('}');
return;
