TrueLatex-Talk

Summary: Talk page for TrueLatex.
Maintainer: Subhrajit
Users: (View? / Edit?)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments and Discussions

2010-01-29 - Trevor - Hey, I'm a really big fan of this recipe, and am using it extensively for my class notes. I just wanted to make note of an issue I had today. Basically, I was writing a big long eqnarray and while there were no LaTeX parse errors, the output still was not being produced. This turned out to be because the resulting PDF was long enough to take up two pages, so convert was failing. The simple workaround was to split the eqnarray into two separate eqnarrays, and it worked just fine. Just a note in case someone runs into the same error.

2010-02-05 - Subhrajit - Thanks Trevor for pointing this out. The solution you proposed definitely works. The other alternative is to edit the value of paperheight (which is set to 5in by default) in the default.tmpl file. The default.tmpl file is essentially the .tex template file that the recipe uses for rendering the LaTeX code. Making the page too large may slow down the rendering though. In the future versions I will add this (and others) as optional parameters that can be passes on from the markup itself.
2010-02-17 - Subhrajit - The feature is added in version 1.5. One can now set higher values for paperwidth and paperheight parameters from within the (:latex:) markup: (:latex ... paperwidth=15 paperheight=8:) ... (:latexend:). (The default values of these two parameters are 10 and 5 respectively - units in inches)

2010-02-11 - Matt - Hi, I'm also a fan of this recipe. I just switched my server to Fedora Core 12 with TeXLive 2009 today, and I'm having trouble rendering LaTeX. No matter what I try, I always get "ERROR in parsing LaTeX". I made a .tex file with the default template and used pdflatex on it, and it generated a pdf. Do you think this is an issue with FC12, or TeXLive, or something else? By the way, I switched from gentoo linux, so I don't know much about fedora.

2010-02-12 - Subhrajit - hi Matt. Can you check if you have created the folder /pub/latexcache and given it the proper permissions (server can read/write to it, the world can read it - chmod 755)? If this doesn't solve the problem, can you please post the complete error message you are getting (including the ones from PHP at the top of the wiki page). I know the error messages are presently not very informative. Will make them so in the next version.
Also will be great if you can tell me what the folder /pub/latexcache contains after you have got the error.
2010-02-14 - Matt - Hello again. I moved my wiki over from a server running gentoo linux, and your plugin was working fine there. So my latexcache folder exists with the correct permissions and contains some cached stuff from the old server, which loads up fine into my wiki. There is also a geometry.sty file in there. I'm sorry, I don't know much about PHP, but I don't see any errors at the top of the wiki pages when this happens, just one from truelatex that says: TrueLatex: Parsing LaTeX: ERROR in parsing LaTeX! Extracting image: Aborted! where the rendered image should be. I'm using TeXLive 2009 and ImageMagick 6.5.4. If there are any other details I can give you, let me know. Thank you for spending time on my problem :)
2010-02-15 - Subhrajit - hi Matt. Thanks to you for helping with the debugging and development. The problems you report help in development of the program and in turn will help others.
First of all, I have just released a new version of the plugin. It has a few extra diagnostic features and displays the system errors. I will suggest you try it and see if it displays some more errors, which, if you can let me know, will help me better in finding the cause.
As of now, since you said 'pdflatex' works for you from terminal and the 'latexcache' has proper permissions, I have a few guesses on what the problem might be, but not absolutely sure. It is probably something related to your OS, Apache or PHP settings. Here are a few possibilities that you can try:
1. You might have Fedora's SELinux turned on, and "httpd_ssi_exec" turned off. This prevents PHP to execute the pdflatex utility. For checking if this really is the case, just type "/usr/sbin/getsebool -a | grep httpd" at the commandline in a terminal and check the value of "httpd_ssi_exec" that it prints. Unless you think turning it on will cause a security threat to your system, you can permanently turn it on by executing "setsebool -P httpd_ssi_exec 1;" at the terminal. (More details at http://php.net/manual/en/ref.exec.php).
2. The 'exec' function of PHP might be turned off or PHP might be running in SafeMode. To check this, open the php.ini file and check if there is a line "disable_functions=...", and if 'exec' is in that list. If yes, just remove 'exec' from that list. Also check if there is a line "safe_mode = On". If that's the case, change it to "safe_mode = Off".
If the above don't solve the problem, install the latest version to get a better insight into the errors as they get displayed.
2010-02-16 - Matt - The extra debugging information the latest version provides is fantastic. It ended up being a few problems. First, while I thought I had the correct permissions on the cache folder, well, I didn't. Then I had to enable the httpd_ssi_exec boolean in SELinux. And finally exec in PHP seems to use a different PATH environment variable than what is set by bash, so the texlive binary directory wasn't being seen. Anyway, it works now. Thank you for all your help!
2010-02-17 - Subhrajit - Glad that it worked Matt. The issue with the PATH should be fixed now (v 1.5.1).

