Using TeX translators

Using TeX translators

by Curtis James -
Number of replies: 16
Hi,
I have been trying to get the tex translators working on my site.  I have Math Type, so I have been using it to translate to TeX.
Here what I tried:
TeX input image
Here what I get:
TeX output
Something appears to be working, but I don't know what the "garbage" is before it.
Also, I notice that the bottom of the fraction is cut off, and I have tried inserting a return underneath it, but it doesn't seem to help.  Anyway to see the entire image?

I have tried this with the integral symbol and get the same result.

Thanks for any help, pointers to a discussion involving this (I tried searching the forum), or anything else someone can think of.  The site is hosted at SiteGround--I know very little of what the hosting involves.  

Also, if anyone has suggestions on exactly what Math Type filter to use (I have Math Type 5.1 and have tried most of them and the garbage still appears).

Link to TeX inputPict of what I typedCurtis
Average of ratings: -
In reply to Curtis James

Re: Using TeX translators

by Curtis James -
Ok, apparently my picture links didn't go as planned:
What I typed link

The output I received

Sorry about that.
Curtis
In reply to Curtis James

Re: Using TeX translators

by John Isner -
Hi Curtis,
I'm having the same problem on one of my sites and I'd be interested in hearing from anyone who knows how to fix it.
In reply to Curtis James

Re: Using TeX translators

by John Forkosh -
You're apparently using the real LaTeX solution (provided by Howard Miller? -- I don't see an author credit in latex.php), which is indeed the best way to go. I mention that fact on my mimetex page, illustrating mimetex and latex images side-by-side at http://www.forkosh.com/mimetex.html?alternatives

Take a look -- you'll notice that my $$$-\infty$$$ lower limit is vignetted exactly like your $$${3\over{2^4}}$$$ I tried to fix that problem but couldn't figure it out. Here's what I do know.

The latex solution proceeds in three steps. First latex creates a dvi output file from your input, i.e., latex:input-->dvi. Then ghostscript:dvi-->ps creates a postscript file from the dvi. Finally, ImageMagick's convert:ps-->png (or ps-->gif) creates a png (or gif) image from the postscript.

The postscript output looks fine (not vignetted) when viewed with ghostview. So it's convert that's apparently introducing the problem. Convert has _lots_ of command line options, and I tried playing with lots of them to no avail (using both png and gif output). I also couldn't google up a discussion of the problem. Please follow up here if you find out more.
In reply to John Forkosh

Re: Using TeX translators

by Davide Cervone -
Whoever maintains the LaTeX filter might consider using dvipng rather than the ghostscript/ImageMagick combination. It will work MUCH faster, and it should not have the clipping problem that you are seeing.

Just a thought.

Davide
In reply to Davide Cervone

Re: Using TeX translators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I guess it is me smile

I'm not familiar with dvipng to be honest. I guess it's incompatible with ghostscript/ImageMagick. The solution implemented was chosen because it is really common and, in any case, the images are cached once created so in most cases will only be rendered once.
In reply to John Forkosh

Re: Using TeX translators

by John Isner -
But what about the "garbage"?
Attachment what_about_the_rest_of_the_problem.JPG
In reply to John Isner

Re: Using TeX translators

by Davide Cervone -
These looks like LaTeX commands that are not being processed but instead are being typeset by LaTeX. I haven't looked at the tex filter, but it probably has a preamble file that it passes to LaTeX and this might be corrupt in some way. Perhaps the backslashes have been lost along the way (there should be backslashes in front of "usepackage", for example. That's where I'd look first.

Davide
In reply to Davide Cervone

Re: Using TeX translators

by Curtis James -
Thank you, Davide.  I feel a little sheepish--when I hit the "restore defaults" buttons, those slashes reappeared and TeX works just fine (no more garbage).  I appears that the TeX-AMS LaTeX translator with Math Type appears to work best.  I will be playing with mimeTeX and jsmath in the upcoming weeks.

Thanks to everyone for their comments and suggests!
Curtis
In reply to Curtis James

Re: Using TeX translators

by Susan Addington -
I got the same preamble garbage when I typed in raw TeX (I didn't use MathType):

$$$7 {\buildrel \times 2 \over \longrightarrow} 14$$$

$$7 {\buildrel \times 2 \over \longrightarrow} 14$$

It didn't happen with $$$\frac{3}{4}$$$.

$$\frac{3}{4}$$

(Hmmmm... the buildrel part looks different here than it did on my system: DIFFERENT garbage, but garbage nonetheless.

Here is a _picture_ of my output:
In reply to Susan Addington

Re: Using TeX translators

by Davide Cervone -
This forum is using the mimeTeX-based tex filter, and that apparently doesn't implement \buildrel (but does implement \over). The [\buildrel?] is indicating that mimeTeX doesn't understand that command, and the horizontal rule is part of the interpretation of \over (used in plain TeX to create fractions).

Your site is not using the mimeTeX-based tex filter but rather the filter that calls an actual copy of TeX. The text that you see as part of the image is what is supposed to be the preamble to LaTeX, but apparently the backslashes have been lost (for example, it should be \usepackage[latin1] not just usepackage[latin1]. There is probably a configuration page for this filter that contains this text, and Moodle has removed the backslashes (as it is prone to do). See the two messages just before yours for more information on this problem.

Davide
In reply to Davide Cervone

Re: Using TeX translators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
One or two people have reported the problem with the backslashes in the preamble getting corrupted but I've never managed to recreate it. If someone can find some steps to do so I'll see if I can fix it. Please report in the tracker though.

Note also that there is a handly debugging screen available for the TeX filter at http://your.moodle/filter/tex/texdebug.php. However it only works with the full TeX implementation as of 1.8.3!
In reply to Curtis James

Re: Using TeX translators

by Antony OSullivan -

I know this has been answered above...  but it does not come up on the forum search straight away... as the original pre-amble was not quoted in a non-graphical way in the replies above... So I will repeat the solution here for the forum searchers.

To get rid of the 'rubbish' appearing before any Tex formulas... "usepackage[latin1]{inputenc} usepackage{amsmath} usepackage{amsfonts} RequirePackage{amsmath,amssymb,latexsym}".

Basically I went to:

Site Administration -> Modules -> Filters -> Tex Notation -> Settings

I tried to correct the Preamble back to this string: (With the space character on the front of each line).

 \usepackage[latin1]{inputenc}
 \usepackage{amsmath}
 \usepackage{amsfonts}
 \RequirePackage{amsmath,amssymb,latexsym}

But it still messed up...

In the end I spotted the "Reset to defaults" button at the bottom of the settings screen... pressing that... fixed it all!

In reply to Antony OSullivan

Re: Using TeX translators

by Harald H -
hi,
i got the same problem but i can't find the "reset to defaults" button in Moodle 1.6
tia
Harald
In reply to Harald H

Re: Using TeX translators

by James Dunlap -
Hi,

I was just using my own server to play with the TeX capabilities and ran into this same problem. Pressing the "reset to defaults" button did not work for me. However, if you edit the preamble in the html editor and place two backslashes before each line, then it worked for me. You may have to refresh your browser pages.

Thanks and hope that this helps anyone looking in the future.

In reply to James Dunlap

Re: Using TeX translators

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
One thing to check...

The packages mentioned in the preamble actually have to be installed in your LaTeX system. I got tripped up with this on Ubuntu where everything is optional. The debugger script for the TeX filter (1.8.3 on) show this up quite readily.