Latex on wordpress blog

Some time back I came to know that wordpress blogs hosted at wordpress.com supports latex. But no such default functionality for self hosted wordpress blogs. But there are plugins (latexrender, wp-latex) which can facilitate similar things.
But for these to work you will need to install latex on your hosting account. (I have intalled latex on my hostmonster account some time back.).

For installing latexrender wordpress plugin you can find guidelines here
One more thing to remember while setting $latexrender_path_http in latex.php give full http path to latexrender folder like $latexrender_path_http = "http://your blog addr/latexrender";
Now you are set to go. To include \LaTeX in your posting, use the following:

[tex] your latex code here [/tex]

For example:

[tex] (a+b)^3 = (a+b)^2(a+b) [/tex]

produces :

(a+b)^3 = (a+b)^2(a+b)

But after setting up latexrender plugin, the png image was still not generated. Error that I got was:

I can’t find the format file ‘latex.fmt’!

But when I tried similar command (latex sample.tex) from shell prompt, It was working fine.
So I thought that problem is in calling latex from php file using exec. So when I copied the latex.fmt file to directory containing .tex file it started working fine. May be some problem in setting environment variable.
You can look for latex.fmt file using :

find -name latex.fmt

For latexrender you can copy latex.fmt file to latexrender/tmp/ folder inside your wordpress installation.
I’m still working on how to set environment variable in php so that I don’t have to copy latex.fmt again and again.
But for now I gave got working latex on my blog :) . Now I can write math equations in my blog posts.
You can try latex formulas in comment too.

And if you want to publish LaTeX equation in WordPress blog without installing any software, try jsTeXrender: http://yourequations.com/. Thanks Doug for the tip.

Related Posts:
Latex Beamer
Installing latex on hostmonster

Installing latex on hostmonster

In continuation with my previous post (Some times yahoo is better), I followed the steps on how to install latex/tetex on my web host from here (You can also get the Installation steps from QuickInstall file in source code or access the same file from tug.org).

But the problem is that on web hosts like hostmonster you won’t have root access so you will need to modify some of the things and do a local install in your home directory.

For that you can specify –prefix accordingly while doing ./configure. So you need to do:

./configure --prefix=/home/username/local/teTeX
replace username with your account name

This step ended without any errors But while I was doing make world, the process exited with following error:

/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXt.a when searching for -lXt
/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.so when searching for -lX11

I found this thread, where they were discussing similar error and from what I got it was due to machine platform. So I checked my host system information with

uname -a

from there I got x86_64 x86_64 x86_64 GNU/Linux which meant its a 64 bit architecture.

So after some tweaking to what I found here(CBLFS: TeTeX) to make it work for local install, you can do following to compile the package:

CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" USE_ARCH=64 \
./configure --prefix=/home/username/local/teTeX/ \
–enable-shared \
–without-texinfo \
–with-x=no \
–with-system-ncurses \
–with-system-zlib &&
[ -f texk/libtool ] && sed -i “/sys_lib_search_path_spec=/s:/lib:&64:g” texk/libtool;

And then you can do

make world
make all install

You can then add generated executable to your system path by:

PATH=/home/username/local/teTeX/bin/x86_64-unknown-linux-gnu:$PATH;
export PATH

You can also configure your installation using:

texconfig

And its DONE :) Find all steps followed by me here
So if you want to install on 32 bit config the method at Microcontroller programming Blog should work fine.
Also read: The Tetex HowTo

You can download required packages using wget on shell account at hostmonster from ctan.org

Related Post: Latex Beamer

Sometimes yahoo is better

And it was proved yesterday night. Actually I was looking for installing latex on my web domain (hostmonster). So here I dont have root permissions and I might also had to deal with other issue. I thought of going the easy way and just google it as someone must have done something similar. But I tried variation combination (latex on web hosts, latex on hostmonster and other search queries too) and got nothing.

Then after some time I thought of giving yahoo search a shot (though I was not quite sure that it would fetch me anything more useful). So when I search (latex on hostmonster), voila the first result was exactly what I needed. Now I’m eager to try installing latex(/tetex) on my web hosting account. And yeah i’ll keep update you, how it went.

Share, what search engine do you use and which do you find better.