diff --git a/tutorial/.cvsignore b/tutorial/.cvsignore
index 73631fda817d823fdfa34d3484a523d702ba8643..4c34fe0ddc2f00a448a257d2cd79adf28ded8bb2 100644
--- a/tutorial/.cvsignore
+++ b/tutorial/.cvsignore
@@ -8,13 +8,19 @@ Parser.wmml
 ProtocolsHTTP.wmml
 ProtocolsLysKOM.wmml
 ___tmp.*
+__tmp.ppm
 error.pdf
 extra_textflows.mif
 gfx
 illustration*.*
 illustration_cache
+latex_wcache
 man
 pike.pdf
+test.aux
+test.dvi
+test.log
+test.tex
 texput.log
 tut*.html
 tutorial-foo.wmml
diff --git a/tutorial/.gitignore b/tutorial/.gitignore
index e9b3e1db3865df4f033296da78268801a814bac0..b60197ebaf662fa1455c0bfb9ffdd05e563c28a7 100644
--- a/tutorial/.gitignore
+++ b/tutorial/.gitignore
@@ -8,13 +8,19 @@
 /ProtocolsHTTP.wmml
 /ProtocolsLysKOM.wmml
 /___tmp.*
+/__tmp.ppm
 /error.pdf
 /extra_textflows.mif
 /gfx
 /illustration*.*
 /illustration_cache
+/latex_wcache
 /man
 /pike.pdf
+/test.aux
+/test.dvi
+/test.log
+/test.tex
 /texput.log
 /tut*.html
 /tutorial-foo.wmml
diff --git a/tutorial/Makefile b/tutorial/Makefile
index fb7798194a368b07d8ec9613f2c2b75bcfc5715a..30c37285dcd10d14f0623ac722c8fe2a84c3e4c6 100644
--- a/tutorial/Makefile
+++ b/tutorial/Makefile
@@ -95,7 +95,7 @@ the_image_module.html: Image.wmml the_image_module.wmml
 clean:
 	-rm -f *.html *.md illustration_cache gfx/* $(MADEFILES) 
 	-rm -f tutorial.dvi tutorial.tex tutorial.aux
-	-rm -f tutorial.log tutorial.toc
+	-rm -f tutorial.log tutorial.toc latex_wcache
 
 rebuild:
 	-rm -f $(MADEFILES)
diff --git a/tutorial/pdflatex.pike b/tutorial/pdflatex.pike
index 9164119292a26546dd17ed9e42229268738adba7..2bb5566635de07f9e83161e83a8ff88022cd305c 100644
--- a/tutorial/pdflatex.pike
+++ b/tutorial/pdflatex.pike
@@ -12,6 +12,14 @@ inherit "latex";
 
 string extention=".pdftex";
 
+string packages=
+#"\\usepackage{isolatin1}
+\\usepackage{latexsym}  % For $\Box$
+\\usepackage{amsmath}
+\\usepackage{longtable}
+\\usepackage[pdftex]{graphicx}
+";
+
 string convert_gfx(TAG tag)
 {
   string file;
@@ -21,7 +29,7 @@ string convert_gfx(TAG tag)
 			  300.0,
 			  tag->data && Sgml.get_text(tag->data));
   
-  if(!file) return "\\{Large Error}\n";
+  if(!file) return "\\{Large Error, no file}\n";
 
   switch( (file/".")[-1] )
   {
@@ -32,9 +40,10 @@ string convert_gfx(TAG tag)
       return "\\includegraphics{"+file+"}";
 
     default:
-      return "\\Huge{error}";
+      return "\\{Huge error, wrong extention}";
 
     case "png":
+    case "jpg":
 //      return "\\epsfbox{"+file+"}";
       
       return sprintf("\\pdfimageresolution=%d\n\\includegraphics{%s}",
@@ -59,12 +68,8 @@ string package(string x)
 \\pdfoutput=1
 \\relax
 \\documentclass[twoside,a4paper]{book}
-\\usepackage{isolatin1}
-\\usepackage{latexsym}  % For $\Box$
-\\usepackage{amsmath}
-\\usepackage{longtable}
-\\usepackage[pdftex]{graphicx}
-\\begin{document}
+"+packages+
+#"\\begin{document}
 \\author{wmml2pdflatex}
 \\setlength{\\unitlength}{1mm}