math equations (with latex)

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
stevem
Registered User
Posts: 398
Joined: Sun Aug 25, 2002 1:59 pm

Re: math equations (with latex)

chrisi99 wrote:

Code: Select all

 }
include("/var/www/virtual/lowping.at/stud/htdocs/latexrender/phpbb_hook_2.php");
// Remove the uid from tags that have not been transformed into HTML
$latexrender_path_http = "/latexrender"; with this all working, i have to expect the problem to be somewhere between the LateX-PS-Imagemagick triangle.... Dont you think so as well? And again: Thank you so much for your patience! stevem Registered User Posts: 398 Joined: Sun Aug 25, 2002 1:59 pm Re: math equations (with latex) If there is no tex file in /tmp (after commenting out unlink lines in class.latexender.php) then latex has not been run, since there is no file to run it on. So the fault is earlier on. I wonder if this is it: In phpbb_hook_2.php you added a couple of spaces so it didn't find any tags to replace: You put Code: Select all preg_match_all("#$tex:bbcode_uid$(.*?)$/tex:bbcode_uid$#si",$message,$tex_matches); but it should be Code: Select all preg_match_all("#$tex:bbcode_uid$(.*?)$/tex:bbcode_uid$#si",$message,$tex_matches); You added the spaces after uid and before \] in 2 places. stevem Registered User Posts: 398 Joined: Sun Aug 25, 2002 1:59 pm Re: math equations (with latex) I updated the previous post as I had got it the wrong way round. The problem was that you had added (not lost) 2 spaces that shouldn't have been there. chrisi99 Registered User Posts: 52 Joined: Sat Oct 06, 2007 10:23 pm Re: math equations (with latex) I am proudly handing you over a virtual beer and congratulate you for solving my problem! it all works now! if I can help you (backlink to your site...) PLEASE pm me, I would be glad to do so! best wishes Christoph takufner Registered User Posts: 205 Joined: Mon Oct 23, 2006 10:39 am Location: Rio de Janeiro - Brasil Name: Prof. Caju Contact: Re: math equations (with latex) Hi stevem, I managed upgrading my forum from 2.0.2.2 to 3.0.0 with the 6000 messages in the old version. In 2.0.2.2 I had mimetex working fine. And almost all my messages have some sort of equation using mimetex (with the BBCode $$). In my new server I've successfully installed mimetex, it is working properly (the example file can show all the equations and produce the correct cache for those equations written in the example.php). I've changed the things you instructed in this post (btw, for mimetex there are 8 changes for text, not just 6). Now I can use mimetex for my new posts, but without cache for equations in the forum. This is not my biggest problem. My problem is with the legacy message. No one is showing the equations. The BBcode is not being converted for the old messages. But, if I edit any old message, after saving the equations are ok for this message. Is there some way to reprocess all messages? I am using phpBB3 3.0.0 Olympus on a Linux shared server. Thanks in advance. stevem Registered User Posts: 398 Joined: Sun Aug 25, 2002 1:59 pm Re: math equations (with latex) The code looks for an image in /pictures and if it's there it should show that image otherwise it will reprocess the image. I'm not sure why it isn't showing the images. A couple of things to try: 1. delete images in /pictures to force new ones to be made and if that doesn't help 2. comment out the first three lines in phpbb_hook_2.php of Code: Select all if (is_file(full_path_filename)) { url = pictures_path_http."/".filename; } else { command = "mimetex_path -e ".full_path_filename." ".escapeshellarg(mimetex_formula); which will force new images to be created every time. miguel-murcia Registered User Posts: 5 Joined: Wed Feb 01, 2006 9:33 am Re: math equations (with latex) Hi stevem from foro.fisimur.org . Sorry for my english, i'm spanish. I have a little problem. I found your code on http://www.mayer.dial.pipex.com/tex.htm and i don't found the three lines above. My sistem is well since today when i have phpbb3 upgrade. I am delete all images of latexrender/image directory. My problem is that some elements isn't rendering. For example [tex]\LaTeX$$ and $$\LaTeX{}$$ give a [unparseable or potentially dangerous latex formula] while $$resultado=\frac{Prueba}{Desarrollo}$$ or $$E=mc^2$$ don't give me problem. You can see it in http://foro.fisimur.org/viewtopic.php?p=7998#p7998. I use $$\LaTeX$$ before upgrade without problems. i look that i can't write () in formulas, for example $$f(x)=3x$$ show this My phpbb_hook_2.php is: Code: Select all // adjust this to match your system configuration$latexrender_path = "/home/fisimur/public_html/foro/latexrender";
$latexrender_path_http = "/latexrender"; // -------------------------------------------------------------------------------------------------- include_once($latexrender_path."/class.latexrender.php");

preg_match_all("#$tex:bbcode_uid$(.*?)$/tex:bbcode_uid$#si",$message,$tex_matches);

$latex = new LatexRender($latexrender_path."/pictures",$latexrender_path_http."/pictures",$latexrender_path."/tmp");

for ($i=0;$i < count($tex_matches[0]);$i++) {
$pos = strpos($message, $tex_matches[0][$i]);
$latex_formula = html_entity_decode($tex_matches[1][$i]);$url = $latex->getFormulaURL($latex_formula);

$alt_latex_formula = htmlentities($latex_formula, ENT_QUOTES);
$alt_latex_formula = str_replace("\r","&#13;",$alt_latex_formula);
$alt_latex_formula = str_replace("\n","&#10;",$alt_latex_formula);

if ($url != false) {$message = substr_replace($message, "<img src='".$url."' title='".$alt_latex_formula."' alt='".$alt_latex_formula."' align='absmiddle'>",$pos,strlen($tex_matches[0][$i])); } else {$message = substr_replace($message, "[unparseable or potentially dangerous latex formula]",$pos,strlen($tex_matches[0][$i]));
}
}

stevem
Registered User
Posts: 398
Joined: Sun Aug 25, 2002 1:59 pm

Re: math equations (with latex)

It looks like something is altering the text before LaTeX can get to it. Comment out using // the 6 lines at the end of class.latexrender.php starting with unlink. Then try $$\LaTeX$$ and there should be some files in /tmp with long names. Look at .tex and .log to see what has happened.

The problem with ( and ) is easily solved. In phpbb_hook_2.php after

Code: Select all

$latex_formula = html_entity_decode($tex_matches[1][$i]); add the lines Code: Select all $latex_formula = str_replace("&#040;","(",$latex_formula)$latex_formula = str_replace("&#041;",")",$latex_formula) You can add similar lines for any other symbols that get changed. miguel-murcia Registered User Posts: 5 Joined: Wed Feb 01, 2006 9:33 am Re: math equations (with latex) Thank you for solved () problem the correct lines are without 0: Code: Select all $latex_formula = str_replace("&#40;","(",$latex_formula);$latex_formula = str_replace("&#41;",")",\$latex_formula);
The problem with \LaTeX can see in log file it, but i don't know how solved:

Code: Select all

Missing character: There is no L in font nullfont!
Missing character: There is no T in font nullfont!

.
relax
l.22 \begin{eqnarray*}\LaTeX
\end{eqnarray*}
I wasn't able to read the size data for this font,
so I will ignore the font specification.
[Wizards can fix TFM files using TFtoPL/PLtoTF.]
You might try inserting a different font spec;
e.g., type I\font<same font id>=<substitute font name>'.

Missing character: There is no A in font nullfont!
Missing character: There is no T in font nullfont!
Missing character: There is no E in font nullfont!
Missing character: There is no X in font nullfont!
Missing character: There is no L in font nullfont!
Missing character: There is no T in font nullfont!
Missing character: There is no A in font nullfont!
Missing character: There is no T in font nullfont!
Missing character: There is no E in font nullfont!
Missing character: There is no X in font nullfont!
Missing character: There is no L in font nullfont!
Missing character: There is no T in font nullfont!`

Who is online

Users browsing this forum: No registered users and 9 guests