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)

Post by stevem » Fri Sep 14, 2007 4:41 pm

Anakim wrote:What is that path for latex ? The latexrender directory ?
No, the path is on the part of the server accessible only to root.
What operating system are you using? If it's Linux then binaries are usually installed in /usr/bin. You should find latex, convert, dvips, identify and gs files there. If they have been installed in another directory then you must put that in class.latexrender.php. If LaTeX, ImageMagick and GhostScript are not yet installed then you must do so as root.

Anakim
Registered User
Posts: 6
Joined: Fri Sep 14, 2007 1:54 pm

Re: math equations (with latex)

Post by Anakim » Fri Sep 14, 2007 5:44 pm

I finally use mimetex , i thought i could use latexrender with an ovh mutualised server ..
It works very fine.
Dear stevem, thanks for your help.

Anakim

GMaths
Registered User
Posts: 11
Joined: Tue Aug 05, 2003 10:17 pm

Re: math equations (with latex)

Post by GMaths » Sat Sep 15, 2007 4:18 pm

MB_MathemaTeX wrote:Now, 2 modifications of the phpBB3 files !

In viewtopic.php line 1239 :

Code: Select all

include("/yourpath/phpBB3/latexrender/phpbb_hook_mathematex_viewtopic.php");
In posting.php line 1021 :

Code: Select all

include("/yourpath/phpBB3/latexrender/phpbb_hook_mathematex_posting.php");
line 1239 ? line 1021 ?

Later or before what line of code?

With the addition of extension, the numbers of line are different!

Thank you.

GMaths
Registered User
Posts: 11
Joined: Tue Aug 05, 2003 10:17 pm

Re: math equations (with latex)

Post by GMaths » Sat Sep 15, 2007 4:24 pm

Quelqu'un a t-il essayé d'adapter latexrender pour mettre des figures en pstriks ?
Quelqu'un connait-il une solution pour utiliser pstriks sur un un forum phpbb3 ?
D'avance merci

Anybody has t-il tried to adapt to latexrender to put pictures pstriks?
Does anybody know a solution to use pstriks on one a forum phpbb3?
Beforehand thank you

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

Re: math equations (with latex)

Post by stevem » Sat Sep 15, 2007 5:19 pm

GMaths wrote:Anybody has t-il tried to adapt to latexrender to put pictures pstriks?
Does anybody know a solution to use pstriks on one a forum phpbb3?
Beforehand thank you
Just put the relevant package in function wrap_formula($latex_formula) in class.latexrender.php, for example,

Code: Select all

$string .= "\usepackage{pst-plot}\n";
You can see examples at Plotting Graphs and More LaTeX Graphics.

GMaths
Registered User
Posts: 11
Joined: Tue Aug 05, 2003 10:17 pm

Re: math equations (with latex)

Post by GMaths » Sat Sep 15, 2007 8:18 pm

stevem wrote:
GMaths wrote:Anybody has t-il tried to adapt to latexrender to put pictures pstriks?
Does anybody know a solution to use pstriks on one a forum phpbb3?
Beforehand thank you
Just put the relevant package in function wrap_formula($latex_formula) in class.latexrender.php, for example,

Code: Select all

$string .= "\usepackage{pst-plot}\n";
You can see examples at Plotting Graphs and More LaTeX Graphics.

Code: Select all

    function wrap_formula($latex_formula) {
        $string  = "\documentclass[".$this->_font_size."pt]{".$this->_latexclass."}\n";
        $string .= "\usepackage[latin1]{inputenc}\n";
        $string .= "\usepackage{amsmath}\n";
        $string .= "\usepackage{amsfonts}\n";
        $string .= "\usepackage{amssymb}\n";
        $string .= "\pagestyle{empty}\n";
        $string .= "\begin{document}\n";
        $string .= "$".$latex_formula."$\n";
        $string .= "\end{document}\n";

        return $string;
    }
 
It is necessary to modify this line, I suppose :

Code: Select all

$string .= "$".$latex_formula."$\n"; 
and put then the symbol $ for every formula.

Should not you modify anything to determine the dimensions of the image to create? I had tried and it seems to me that it did not work well...

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

Re: math equations (with latex)

Post by stevem » Sat Sep 15, 2007 8:48 pm

GMaths wrote:It is necessary to modify this line, I suppose :

Code: Select all

$string .= "$".$latex_formula."$\n"; 
and put then the symbol $ for every formula.
Don't do that as it will make a mess of other formulae. In the code you put in the forum either
1. put in a couple of blank lines at the beginning or
2. put \par at the beginning
then LaTeX will know what to with the extra $.
GMaths wrote:Should not you modify anything to determine the dimensions of the image to create? I had tried and it seems to me that it did not work well...
You can put that in the code you type in the forum. If you look at the ones in the examples I gave you (Plotting Graphs and More LaTeX Graphics), you will find they start with things like
\setlength{\unitlength}{1mm} or
\psset{unit=0.5cm} or
\psset{unit=.25pt}

onlyAtest
Registered User
Posts: 2
Joined: Fri Sep 21, 2007 3:20 pm