2010-03-09 - Matt - I modified your script to turn on Verbose when it encounters an error. When editing pages, this makes noticing/fixing syntax errors easier and faster. On the other hand, I doubt you would want it to go verbose when someone is trying to read a page that has some issues. It's nice for editing though. Thanks again for your work on this!

2010-04-01 - Subhrajit - Thanks Matt for the idea. I have included this in v1.7. The $TrueLatex->AutoVerbose = true variable will now do the trick (it's set so by default)

2010-04-29 - Matt - I think it would be helpful to define a shorthand markup for TrueLatex. I don't know how most people are using this, but I usually have lots of small LaTeX snippets all over my documents. So typing the full syntax out every time is a little tiring. On my machine, I added the markup ~text~ as a shorthand for truelatex with no options, since with verbose enabling upon an error I very rarely need to specify options. I don't know anything about pmwiki or its conventions, so ~ might be a bad choice, it was just the first thing I found that worked. Anyway, thanks again, I use your work here all the time. How easy/hard would it be to modify TrueLatex to work with XeLaTeX as well as LaTeX? I use XeLaTeX to typeset Japanese, and as far as I know it's not something I can do (easily) in LaTeX, but I might be wrong about that.

2010-07-21 - Subhrajit - hi Matt. Sorry for getting back late on this. Your idea of a shorthand is perfect. '~' should have been fine, just that it may conflict with the '~'s in normal text of the wiki. So I just released v1.8, and in it I have included the shorthand ($ latex code goes here without dollar sign $). So now you can do something like ($ 2^3 = 8 $). Also, I have included support for XeLaTex. Just set $TrueLatex->RenderMethod="xelatex:convert" or $TrueLatex->RenderMethod="xelatex-xdvipdfmx:convert" in config.php. I will include support for xetex in future versions.

2010-05-06 - Martijn - Hi, just wanted to throw in my 2c about making this recipe work on Windows. Although I doubt many would run a wiki under windows, my home dev machine is (for now) and only a few changes were necessary to make it run well. By default MiKTeX operates in errorstopmode, which causes execution to hang and stall PHP. Similarly, if it encounters an unfamiliar package, by default it opens a GUI and stalls, which is also undesirable. I therefore use pdflatex --interaction=nonstopmode --disable-installer to get the desired behaviour. Secondly, under Windows the command separator within the shell_exec statements needs to be changed from ; to &&, which is also valid in (most?) Linux shells and prevents execution of following commands if the earlier one fails; which would fail anyway in this case. There were some other minor adjustments I made for personal preference, so perhaps config variables for latex/convert arguments might be useful? Great code by the way, and I hope my suggestions are helpful.

2010-07-24 - Subhrajit - hi Martijn. Thanks for sharing the points. I agree I haven't tested it on any Windows based server. I am sure your suggestions will be helpful for adapting the recipe for Windows servers.
(Just adding a clarification for people who were evaluating this recipe to decide whether or not to use it: This does not effect whether the visitor to a site is using a Mac, Windows or Linux machine. This discussion was completely about Linux vs Windows server, i.e. the machine on which the web-site is running. FYI, most good servers are Linux based.)

2019-01-06 - TDS - I finally migrated my pmwiki to a 7.1 php server but had some hiccups (mainly because I lost a common stylesheet in the migration). I had to tweak the truelatex.php file to provide clearer errors (page rendering would hang if there was a latex error) and then converting the pdf to png would fail if the rendered latex pdf was multi-page. This patch fixed both those issues for me:

  -322,7 +326,7  function TrueLatex_parseTeX($dirname, $filename)
         case "pdflatex":
             $TrueLatex->OutMsg = array_merge($TrueLatex->OutMsg, explode("\n", shell_exec(
                     "cd ".$dirname ." 2>&1 ; ".
  -                    "pdflatex ".$filename." 2>&1"
  +                    "pdflatex -interaction nonstopmode -halt-on-error -file-line-error ".$filename." 2>&1"
                     )));
             return $filename.'.pdf';
  -363,8 +377,10  function TrueLatex_extractPNG($dirname, $name_in, $name_out)
             // trim
             $TrueLatex->OutMsg = array_merge($TrueLatex->OutMsg, explode("\n", shell_exec(
                     "cd ".$dirname ." 2>&1; ".
  -                    "convert ".$name_in." -trim ".$name_out." 2>&1"
  +                    "convert ".$name_in." -append -trim ".$name_out." 2>&1"
                     )));
            if ($TrueLatex->UsePDFColors)
                break;
             // make transparent background

Go back to TrueLatex main page.

Talk page for the TrueLatex recipe (users?).