Showing latex commands in text string using mathjax

Posted by robezy on Stack Overflow See other posts from Stack Overflow or by robezy
Published on 2010-05-31T11:46:29Z Indexed on 2010/05/31 11:53 UTC
Read the original article Hit count: 271

Filed under:

I have a text string, for ex. 'A vehicle travels from A to B, distance {$d} km at constant speed. While returning back to A on same path it {$variation} its speed by {$v} km/hr. The total time of journey is {$t} hours. Find the original speed of vehicle.'

The variables in the curly brackets are to be replaced by appropriate latex equation. I'm using php's preg_replace to replace the variables with latex commands. Unfortunately, my latex commands are coming as it is. It is not processed by mathjax.

For ex, above text becomes A vehicle travels from A to B, distance 1 km at constant speed. While returning back to A on same path it increased its speed by (\frac{3}{2}) km/hr. The total time of journey is 1 hours. Find the original speed of vehicle. The frac is show as it is.

What is wrong here? Please ask me if you need any more info. Thanks

© Stack Overflow or respective owner

Related posts about latex