Hi I'm relatively new to drutex and drupal, but I'm getting the following errors.
This shows up on my main page, after installing drutex

warning: Parameter 1 to drutex_pdf_nodeapi() expected to be a reference, value given in /Users/jburk/Sites/modules/drutex/drutex.module on line 830.

The error I get under the config menu is:
The temporary directory is writable.
The image directory (files/tex) isn't writable.
Executing "latex" failed. Either LaTeX isn't installed or the "latex" executable is not in one of the search paths.
You cannot render high-quality images without LaTeX.
Mimetex maybe an alternative for you. Consult the documentation on how to use Mimetex.
Executing "dvipng" failed. Either dvipng isn't installed or the "dvipng" executable is not in one of the search paths.
You cannot use dvipng for rendering images (check the conversion method above).
Executing "convert" (ImageMagick) failed. Either ImageMagick isn't installed or the "convert" executable is not in one of the search paths.
You cannot use ImageMagick for rendering images (check the conversion method above).

I've tried making the /files/tex directory writable to www, but that doesn't seem to help. I've also read about how to make a file accessible to apache by modifying http.conf, but that didn't help either.

If it helps, I'm running MAC OS 10.6, Drupal 6.15, and tex-live 2009—I have no problems using LaTex via texshop and the command line.

Thanks for any suggestions for how to fix this.

-John

CommentFileSizeAuthor
#6 drutex-730940.patch568 bytespuregin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

monty_hall’s picture

I'm getting the exact same problem.

pmagunia’s picture

Same here. `pdflatex' and `latex' work on my webserver to create dvi's and pdf's from the command line, but I still get the above mentioned error message.

pmagunia’s picture

I got DruTeX working. The path variables needed to be adjusted in exec. When exec is run the $PATH variable is not defined so you have to define it yourself.

physcied’s picture

Can you please tell me where "exec" is and what path variables need to be adjusted to what?

pmagunia’s picture

Around line 86 in drutex_tools.inc I changed the original code to:

/*
    LaTeX check - We grab -version which should work on all platforms
   */
  exec('PATH=$PATH:/path/to/your/latex/bin; export PATH; LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/latex/lib; export LD_LIBRARY_PATH; latex --version;', $latex_output, $latex_return_value);

You adjust the absolute paths to suit your installation.

Also, in the Input Formats section of Site Configuration in LaTeX Rendering I changed the conversion method to custom with the following code:

PATH=$PATH:/path/to/your/latex/bin; export PATH; LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/latex/lib; export LD_LIBRARY_PATH; cd [TMP_DIR]; TEXINPUTS="[DRUTEX_DIR]//:" pdflatex -interaction=batchmode [HASH].tex; 
convert -density [DPI] -resize 25% [TMP_DIR]/[HASH].pdf -trim -quality 100 [IMG_FILE]

The paths in your .bash_profile and .bashrc in your home directory are not used when calling exec. That's why you have to redefine. I'm not sure this is the best method, but I got DruTeX working with this customization

puregin’s picture

Status: Active » Needs review
FileSize
568 bytes

This error is caused by new behaviour in PHP 5.3 vs. 5.2 - see http://php.net/manual/en/migration53.deprecated.php "call time pass by reference".

Here's a patch for the one-character change required to drutex.module, relative to drutex-6.x-1.x-dev.

The other messages about directories not being writable are configuration/installation issues. These should be resolved by adjusting the exec path for Apache /PHP, NOT by adjusting the code as suggested above. See http://php.net/manual/en/function.exec.php.

pmagunia’s picture

@puregin

I did install LaTeX in my home directory of my shared hosting account which is why I was setting those variables. I think it is necessary anytime when an install is outside the usual paramaters. I should have mentioned that in my post earlier.

I was getting the message LaTeX executable not found and setting the environment variables solved the problem.

ShaunDychko’s picture

While I can confirm that the patch in #6 gets rid of the error message, I'm not so sure about the approach. I tested the following code:

<?php

function toCall(&$var1, $var2) {
  var_dump(func_get_args());
  $var1 = $var1 * 5;
  $var2 = $var2 + 1;
}

$x1 = 4;
$x2 = 5;
$params = array();
$params[] = $x1;
$params[] = $x2;
call_user_func_array('toCall', &$params);

echo('<br />' . $x1);
echo('<br />' . $x2);

?>

and it returns the following:

Deprecated: Call-time pass-by-reference has been deprecated in /Users/sdychko/Web/php_test/index.php on line 14

Warning: Parameter 1 to toCall() expected to be a reference, value given in /Users/sdychko/Web/php_test/index.php on line 14

4
5

which says to me that you can't put an ampersand in front of the parameter array to solve the "pass by reference" issue. However, since the patch in #6 did make the error message go away, I took this question to Stack Overflow: http://stackoverflow.com/questions/8864241/can-we-pass-the-parameter-arr... and consensus is that you can't put ampersands in front of the parameter array of call_user_func_array(). Also, doing an informal search through Drupal and lots of contrib modules didn't find any instances of call_user_func_array() used with the parameter array passed by reference.

The offending function in this issue, drutex_pdf_nodeapi, doesn't make any changes to the node, so it doesn't even need the node as a reference. The change I propose is to revert the patch in #6, and change the function declaration on line 282 of drutex_pdf.inc to:

function drutex_pdf_nodeapi($node, $op, $teaser = FALSE, $page = FALSE) {

by removing the ampersand in front of $node.

Jhun Vert’s picture

I also encountered this error with PHP 5.3. The solution of Shaun Dychko works for me. I simly remove the & in line 282 of drutex_pdf.inc so that the &$node will be come &node. Thanks Shaun.

ramdhanh’s picture

I have try this, and work fine..

drutex.module

line 193
$D['drutex_dir_images'] = variable_get('file_directory_path', 'sites/default/files') .'/tex';

line 195
$D['drutex_url_images'] = variable_get('file_directory_path', 'sites/default/files') .'/tex';

drutex_pdf.inc

line 282
function drutex_pdf_nodeapi($node, $op, $teaser = FALSE, $page = FALSE) {

grzesag’s picture

Trying to set up Drutex in Drupal 7 and I noticed that public path must be set up in variables table if it is not use
drush vset file_public_path sites/default/files to set it or go to Configuration -> File System -> and save configuration
now error showing that image directory is not writeable should disappear

ShaunDychko’s picture

https://www.drupal.org/project/mathjax is the way to go these days.