//   Rutina za ispis L2 i H1 greske u latex formatu. 
//   Ispis je u obliku tabele 
func int ispis(real[int] & step, real[int] & errL2, real[int] & errH1,
               int noOfItems, bool zaglavlje)
// Klasična C-style funkcija. Mora biti definirana prije svojeg 
// poziva.
//      step      = polje prostornih koraka mreže
//      errL2     = polje pripadnih L2 grešaka
//      errH1     = polje pripadnih H1 grešaka (u H_0^1 polunormi)
//      noOfItems = broj vrijednosti iz polja h, errL2 i errH1 koje treba ispisati
//      zaglavlje = true ako treba ispisati latex zaglavlje, false ako ne.
//
//     Ako se vektori ne definiraju kao reference bivaju uništeni na izlazu iz funkcije
{
      if( (noOfItems > errL2.n) || (noOfItems > step.n) || (noOfItems > errH1.n))
      {
         cout << "Greska pri pozivu funkcije ispis. "
              << "Broj elemenata za ispis suvise velik.\n";
         cout << "Broj elemenata za ispis = "<< noOfItems << endl;
         cout << "Dimenzija polja h = "      << step.n    << endl;
         cout << "Dimenzija polja err = "    << errL2.n   << endl;
         cout << "Dimenzija polja err = "    << errH1.n   << endl;

         exit(-36);
      }
         cout << "Dimenzija polja h = "      << step.n    << endl;
         cout << "Dimenzija polja errL2 = "  << errL2.n   << endl;
         cout << "Dimenzija polja errH1 = "  << errH1.n   << endl;
      ofstream ofile("error.tex");

      if(zaglavlje == true)
      {
        ofile << "\\documentclass[12pt]{article}\n";
        ofile << "\\usepackage{amsmath}\n";
        ofile << "\\usepackage{amssymb}\n";
        ofile << "\n";
        ofile << "\\begin{document}\n";
        ofile << "\n";
      }
      ofile << "\\begin{center}\n";
      ofile << "\\begin{tabular}{|c|c|c|}\\hline\n";
      ofile <<
      " h  \& $\\| u_e -u_h \\|_{L^2}$ \& $| u_e -u_h |_{H^2}$ \\\\ \\hline\\hline\n";
      for(int i=0; i<noOfItems; ++i)
         ofile << step[i]<<   "  \& "<< errL2[i]<<" \& "<< errH1[i]<<" \\\\ \\hline\n";
      ofile << "\\end{tabular}\n";
      ofile << "\\end{center}\n";
      if(zaglavlje == true)
      {
         ofile << "\n";
         ofile << "\\end{document}\n";
      }

//      exec(" latex error.tex");
      return 1;
}