News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

LATEX Parsing

Started by treo, June 18, 2004, 04:25:16 PM

Previous topic - Next topic

Anguz

Maybe with a PHP info file?

<?php echo phpinfo(); ?>
Cristián Lávaque http://cristianlavaque.com

ccheaton

Hmm... I don't see any of that stuff listed when I look at the phpinfo file.  I emailed the admins at the hosting company.

stevem

Yes, the hosting company will be able to tell you. You could also upload the example page from LatexRender and see what happens. That will tell you which bits are working and hence what is installed.

You may have to persuade your host to install the programs. If they don't agree to do so then you could use mimetex instead.

ccheaton

Hmm.  Well, I can't figure this out.  The hosting company installed tetex for me, and said that everything else was installed (assuming that by 'gs' earlier, 'gd' was what the original poster meant to write).

I get a bunch of errors like this:
Quote
Warning: unlink(/home/myname/public_html/mydomain/Sources/latex/tmp/1f5b103e2cd542e8ca36ee50040c8e6c.aux): No such file or directory in /home/myname/public_html/mydomain/Sources/latex/class.latexrender.php on line 289

stevem

gs means Ghostscript which is only required if you use GIF format rather than PNG for the images.

To see what's going on, comment out the 6 lines at the end of class.latexrender.php that start with unlink (do this by putting // at the start of each line). Then run the system and have a look in the tmp directory at the files in there. If Latex has been installed there will be a .log file and reading it will tell you what has happened. Also check what other files have been created: there should be files with extensions of log,aux,dvi,ps and gif or png.

ccheaton

Well, there's error_log, index.php, and 8cac9ddb0af82890eb7225ca9e5a7bf6.tex.

However, the owner of the hosting company said that he installed tetex the other day.  Maybe my paths here are wrong?
Quote
    var $_latex_path = "/usr/bin/tetex";
    var $_dvips_path = "/usr/bin/dvips";
    var $_convert_path = "/usr/bin/convert";
    var $_identify_path="/usr/bin/identify";

stevem

Since there's no 8cac9ddb0af82890eb7225ca9e5a7bf6.log file Latex hasn't been run. The paths you are using are the standard ones for Linux but
var $_latex_path = "/usr/bin/tetex";
should read
var $_latex_path = "/usr/bin/latex";
That's because latex is the name of the program to be run whereas tetex is the name of the whole distribution.
If this still doesn't generate a longfilename.log file ask your host whether the paths are correct or whether latex etc has been put elsewhere.

Quotethe owner of the hosting company said that he installed teTeX the other day
Lots of people are looking for a good company that supports LaTeX. Assuming you get it all working, is it the sort of company that sells to the general public and would you recommend their service to others? Ignore this or PM me if you'd rather not answer publically ;)

ccheaton

Hey Steve... I'm working on getting it running.  The folks at the hosting company have been unresponsive for the past day or two.  I'll let you know if I get it working.  I had /usr/bin/latex, but just switched it to tetex to see if it would run.  No dice, so far.

stevem

At http://www.linux.com/howtos/TeTeX-HOWTO-9.shtml [nofollow] and lots of other places they use /usr/lib/teTeX/bin for the paths so you would use
var $_latex_path = "/usr/lib/teTeX/bin/latex";
var $_dvips_path = "/usr/lib/teTeX/bin/dvips";
var $_convert_path = "/usr/lib/teTeX/bin/convert";
var $_identify_path= "/usr/lib/teTeX/bin/identify";

Worth a try while you wait for a reply.

ccheaton

Ok, after some discussion with them, I'm now getting the files that you mentioned previously, but still getting an error.  Now the error is:

Quote
Warning: copy(9ede2d4d1a980ca952f8cc680009883f.png): failed to open stream: No such file or directory in /home/myname/public_html/mydomain/Sources/latex/class.latexrender.php on line 271

attached is the log file.  Let me know if you need to see another file.  Looks like latex is running now, but the images aren't generated?

BTW, the log might be from a different attempt than the text that I pasted.

stevem

Yes the log confirms that LaTeX is working correctly and given the lack of other error messages everything is being created except the final image. That is done by ImageMagick's convert command. That's partly my fault, since the paths I wrote above are for tetex rather than Imagemagick  :'(
Change
var $_convert_path = "/usr/lib/teTeX/bin/convert";
var $_identify_path= "/usr/lib/teTeX/bin/identify";

to give the correct paths for Imagemagick's convert and identify programs. Usually it is
var $_convert_path = "/usr/bin/convert";
var $_identify_path="/usr/bin/identify";

but it may be elsewhere on your server.

ccheaton

Ok.  I asked the people, and they said that those files are in place and that the paths are correct, so that must mean that something else is incorrect.  What do I need to send you in order for you to see what's going on?

stevem

Concentrate on getting the example program, working because that won't be complicated by having another PHP program to interact with. Even better, the demo program includes extra error messages which may help.