Re: math equations (with latex)

Post by onlyAtest » Fri Sep 21, 2007 3:34 pm

Hallo!
Sorry for my bad english.

Only a short question about mimetex:
Is there a chance to use mimetex without a cgi on the own server? Is it possible to use that cgi from a public server?

thank you

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

Re: math equations (with latex)

Post by stevem » Fri Sep 21, 2007 3:55 pm


onlyAtest
Registered User
Posts: 2
Joined: Fri Sep 21, 2007 3:20 pm

Re: math equations (with latex)

Post by onlyAtest » Fri Sep 21, 2007 9:44 pm

Thank you. It took some time but now i finally got it work.

chrisi99
Registered User
Posts: 52
Joined: Sat Oct 06, 2007 10:23 pm

Re: math equations (with latex)

Post by chrisi99 » Sat Oct 06, 2007 10:34 pm

I hope, someone can help me with the integration of LateX in my new phpbb3 board!

Im running a debian server and have installed the following (per apt-get):

-Imagemagick
-ghostscript
-LateX (tetex)

in my usr/bin i find the files: latex, gs, dvips and convert

ein installed the mod under /htdocs/latexrender and created tmp and pictures (CHMOD 777).

when checking my latex with the test.php mentioned earlier I get an output:

Code: Select all

pdfeTeX using libpoppler 3.141592-1.21a-2.2 (Web2C 7.5.4)
kpathsea version 3.5.4
Copyright (C) 1997-2004 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright (C) 1997-2004 Free Software Foundation, Inc.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfeTeX using  .... ...
So this seems to work!

i the changed the phpbb_hook_2.php(adjusted the paths) and the bbcode.php by inserting

Code: Select all

include("/var/www/virtual/lowping.at/stud/htdocs/latexrender/phpbb_hook_2.php");
on line 101 (just before the // Remove the uid from tags that have not been t..)

finally i created the BBTags in my backend

Code: Select all

[tex]{TEXT}[/tex]
unfortunately it STILL does not work :(

I so desperately hope someone here can help me!

my directory-tree:

htdocs
|----board (my phpbb 3.0)
|----latexrender

(these folders are in the webroot)

kind regards
Christoph

PS: phpinfo: http://stud.lowping.at/phpinfo.php
test.php : http://stud.lowping.at/latexrender/test.php

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

Re: math equations (with latex)

Post by stevem » Sat Oct 06, 2007 10:53 pm

chrisi99 wrote:unfortunately it STILL does not work
You forgot to say what doesn't work or what error messages you get.
Comment out the 6 unlink lines near the end of latexrender.php and try again and see if any files are created. You should get files with long names and extensions tex, aux, log, dvi, ps and gif/png.
If you don't get any of these files try turning register globals on and see if that helps.

chrisi99
Registered User
Posts: 52
Joined: Sat Oct 06, 2007 10:23 pm

Re: math equations (with latex)

Post by chrisi99 » Sun Oct 07, 2007 6:08 am

hi Steve!

Thanks for your reply!

The thing is, that just nothing happens. As if the latex does not recognize my attemp...

in the "pictures" and "tmp" folders are only index.php files which where created by the script I guess- containing

Code: Select all

<html>
<body>
	<center>
		You are not supposed to access this directory
	</center>
</body>
</html>
do I have to put the render directory _inside_ my board directory?

PS: i really would like tio keep RG off for security reasons! Maybe there is another way?



kind regards
Christoph

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

Re: math equations (with latex)

Post by stevem » Sun Oct 07, 2007 10:41 am

chrisi99 wrote:The thing is, that just nothing happens.
It can't be nothing.
What do you see in the post - are the [tex]...[/tex] tags removed and the latex code remains?
Have you changed phpbb_hook_2.php as in http://www.phpbb.com/community/viewtopi ... 02#2669402 to
In phpbb_hook_2.php:
replace $uid by $bbcode_uid twice
replace $text by $message six times
chrisi99 wrote:do I have to put the render directory _inside_ my board directory?
It can be where you like as long as /pictures is public since that is where the images will be taken from by the browser.

chrisi99
Registered User
Posts: 52
Joined: Sat Oct 06, 2007 10:23 pm

Re: math equations (with latex)

Post by chrisi99 » Sun Oct 07, 2007 11:08 am

dont question my inability *g*

in a Post i still see the bbcode tags
[tex]frac{2+dc}{9}[/tex]


so no conversion is done.

i have changed the hookup to the new variables (on all positions)!

Code: Select all

preg_match_all("#\[tex:$bbcode_uid \](.*?)\[/tex:$bbcode_uid \]#si",$message,$tex_matches);
and 6 times to $message (double checked)


if you would like to take a look: I created an account test:123456 on my board, http://stud.lowping.at/board if that is of any help!

PS: does this look right:

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
		$message = str_replace(':' . $this->bbcode_uid, '', $message);
	}

	/**
	* Init bbcode cache
	*
I am really appreciating your help! Thank you alot!

Post Reply

Return to “[2.0.x] MOD Requests”

Who is online

Users browsing this forum: No registered users and 9 guests