This site is a showcase for using LatexRender for mathematics in WordPress

Using LaTeX in WordPress

Plotting Graphs

Tuesday 31st August 2004

Filed under: — Steve @ 10:04 pm

\psset{unit=0.5cm}
\begin{pspicture}(-4,-0.5)(4,8)
\psgrid[subgriddiv=0,griddots=5,gridlabels=7pt](-4,-0.5)(4,8)
\psline[linewidth=1pt]{->}(-4,0)(+4,0)
\psline[linewidth=1pt]{->}(0,-0.5)(0,8)
\psplot[plotstyle=curve,linewidth=0.5pt]{-4}{0.9}{10 x exp}% postscript function
\rput[l](1,7.5){$10^x$}
\psplot[plotstyle=curve,linecolor=red,linewidth=0.5pt]{-4}{3}{2 x exp}% postscript function
\rput[l](2.2,7.5){\color{blue}$e^x$}
\psplot[plotstyle=curve,linecolor=blue,linewidth=0.5pt]{-4}{2.05}{2.7183 x exp}% postscript function
\rput[l](3.2,7.5){\color{red}$2^x$}
\rput(4,8.5){\color{white}change\normalcolor}
\rput(-4,-1){\color{white}bounding box\normalcolor}
\end{pspicture}

These graphs are courtesy of PSTricks

LatexRender for the Mac OS X

Filed under: — Steve @ 2:54 pm

Installation of LatexRender using the Mac OS X can be a little tricky. Fortunately, lieven le bruyn has written instructions on how to install it at Latexrender for WordPress under Mac OS X

Cancelling

Monday 30th August 2004

Filed under: — Steve @ 9:22 pm

\displaystyle
\frac{32}{64}
=\frac{2\times4\times4}{4\times4\times4}
=\frac{\cancelto{1}{2}\times\cancel{4}\times\cancel{4}}{\cancelto{2}{4}\times\cancel{4}\times\cancel{4}}
=\frac{1}{2}

Thanks to S.O.S. Mathematics CyberBoard for alerting me to the delights of the \LaTeX cancel package

Make LatexRender XHTML-compliant

Saturday 14th August 2004

Filed under: — Steve @ 10:48 pm

You can ensure LatexRender is XHTML-compliant if you make the small changes here (thanks to d)

\mbox{\Huge \pi}

Monday 9th August 2004

Filed under: — Steve @ 7:44 pm

\displaystyle \pi = \sum _{k=0} ^{\infty}  \dfrac{1}{16^k} \left[\dfrac{4}{8k+1}-\dfrac{2}{8k+4}-\dfrac{1}{8k+5}-\dfrac{1}{8k+6}\right]

LatexRender as a plugin

Filed under: — Steve @ 6:02 pm

I have now managed to make LatexRender as a plugin (download files here) which means that it won’t be necessary to edit WordPress files. Before you get too excited this assumes

  1. You are using at least WordPress 1.2 (which uses plugins)
  2. You have the latest files which don’t eat backslashes (detailed on page 2)

If not, you can still use the method in 5th August’s post. Also you will need to put some information about where to find files in the latexrender files.

1. You need to have \LaTeX and ImageMagick installed on your server. If this is not possible, then try mimeTeX (see page 2)

2. latexrender-plugin.php
Ensure that
include_once('/home/path_to/wordpress/latexrender/latex.php');
contains the correct path to where you have put latex.php

3. latex.php
Ensure that
$latexrender_path = "/home/domain_name/public_html/path_to/latexrender";
and
$latexrender_path_http = "/path_to/latexrender";
contain the correct path to where your latexrender files are to go

4. class.latexrender.php
Ensure that
var $_latex_path = "/usr/bin/latex";
var $_dvips_path = "/usr/bin/dvips";
var $_convert_path = "/usr/bin/convert";
var $_identify_path = "/usr/bin/identify";

point to the right places.

For Windows the paths in class.latexrender.php must use \ or / not just a single \
For example
var $_latex_path = "C:\texmf\miktex\bin\latex.exe";
or
var $_latex_path = "C:/texmf/miktex/bin/latex.exe";

5. Create a new latexrender folder in your WordPress folder, with sub folders tmp and pictures. These 2 folders must be chmod to 777. Upload latex.php and class.latexrender.php to the latexrender folder

6. If you are happy to let commenters use LaTeX (but beware spammers) then in latexrender-plugin.php remove // from the line:
// add_filter(‘comment_text’, ‘addlatex’);

7. Upload latexrender-plugin.php to WordPress’s plug-in folder (/wp-content/plugins) and activate it in the Plugins menu

\LaTeX should now be enabled! Use [tex ] and [/tex ] (without the space) to surround your maths. There’s a tex button to do this for you.

LatexRender

Sunday 8th August 2004

Filed under: — Steve @ 11:54 pm

Now that the backslash eating problem is being resolved, I am hoping to produce a plugin which avoids editing WordPress files. Watch this space \displaystyle \int_{-\infty }^{\infty }e^{-x^{2}}\;dx=\sqrt{\pi }

Using LaTeX in WordPress

Thursday 5th August 2004

Filed under: — Steve @ 6:59 pm

This is how you can use LatexRender in WordPress. Assuming you have \LaTeX and Imagemagick setup on your server and have downloaded latexrender.zip then:
1. In the download folder, otherPHP/latexrender you just need the 2 files
latex.php and class.latexrender.php
a) in latex.php ensure that
$latexrender_path = "/home/domain_name/public_html/path_to/latexrender";
contains the correct path to where your latexrender files are to go
Change
$latexrender_path_http = "/latexrender";
so it says
$latexrender_path_http = "/path_to/latexrender";

(more…)

I’m testing

Filed under: — Steve @ 12:15 pm

I’m testing the \sqrt{2} and \dfrac{1}{2}

Maths

Wednesday 4th August 2004

Filed under: — Steve @ 7:27 pm

\displaystyle \int_{0}^{1}\frac{x^{4}\left( 1-x\right) ^{4}}{1+x^{2}}dx=\frac{22}{7}-\pi

\kappa =\dfrac{d\psi }{ds}=\dfrac{\dfrac{d^{2}y}{dx^{2}}}{\left( 1+\left( \dfrac{dy}{dx}\right) ^{2}\right) ^{\frac{3}{2}}}=\dfrac{\overset{.}{x}\overset{..}{y}-\overset{..}{x}\overset{.}{y}}{\left( \overset{.}{x}^{2}+\overset{.}{y}^{2}\right) ^{\frac{3}{2}}}


 

This site is a showcase for using LatexRender for mathematics in WordPress