Hi AL,
Thanks for your answer. I corrected my preamble (I had \usepackage{tikz}, but not \RequirePackage{...,tikzpicture,...}), but it made no difference.
Moodle is still processing tex code when it is given between $ $.
I don't know much about php, but I checked the .php files on mymoodle/filter/tex, and found that in latex.php the tex document is built (function construct_latex_document, near line 50). May be some edition need to be done in this function in order to make Moodle recognize tex code...
Any ideas?
Thanks in advance,
Pepe.