Testing latex back

Board: Board index ‹ Logistics ‹ Scratchpad

(L) [2007/06/13] [greenhybrid] [Testing latex] Wayback!

[SMILEY :D]

What an indirect way to say "hey, d00dz, why the coredump is here no LaTeX inside???" [SMILEY :D]

But yeah, this would be an awesome extension, esp. for the off-line section. But I don't know if there is an tex-markup - add-on for phpbb...

Imperator?
(L) [2007/06/14] [Phantom] [Testing latex] Wayback!

I've just had my first extensive exposure to Latex... Not bad, I have to admit.
(L) [2007/06/14] [greenhybrid] [Testing latex] Wayback!

As I hackishly learnt LaTeX some time ago, I had so much fun with typesetting that I even began writing a Ray Tracing book (lycium might remember).
(L) [2007/06/15] [tbp] [Testing latex] Wayback!

There's no Latex on that host (and i have no bearing on that), so i have no way to either support it in the wiki or hack it into phpbb.
Annoying, but i see no way around.
(L) [2008/01/18] [beason] [Testing latex] Wayback!

Pardon me, testing latex:

[latex]
\begin{equation}
L(\vec{x},\vec{\omega}) = L_e + \int_\Omega f_r(\vec{\omega}, \vec{\omega}') \>
L_i(\vec{x},\vec{\omega}') \> (\vec{N}\cdot \vec{\omega'}) \; \diff \vec{\omega}' \ .
\label{gi:rendeqn}
\end{equation}
[/latex]

