# [LON-CAPA-users] Math Display Problem

Lucas, Mark lucasm at ohio.edu
Sun Mar 29 22:49:45 EDT 2020

The \ in $PwrIntegral need to be escaped. Try:$PwrIntegral = "p(x) = \\frac{1}{T} \\int_0^T v(x) i(x) dx”;

\\ escapes the left slash and puts a single left slash in.

\ is used to include special characters in a perl string: \n - newline, \r - carriage return.
It thought \f and \i were special characters.
\\ says make this a real \

Hope this helps!
Mark

> On Mar 29, 2020, at 10:25 PM, Harding, Gene L <glhardin at purdue.edu> wrote:
>
> Hi,
>
> I am having trouble getting equations to render properly. I have done this before, and have even tried directly copying code I have used before, but cannot get it to display properly.
>
> This is one of the equation definitions:
>   $PwrIntegral = "p(x) = \frac{1}{T} \int_0^T v(x) i(x) dx"; > > This is the radiobuttonresponse code using it: > <radiobuttonresponse max="10" randomize="yes"> > <foilgroup> > <foil location="random" value="true" name="foil1"> > <startouttext /> > <m eval="on" display="mathjax">$ $PwrIntegral$</m>
>                 <endouttext />
>             </foil>
>             <foil location="random" value="false" name="foil2">
>                 <startouttext /><m eval="on" display="mathjax">RMSIntegral $</m><endouttext /> > </foil> > <foil location="random" value="false" name="foil3"> > <startouttext /><m eval="on" display="mathjax">$ $AvgIntegral$</m><endouttext />
>             </foil>
>             <foil location="random" value="false" name="foil4">
>                 <startouttext />bla<endouttext />
>             </foil>
>             <foil location="random" value="false" name="foil5">
>                 <startouttext />This is foil Five, and it is currently set to "false."<endouttext />
>             </foil>
>         </foilgroup>
>
> I can’t send a snip of the display to the listserv, but it looks something like this:
> p(x) = rac1Tint0Tv(x)i(x)dx
>
> It responds to the _subscript and ^superscript, but completely ignores the \frac and \int commands. I know I must be doing something dumb, but don’t know what, and don’t understand why a different expression I pulled from a correctly working problem does not work in this one.
>
> If anyone can see what I’m doing wrong, please help. The exam is scheduled for first thing Tuesday morning…
>
> Best regards,
>
> Gene L. Harding, PE
> Associate Professor of ECET
> Purdue University
> 574-520-4190
> https://polytechnic.purdue.edu/south-bend/
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org