Comment out the 6 unlink lines in class.latexrender.php, if you haven't done so already and run the program. Check which files are created in \tmp. Then repeat with changing the file format to gif. Have a look at the contents of any error.log created in \tmp

Then try using
\begin{picture}
as the LaTeX code. What error message do you get? It should say the image is 1020 x 1320

ccheaton

When I have nothing but \begin{picture}, I get the following error. 
Quote
Warning: copy(af0601cdb2921d2b6bf5c5ea5dd48b78.gif): failed to open stream: No such file or directory in /home3/ccheaton/public_html/mydomain/Sources/latex/class.latexrender.php on line 271
Maybe I have a path set wrong? 

It just never seems to write the images to the pictures directory.  Should this line in class.latexrender.php look like this?
Quote
    var $_picture_path_httpd = "http://mydomain.com/Sources/latex/pictures";


stevem

You don't set paths (except for latex, dvips, convert,identify) in class.latexrender.php. The lines
    var $_picture_path = "";
    var $_picture_path_httpd = "";
    var $_tmp_dir = "";

are just there to initialise the variables which are set when the class is called. You only need to put the paths in phpbb_hook_2.php or latex.php (depending what PHP program you are using).

Use
    $latexrender_path = "/home3/ccheaton/public_html/mydomain/Sources/latex";
    $latexrender_path_http = "/mydomain.com/Sources/latex";

or similar

If the picture is not there this could be for a number of reasons:
1. The picture is not being created. After commenting out the unlink lines check that the gif or png is in /tmp
2. The picture is not being copied because either the path is wrong or you haven't chmodded pictures to 777

ccheaton

Argh.  Well, everything is chmod 777.  My class.latexrender.php contains:
Quote
    // ====================================================================================
    // Variable Definitions
    // ====================================================================================
    var $_picture_path = "";
    var $_picture_path_httpd = "";
    var $_tmp_dir = "";
    // i was too lazy to write mutator functions for every single program used
    // just access it outside the class or change it here if nescessary
    var $_latex_path = "/usr/bin/latex";
    var $_dvips_path = "/usr/bin/dvips";
    var $_convert_path = "/usr/bin/convert";
    var $_identify_path="/usr/bin/identify";
And my latex.php contains
Quote
    // adjust this to match your system configuration
    $latexrender_path = "/home3/ccheaton/public_html/mydomain/Sources/latex";
    $latexrender_path_http = "/mydomain.com/Sources/latex";

Could the problem be that the folder that contains 'mydomain' has a namestructure 'mydomain.com'?

The fact that the debug files are written to the tmp directory leads me to believe that I don't have an error in the path.  Maybe something just isn't set up properly with the host.   :-\

stevem

According to
$latexrender_path = "/home3/ccheaton/public_html/mydomain/Sources/latex";
you have a folder called mydomain. This is accessed in a browser by going to http://your_domain_name/mydomain. This means that you should have
$latexrender_path_http = "/mydomain/Sources/latex";
I'm not sure where .com comes from.

To make this clear - suppose you have a domain name of www.thisisme.com [nofollow] and you have put the latex stuff in a folder called latex_stuff. Then this is seen by the server as
/home3/ccheaton/public_html/latex_stuff
and by a browser as
http://www.thisisme.com/latex_stuff [nofollow]
You'll notice that thisisme.com [nofollow] doesn't appear in the server's file structure, but is needed by the browser to find the server itself.

So I am a little confused by where you have stored the files. The path in $latexrender_path_http  should be the ones after public_html in the server folder structure.

Do feel free to email me if you wish to discuss folders etc which you don't wish to make public.

ccheaton

I'm running several domains from the same structure, for what it's worth.  /home3/ccheaton/public_html is one domain, which has its own URL -- http://www.mydomain1.com  the subfolder /mydomain/ is another domain, http://www.mydomain2.com

So, the domain that I'm using lives in a subfolder of another domain, but has its own URL.  Get it?   :)  In this case, I'm actually going for mydomain2.com, which is in the directory /home3/ccheaton/public_html/mydomain/


stevem

#38
From what you've said the HTML code for the image should be generated as img src="/Sources/latex/pictures/longfilename.gif". The browser will then realise that this is a relative link to http://mydomain2.com/Sources/latex/pictures/longfilename.gif [nofollow]

The code knows about /pictures so all it needs is the first part which is given by
$latexrender_path_http = "/Sources/latex";

If you browse to http://mydomain2.com/Sources/latex/pictures [nofollow] (note: I have corrected this URL) and get anything then this is correct.

$latexrender_path = "/home3/ccheaton/public_html/mydomain/Sources/latex";
should be correct.

Don't forget to check if the png/gif is being created in /tmp


ccheaton

Well, that's the problem.  The .png/.gif is not being generated.  Or, it's being generated but not written to the tmp directory?

Advertisement: