Guest


    Latex Code & Mathematical symbols

    Share

    Guest
    Guest

    Latex Code & Mathematical symbols

    Post  Guest on 10/17/2011, 10:28 pm

    Pre-requisites: All-forum supported; Latex code Knowledge

    The source code isn't made by me; but its a dream come true for any engineer/math teacher's forum & the likes. I happen to come across this http://www.forkosh.dreamhost.com/source_mathtex.html & eagerly wanted to integrate it in my forum.

    1)In the sidebar widget I added
    Code:
    <script type="text/javascript" src="http://www.watchmath.com/main/cgi-bin/mathtex3.js"></script>
    <script type="text/javascript">window.mathPreamble =
     '\\usepackage[usenames]{color}\\color{brown} \\gammacorrection{0.7}\\dpi{140}\\png \\large ';replaceMath( document.body );</script>

    or you can add this in title description of the forum (in case you don't have sidebar widgets or any other place such that this code is executed everywhere

    2)You can play with these values to get appropriate display results
    Code:
    \\color{brown} \\gammacorrection{0.7}\\png\\dpi{140} \\large


    for instance
    color values:blue,black,green,white...
    size values:large,normal,small
    img values:png,gif
    dpi values:upto 300 (increases loadtime)
    gammacorrection: upto 4.5 (hit&trial method)



    3]You are done. Post a message in this format

    Use $latexcode$ to display inline or $$latexcode$$ to display as centered linebreak. All the messages on any page are parsed automatically to generate beautiful calculus/symbols & what not

    fOR BEGINNERS:

    You can get/generate latex codes from here:
    http://www.sciweavers.org/free-online-latex-equation-editor

    For an integral of trigonometry this code is generated
    \int_{0}^{\pi} \sin x \, dx = 2

    we write it as

    $\int_{0}^{\pi} \sin x \, dx = 2$

    ...& the result

    More complex latex codes generate this

    such examples can be found here: http://latexsearch.com/home.do

    I think such has never been attempted before on forumotion forums, mostly the forums using latex renderers & host the whole rendering engine at their personal servers; which isn't possible for us!!

    shadowz_au

    Re: Latex Code & Mathematical symbols

    Post  shadowz_au on 10/18/2011, 1:18 am

    This seem nice..

    Are you math teacher or something?

    Guest
    Guest

    Re: Latex Code & Mathematical symbols

    Post  Guest on 10/18/2011, 1:29 am

    put it mildly...YES

    Guest
    Guest

    Re: Latex Code & Mathematical symbols

    Post  Guest on 10/20/2011, 3:06 pm

    Update for a BUGG


    Code:
    replaceMath( document.body );

    The part of the code was interfering when after inserting latex code in $---$ tag the user uses preview function or quotes another or edit his reply, because the code parses all the tags $---$, present in whole page.

    User inputs code:



    Previews/edit afterwards



    This problem has been solved by the discussion here: http://www.webdeveloper.com/forum/showthread.php?t=232018

    Code:
    <script src="http://www.watchmath.com/main/cgi-bin/mathtex3.js?" type="text/javascript"></script>
    <script type="text/javascript">window.mathPreamble =
     '\\usepackage[usenames]{color}\\color{brown} \\gammacorrection{0.7}\\dpi{140}\\png \\large ';onload = function () {
    var els = document.getElementsByTagName("div");
    var i = els.length;
    while (i--) {
    if (els[i].className=="postbody") {
    replaceMath(els[i]);
    }
    }
    };</script>


    Above code directs mathtex parse $--$ tags only in 'postbody' class & will not alter editor code because it follows different class

    Dion/LGForum question.
    Wy can't we use this code?
    Code:
    replaceMath(document.getElementByClass("postbody"));



    Dion

    Re: Latex Code & Mathematical symbols

    Post  Dion on 10/20/2011, 5:05 pm

    That looks to be a better solution than messing around with the editor.

    Why don't you try it and see what happens? You would need code of the form:

    Code:
    var x=document.getElementsByClassName('postbody');
    for (i=0;i<x.length;i++) {replaceMath(x[i]);}

      Current date/time is 5/16/2012, 9:36 am