# WikiSuggestions/TeX

UseModWiki | WikiSuggestions | RecentChanges | Preferences

# TeX

This suggestion comes after writing several pages on the wikipedia that used a bunch o' math. Typing this stuff in HTML is fairly brutal and UseMod doesn't allow recursive tables so using the the output of TtH? fails to produce the desired effect.

It occurs to me that the simplest solution would be to modify UseMod to allow text between markup boundaries to be filtered through TtH? and inserted. This would allow authors of highly mathematical material to write in TeX as they are probably used to doing (or even to use something like TeXaide? to write equations graphically) but not require readers to do anything special. Furthermore, editors of the page would not be required to wade through gallons of unreadable HTML.

There is an example of this approach at http://www.mathcircle.org/cgi-bin/mathwiki.pl , based on the original Ward Cunningham's Wiki

Adding a strategy to get inline LaTeX? in UseModWiki ( LatexPatch ). / Jens

Excellent, thanks Jens!

I'll still put my stuff up when I have time to clean it up in case it's useful to anyone (some of the other approaches can render a little faster).

I haven't had time to do any more than I did since I last posted here. Still to be done is: clean up my code; look at Jens' stuff and take any good ideas or styles; add error-handling if you enter bad latex. -- BayleShanks

• Don't hesitate to give me a copy of the modified code if you think you have done something better =) I have done some changes to the patch if you haven't checked it out lately -- Jens

Another example is [LaTeXWiki], based on ZWiki. But it would be really nice to see this type of stuff in UseModWiki (esp since that is what I have now installed!). -- MikeHudson?

I'm in the midst of making such a patch. I think I'll allow three options:

• <latex-file>: Just make a postscript file and save it somewhere, then, on the wiki page, provide a link to the postscript file.
• <latex-tth>: Use tth as described above.
• <latex-latex2html>: Use latex2html in place of tth, as described above.

<latex-file> works on my system now but the code is still too hack-y (i.e. used constant that need to be globalized). And there is no error-reporting yet.

<latex-tth> almost works but there is some problem that I haven't debugged yet ("amp;" appears everywhere; this seems to be prior to UseMod's getting the results, but only happens when tth is called from UseMod (oh wait, upon getting some sleep; html is quoted before CommonMarkup, "duh")). tth tries to render latex into html, so it looks kind of ugly at its best.

Haven't started <latex-latex2html> yet.

So far I am implementing these as subroutines called from CommonMarkup, ie. on the same level as StoreRaw and its brothers.

One question; for latex-file and latex-latex2html, I want to save some files somewhere in wikidb. My current approach is to make a "latex" folder in DataDir. But, how do I keep the files for different pages distinct? Ideally, I would want to save things named something like PageName?.ps. But I'm not sure that CommonMarkup would know the name of the current page (I don't know what is global is UseMod yet, but CommonMarkup is not passed the page's name). My current hack is to hash the latex to generate a probably-unique number, but then there's a problem in case of collisions. So should I give the page name to CommonMarkup? Seems like a bigger change than I would like. Does CommonMarkup already know the page name? Recommendations?

By the way, I looked at the ZWiki latex patch (see also LatexWiki), and I found it insufficient for what I want to do (post in past homeworks from a class, which are long). The LatexWiki stuff is built to work with short bits of latex, like one begin/end environment or one \$2^4 + 3\$ type thing, but after hacking on it for a few hours it doesn't want to render a whole long latex document at once (I was doing weird things instead of actually rewriting it alot though, mainly because I didn't have time to learn learn Python, so I bet there's an easier way to fix it than what I was doing). The ZWiki patch uses pdflatex, mogrify, and gs.

I don't know if I will have much more time to work on this, as soon the latex-file will be clean enough for me to deal with, and that's all I need for the time being.

Cool work ! -- DavidAndel

Thanks, David.

A generalization of my above question; so I need some way to associate files with bits of text inside a latex environment (to generate and maybe cache the document and pictures generated when rendering latex). Even knowing the pagename would not be sufficient; what if there were two distinct latex environs on the same page with the same hash value? Is there a system set up to solve this problem within UseMod already? Thanks,

status: I've got a hack working for each of tth, hevea, latex2html, htlatex, and actually making normal postscript files. problems: no error checking, no decision on the above questions of what to name the files, and not cleaned up. don't have time to work on this further for at least a week (maybe more).

Does this patch just create the html from the TeX? Or do you include an option to just render it to a PNG or something that can be included as an inline graphic, sort of a cache. Would this speed up rendering, or be useful? TeX->ps->png via ghostscript -- EvanLanglois

reminder to self: defeat the \include security hole (see PhpWiki:TexToPng)

One question: would it be convenient to adapt de code of the math tag from wikipedia? it's really useful... -- EML

UseModWiki | WikiSuggestions | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited January 12, 2008 11:35 am by JuanmaMP (diff)
Search: