If $f(x) = 3x + 7$ and $g(x) = x + 4$ then \[ f(x) + g(x) = 4x + 11 \] and \[ f(x)g(x) = 3x^2 + 19x +28. \]
I get the result in the image below. I need the good result, but I also need the example to show in ordinary text in the Google page. So how can I comment out things or prevent the LATeX plug-in from converting it? <pre> and <code> do not work...
If you are asking about latex escape function that is available. There are lots of functions in latex though that are not implemented in moodle's filter
I would consider going with asciimath and setting fallback to googlechartapi - and it is possible that eventually an asciimath derivative may be integrated in google as I hope it will be in moodle. Among other features asciimath does make text inside tokens very simple.
Colin,
can you add the lines or things you want to do to an attachment (some tex file or doc) - Tex filter is just sending the tags between delimiters (usually double dollars) to renderer (Mimetex or some local distribution of Latex) and you should have only latex or pure text inside delimiters.
If you have in editor for example html inside delimiters renderer tries to render it as text - not html. Latex does not understand html formatting.
And different distributions of (La)TeX use also different commands and symbols...
And if you want to show only syntax you can use backslash before dollar to render plain dollar $ as $$ \$ $$ (I have here spaces around \$ in ' \$ ' )
So rather than use MikTex, then generate PDFs and importing screen grabs to Moodle, which is time consuming, I thought I would just use Moodle. Activated the Latex filter and it works well, only a little too well. Testing it out I have run into this problem of it rendering the code used, then what should be html examples. Painful...
Hi Mauno, all I am using is the Moodle Latex Filter which is pointing at miktex latex and dvips exe files and ImageMagick. I kind of figured that it wasn't going to be so straightforward - and the fact it that it seems to render some elements I want as HTML in Latex and others it leaves alone - just really intriguing.
And of course, the intro in MikTex is that MikTex does not vary too much from Latex, so go to this latex site and do that tute. I did, and now want to move on with it.
Oh, I started out with the idea that I would use MediaWiki, to justify a school offering a Moodle/MediaWiki resource to sudents. As I am more familiar with Moodle, that seemed the better option.
My local Vista is using MikTex ( and my plugindemo site is using TexLive ) so I think I can test any problems you have with MikTex but I just did not figure out the actual problem meaning what do you expect to happen with some tags - or latex images - or syntax ...
If you check file filter/tex/filter.php and functions string_file_picture_tex and tex_filter you notice that double dollars are not the only possible delimiters - in Wiki square parenthesis can cause some odd results etc.
More examples please - and for example a MS Word attachment where it might be possible for us to see what you hope to see...framed with red color
looks like there are a few issues involved and that the discussion on latex and asciimath in moodle docs ( mediawiki ) would help you along.
On the simplistic side, the statement below was done with the \text{} function:
$$\text{why is }\frac{x}{0}\text{ undefined?}$$
what drove me to asciimath was in fact the need to have a totally portable way to display math, where a typical latex installation was not available. Using the latexmathml that is included and the appropriate fallback you can produce results that display well without having to have latex.
With google, in addition to chartapi, invocation may available through the new script functionality (I don't have access to that so can't say for certain) and could possibly be implemented via etherpad code now that google has purchased and release it.
If you go to a site like artofproblemsolving you will find excellent tutorials but will end up banging your head against the wall because of limitations of moodle implementations, but there are free standing open public latex hosts and using them you could do "real" Tex and then embed same in other resources, as long as web access available. Here again asciimath makes a good deal of Tex available even where no web access by including js in dpc.
$$$\frac{x}{y}$$$ produces $$\frac{x}{y}$$
Here the first instance of \frac{x}{y} was enclosed by triple dollar signs and the second instance by double dollar signs.
I understand Marc about the asciimath, but my accomplice in crime wants to use MikTex. His argument is that more academic content and documentation needs to go onto the school server, Moodle is one way of doing this, and MikTex works in the Windows environment. So he is trapped by Windows too. And, as he is paying the bills, I am inclined to just give him what he wants, besides, I know less about ascimath than I do now about MikTex.
And Zbigniew, no sorry, looked good but didn't work - thanks for the suggestion, have filed it for use in MikTex.
Ah - this Word document explains a lot.
When you take examples from tex files they usually have more commands for complete latex documents but tex filter is very simplyfied version of rendering Latex using some packages defined in settings of tex filter (administration menu).
If you want to use tex filter change single dollars to double dollars or use those square bracket delimiters (they don't work in wiki anyway).
But some tags like those equation tags don't look correctly aligned - not with MikTex or Tex Live - if they are used with Tex filter (first equation is left aligned and second goes to the right...). Still you could use other latex to produce same kind of content -
http://docs.moodle.org/en/Development:MediaWiki_TeX_test
has some examples that should work almost the same way in MikTex, Tex Live and TeTex - Mimetex is using many custom tags that other distributions can't use and on the other hand mimetex can't use all the packages, symbols and commands that other distributions can use. A little test:
HTML (italics):
If f(x) = 3x + 7 and g(x) = x + 4 then f(x) + g(x) = 4x + 11 and f(x)g(x) = 3x2 + 19x + 28.
Your one line example with double dollars and begin equation...end equation tags (note the first equation):
If $$ f(x)=3x+7 $$ and $$ g(x) = x+4 $$ then $$ f(x) + g(x) = 4x + 11 $$ and $$ f(x)g(x) = 3x^2 + 19x + 28 $$.
If $$ f(x)=3x+7 $$ and $$ g(x) = x+4 $$ then
\[ \begin{equation} f(x) + g(x) = 4x + 11 \end{equation} $$$
and $$$
\begin{equation} f(x)g(x) = 3x^2 + 19x + 28 \end{equation} \]
Centered example with begin array and end array:
$$ \begin{array}{lrr} & f(x) + g(x) = 4x + 11 & (1) \\ and & & \\ & f(x)g(x) = 3x^2 + 19x + 28 & (2) \end{array} $$
And like you can see here font size is not very similar in theme as font of Latex tags with 120dpi density so you might try to use smaller density in settings of tex filter or bigger fonts (Times new roman etc) on pages where you use maths and change tex filter to render pngs instead of gifs (other posts on maths forum)
Writing maths has always been a pain in moodle but it is slow and painful even with Word equation editor ...
I know the people who are going to be reading it, and using MikTex, believe me, they will need me right in their face from time to time. Teachers.. all of them.
Anyway, you tips about proper alignment and such are good, and it is possible that in the end, I am going to have to use an image, in a table format, one side with the inserted tex and the other with the end result, and each line commented. Using pngs instead of gifs never thought about, but will try it now..
Thanks Muano, appreciate the time you have given me. Cheers.
And note that you can't automatically use all packages of latex but you can add them to your tex filter settings. For example if you want to use colors you need to use LaTeX preamble like
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[usenames]{color}
\RequirePackage{amsmath,amssymb,latexsym}
to be able to render tags like
\displaystyle x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}
or
\displaystyle \colorbox{red}{testing dollars}\sum_{i=1}^{p}\sum_{j=1}^{q}\sum_{k=1}^{r}\textcolor{blue}{a_{ij}} \frac{\textcolor{green}{b_{jk}}c_{kl}}{\colorbox{Orange}{ text}}
(double dollars or square bracket tags around them)
MikTex like Tex Live has a lot of such packages that people never use...