Has anyone created bbCode for maths typesetting? What linux program would be best to use?
I am running successfully using MimeTex, but its image quality is not so good.
Latex BBcode with phpBB3
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Re: Latex BBcode with phpBB3
I used phpMathPublisher, with some tweaks :
The default script returns the URL of the created image, it is not very easy to use it in a custom BBCode... I wrote a small script, imgmath.php, which directly returns the image corresponding to the math calculation given in the URL, so I can use <img src='math/imgmath.php?[URL encoded calculation]' /> for BBCode replacement of my [math] BBCode.
The default script returns the URL of the created image, it is not very easy to use it in a custom BBCode... I wrote a small script, imgmath.php, which directly returns the image corresponding to the math calculation given in the URL, so I can use <img src='math/imgmath.php?[URL encoded calculation]' /> for BBCode replacement of my [math] BBCode.
Code: Select all
<?php
// imgmath.php
include('mathpublisher.php');
$size = 12;
if(!$_SERVER['QUERY_STRING']) die('');
$text = str_replace('+', '%2B', $_SERVER['QUERY_STRING']);
$text = urldecode($text);
$text = preg_replace('/<!--.*(-->){0,1}/', '', $text);
$formula = new expression_math(tableau_expression(trim($text)));
$formula->dessine($size);
$path = 'img/' . (1000-imagesy($formula->image)+$formula->base_verticale+3) . md5($text).'.png';
if(!file_exists($path)) ImagePNG($formula->image, $path) or die('');
header('Content-type: image/png');
readfile($path);
?>
Re: Latex BBcode with phpBB3
Hi!
VinDuv, could you explain how did you manage to URL encode math expression? Custom bbcode allows only few substitions like {TEXT}, {SIMPLETEXT} etc. {TEXT} is the one I'd like to use, because it's the only one than can contain multiple lines. Using <img src="blah/blah.cgi?{TEXT}" /> is not acceptable. What for are those <!-- --> in your example? I would be really grateful for detailed answer. Thanks in advance.
VinDuv, could you explain how did you manage to URL encode math expression? Custom bbcode allows only few substitions like {TEXT}, {SIMPLETEXT} etc. {TEXT} is the one I'd like to use, because it's the only one than can contain multiple lines. Using <img src="blah/blah.cgi?{TEXT}" /> is not acceptable. What for are those <!-- --> in your example? I would be really grateful for detailed answer. Thanks in advance.
Re: Latex BBcode with phpBB3
Hi
For those who are interested, I managed to make phpmathpublisher working with a bbcode.
You need to create a bbcode
making this replacement
This way, you are able to call a remote php script via a html tag.
rendermaths.php
Finally I put everything - rendermaths.php, mathpublisher.php, the directories font/ and img/ in a subfolder phpmathpublisher/ of my forum root dir.
Once done, you only need to set correctly the paths in the header of mathpublisher.php.
NB: this tip ables to call php scripts from a bbcode, so it can be extended to a lot of other uses
For those who are interested, I managed to make phpmathpublisher working with a bbcode.
You need to create a bbcode
Code: Select all
[eq]{TEXT}[/eq]
Code: Select all
<script type="text/javascript" src="phpmathpublisher/rendermaths.php?message={TEXT}"></script>
rendermaths.php
Code: Select all
<?php
include("mathpublisher.php");
$message = $HTTP_GET_VARS['message'];
$size = $HTTP_GET_VARS['size'];
$pathtoimg = $HTTP_GET_VARS['pathtoimg'];
if (!isset($pathtoimg))
$pathtoimg="phpmathpublisher/img/";
if ((!isset($size)) || $size<10)
$size=14;
if ( isset($message) && $message!='' )
{
$message = addslashes($message);
$output = mathfilter($message, $size, $pathtoimg);
echo "window.document.write('".$output."');";
}
?>
Once done, you only need to set correctly the paths in the header of mathpublisher.php.
NB: this tip ables to call php scripts from a bbcode, so it can be extended to a lot of other uses
pierre
Re: Latex BBcode with phpBB3
First of all, sorry for writing in such an old topic, but I'm stuck!
Second of all, I'm totally new in phpbb and php, so please describe everything slowly as if you would explain it to your 2 years old sister =)
Alright, so here's my problem:
I'm tryting to implement Latex via BBCode in our phpbb3-Forum. I'm using phpmathpublisher and tried to do what ticapix wrote.
So her is what I did:
I downloaded phpmathpublisher and copied the folder into the phpbb Folder on my server. I created the rendermaths.php file and copied into the phpmathpublisher folder. I created the BBCode in the admin section and placed this code in:
Yea..... that's how far I got.... and now I'm completely lost to be honest... I have no clue what to do and hope that you guys can help me.
Best regads,
Maaadin
Second of all, I'm totally new in phpbb and php, so please describe everything slowly as if you would explain it to your 2 years old sister =)
Alright, so here's my problem:
I'm tryting to implement Latex via BBCode in our phpbb3-Forum. I'm using phpmathpublisher and tried to do what ticapix wrote.
So her is what I did:
I downloaded phpmathpublisher and copied the folder into the phpbb Folder on my server. I created the rendermaths.php file and copied into the phpmathpublisher folder. I created the BBCode in the admin section and placed this code in:
Code: Select all
<script type="text/javascript" src="phpmathpublisher/rendermaths.php?message={TEXT}"></script>
Best regads,
Maaadin
Re: Latex BBcode with phpBB3
This will not work for "+". If you use for example math code "x+y" the "+" will not be shown.
The reason is, that http encoding uses this char for its own encoding. Has anyone a solution for this?
The reason is, that http encoding uses this char for its own encoding. Has anyone a solution for this?
Re: Latex BBcode with phpBB3
"+" Won't be URL encoded, it's a perfectly valid character.
Re: Latex BBcode with phpBB3
yeah, thats the reason its not visible in the math code