Test failed! [SMILEY :(]
(L) [2008/09/09] [takiuchi] [Testing latex] Wayback!

Hello,
I made a web service for embedding images of mathematical expression.
By using the service, you can embed any kind of formulae like this.
[IMG #1 Image]
Detailed information was mentioned here
[LINK http://blog.s21g.com/articles/687]
Thanks.
[IMG #1]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?L(%5Cvec%7Bx%7D,%5Cvec%7B%5Comega%7D)%20%3D%20L_e%20+%20%5Cint_%5COmega%20f_r(%5Cvec%7B%5Comega%7D,%20%5Cvec%7B%5Comega%7D')%20%5C%3E%0AL_i(%5Cvec%7Bx%7D,%5Cvec%7B%5Comega%7D')%20%5C%3E%20(%5Cvec%7BN%7D%5Ccdot%20%5Cvec%7B%5Comega'%7D)%20%5C;%20d%20%5Cvec%7B%5Comega%7D'%20%5C%20..png
(L) [2008/09/11] [tbp] [Testing latex] Wayback!

Ah! Neat. Thanks.
[IMG #1 f(x)=\int_0^{x}g(t)\,dt]
[IMG #2 Fij = 1/Ai \int \int costi costo / (pi r^2) dAi dAj]
beason's on the other hand...
[IMG #3 \begin{equation}<br />L(\vec{x},\vec{\omega}) = L_e + \int_\Omega f_r(\vec{\omega}, \vec{\omega}') \><br />L_i(\vec{x},\vec{\omega}') \> (\vec{N}\cdot \vec{\omega'}) \; \diff \vec{\omega}' \ .<br />\label{gi:rendeqn}<br />\end{equation}]
PS: sadly installing LaTeX on this host wasn't an option.
[IMG #1]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?f(x)=\int_0^{x}g(t)\,dt.png
[IMG #2]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?Fij = 1/Ai \int \int costi costo / (pi r^2) dAi dAj.png
[IMG #3]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?\begin{equation}
L(\vec{x},\vec{\omega}) = L_e + \int_\Omega f_r(\vec{\omega}, \vec{\omega}') \>
L_i(\vec{x},\vec{\omega}') \> (\vec{N}\cdot \vec{\omega'}) \; \diff \vec{\omega}' \ .
\label{gi:rendeqn}
\end{equation}.png

(L) [2008/09/11] [madd] [Testing latex] Wayback!

>> tbp wrote:Ah! Neat. Thanks.


beason's on the other hand...
PS: sadly installing LaTeX on this host wasn't an option.
better:
[IMG #1 F_{ij} = \frac{1}{A_i} \int \int \frac{\cos\theta_i \cos\theta_o}{\pi r^2} dA_i dA_j]
[IMG #1]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?F_{ij} = \frac{1}{A_i} \int \int \frac{\cos\theta_i \cos\theta_o}{\pi r^2} dA_i dA_j.png
(L) [2008/09/11] [greenhybrid] [Testing latex] Wayback!

>> tbp wrote:PS: sadly installing LaTeX on this host wasn't an option.
if it ever will be an option, I have coded an ugly hack in use on my sites. It is unsafe yet (no input check), but maybe forms a simple base. the function mkdir_p() is nothing but an emulation of mkdir -p.
pre-edit: meh, php extension not allowed, here is the code:
Code: [LINK # Select all]<?php
function genMathImg ($math, $standalone=true) {
    $LaTeX =
'\documentclass[fleqn]{article}
\usepackage{amssymb,amsmath,bm}
\usepackage[latin1]{inputenc}
\begin{document}
\thispagestyle{empty}
\mathindent0cm
\parindent0cm
\begin{displaymath}
'.$math.'
\end{displaymath}
\end{document}
';
    // Write temporary LaTeX file.
    mkdir_p (GEN_MATH_FOLDER."/tmp");
    $tmp_filename = GEN_MATH_FOLDER."/tmp/".md5 ($math); // Filename w/out type-postfix.
    //$destFilename = "gen-math/".urlencode ($math).".png";
    $destFilename = GEN_MATH_FOLDER."/".md5 ($math);
    file_put_contents ($tmp_filename.".tex", $LaTeX);
   
    // Run LaTeX and dvipng.
    $command = "pushd ".dirname ($tmp_filename)."; pwd; "
        ."latex ".basename ($tmp_filename).".tex ; "
        ."popd; "
        ."dvipng --strict -D 130 -T tight -fg 'rgb 0.0 0.0 0.0' -bg 'rgb 1.0 1.0 1.0' -o {$destFilename}.png {$tmp_filename}.dvi; "
        //."dvipng --strict -D 130 -T tight -fg 'rgb 1.0 1.0 1.0' -bg 'transparent' -o {$destFilename}.png {$tmp_filename}.dvi; "
        ."dvipng --strict -D 320 -T tight -o {$destFilename}.big.png {$tmp_filename}.dvi; "
    ;
    $buffer = array ();
    exec ($command, $buffer, $ret);
    $buffer = implode ("\n", $buffer);
   
    // Check if there was an error on the shell.
    if (0 != $ret) {
        echo "<span style=\"color: #0F0FFF;\"><strong>warning:</strong> Failed to generate a png-file from formula '$math', the return value of 'latex .. && dvipng ..' is '$ret':<br><hr>";
        echo "$buffer<br>";
        echo "<hr></span><br />";
        return '<p style="text-align: center">'.$math.'</p>';
    }

    // Set permissions.
    if(!@chmod ($destFilename.".png", 0644)) {
        echo "<span style=\"color: #0000FF;\"><strong>warning:</strong> setting permission for file '$destFilename.png' failed. Run 'chmod 0644 $destFilename.png'.</span><br />";
    }
    if(!@chmod ($destFilename.".big.png", 0644)) {
        echo "<span style=\"color: #0000FF;\"><strong>warning:</strong> setting permission for file '$destFilename.big.png' failed. Run 'chmod 0644 $destFilename.big.png'.</span><br />";
    }
    // Cleanup.
    rm_r (GEN_MATH_FOLDER."/tmp");
    rmdir (GEN_MATH_FOLDER."/tmp");
   
    // Prepare returned markup.
    $href = '<a href="'.SITE_FQN.$destFilename.'.big.png"><img style="vertical-align: bottom;" class="naked" src="'.SITE_FQN.$destFilename.'.png" alt="'.$math.'"></a>';
   
    return
        $standalone
        ? ( '<p style="text-align: center;">' . $href .'<p>' )
        : ( '<span style="vertical-align: center; text-align: center;">' . $href . '</span>' )
    ;
}
?>
(L) [2008/09/11] [beason] [Testing latex] Wayback!

>> tbp wrote:beason's on the other hand...

[IMG #1 L(\vec{x},\vec{\omega}) = L_e + \int_\Omega f_r(\vec{\omega}, \vec{\omega}') \> L_i(\vec{x},\vec{\omega}') \> (\vec{N}\cdot \vec{\omega'}) \; d\vec{\omega}']
Fixed. It doesn't like \begin{equation}, \end{equation} (they are not needed anyway), \diff (use d instead), and also newlines (causes the great ancient <br/> formula to be inserted).
Anyway, fantastic job, tbp!!  [SMILEY =D>] The tex tag is sweet. And thanks takiuchi and greenhybrid, for your contributions and jump starting this again.
[IMG #2 \gamma\alpha\gamma!]
[IMG #1]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?L(\vec{x},\vec{\omega}) = L_e + \int_\Omega f_r(\vec{\omega}, \vec{\omega}') \> L_i(\vec{x},\vec{\omega}') \> (\vec{N}\cdot \vec{\omega'}) \; d\vec{\omega}'.png
[IMG #2]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?\gamma\alpha\gamma!.png
(L) [2008/09/12] [jogshy] [Testing latex] Wayback!

latex graphics are cool [SMILEY :p]
[IMG #1 Image]
Btw... Could we get svg support too?
[svg]http://www.carto.net/papers/svg/gui/Window/index.svg[/svg]
[IMG #1]:Not scraped: https://web.archive.org/web/20080919035914im_/http://formula.s21g.com/?%5Csetlength%7B%5Cunitlength%7D%7B3cm%7D%0A%5Cbegin%7Bpicture%7D(1.75,%202.75)(0,%20-0.1)%0A%20%20%5Cput(0,0)%7B%5Cvector(1,0)%7B1.75%7D%7D%20%0A%20%20%5Cput(1.85,%20-0.03)%7B$x$%7D%0A%20%20%5Cput(0,0)%7B%5Cvector(0,1)%7B2.75%7D%7D%20%0A%20%20%5Cput(0.07,%202.70)%7B$y$%7D%0A%20%20%5Cthicklines%0A%20%20%5Cqbezier(0.399,%200.467)(0.797,%200.998)%0A%20%20%20%20%20%20%20%20%20%20(1.118,%201.962)%0A%20%20%5Cthinlines%0A%20%20%5Cmultiput(0.399,%200)(0,%200.1)%7B3%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(0,1)%7B0.05%7D%7D%0A%20%20%5Cmultiput(1.118,%200)(0,%200.1)%7B20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(0,1)%7B0.05%7D%7D%0A%20%20%5Cput(0.399,%20-0.08)%7B%5Cmakebox(0,0)%7B$x_1$%7D%7D%0A%20%20%5Cput(1.118,%20-0.08)%7B%5Cmakebox(0,0)%7B$x_2$%7D%7D%0A%20%20%5Cmultiput(0.399,%200.467)(0,%20-0.267)%7B2%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(-1,%200)%7B0.2%7D%7D%0A%20%20%5Cmultiput(0.399,%200.467)(-0.2,%200)%7B2%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(0,%20-1)%7B0.267%7D%7D%0A%20%20%5Cput(0.399,%200.467)%7B%5Cvector(-1,%200)%7B0.2%7D%7D%0A%20%20%5Cput(0.399,%200.467)%7B%5Cvector(0,%20-1)%7B0.267%7D%7D%0A%20%20%5Cput(0.399,%200.467)%7B%5Cvector(-3,%20-4)%7B0.2%7D%7D%0A%20%20%5Cput(0.32,0.55)%7B%5Cmakebox(0,0)%7B$H$%7D%7D%0A%20%20%5Cput(0.48,%200.33)%7B%5Cmakebox(0,0)%7B$V_1$%7D%7D%0A%20%20%5Cmultiput(1.118,%201.962)(0,%200.6)%7B2%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(1,0)%7B0.2%7D%7D%0A%20%20%5Cmultiput(1.118,%201.962)(0.2,%200)%7B2%7D%0A%20%20%20%20%20%20%20%20%20%20%20%7B%5Cline(0,1)%7B0.6%7D%7D%0A%20%20%5Cput(1.118,%201.962)%7B%5Cvector(1,0)%7B0.2%7D%7D%0A%20%20%5Cput(1.118,%201.962)%7B%5Cvector(0,1)%7B0.6%7D%7D%0A%20%20%5Cput(1.118,%201.962)%7B%5Cvector(1,3)%7B0.2%7D%7D%0A%20%20%5Cput(1.22,%201.87)%7B%5Cmakebox(0,0)%7B$H$%7D%7D%0A%20%20%5Cput(1.02,%202.22)%7B%5Cmakebox(0,0)%7B$V_2$%7D%7D%0A%20%20%5Cput(0.797,%201.195)%7B%5Cvector(0,-1)%7B0.333%7D%7D%0A%20%20%5Cput(0.777,%201.195)%7B%5Cline(1,0)%7B0.04%7D%7D%0A%20%20%5Cput(0.83,1.0)%7B$G$%7D%0A%5Cend%7Bpicture%7D%0A">
(L) [2008/09/12] [tbp] [Testing latex] Wayback!

SVG is only supported by some browsers so, much like MathML/LaTeX, we'd need an external rendering facility. There was some LaTeX here & there already but you're the only making a fuss about SVG, so... [SMILEY :unibrow:]

back