Forum archive 2000-2006

Steve Zeidner - dvipng align construction

Steve Zeidner - dvipng align construction

by Arnold Pizer -
Number of replies: 0
inactiveTopicdvipng align construction topic started 11/19/2002; 8:25:15 AM
last post 11/21/2002; 9:46:29 AM
userSteve Zeidner - dvipng align construction  blueArrow
11/19/2002; 8:25:15 AM (reads: 1708, responses: 6)
Does dvipng support creation of images using the align construction?

For instance:

begin{align*} int_{-$a1}^{$a1} ($a2-x^2)dx &= $a2 int_{-$a1}^{$a1} dx - int_{-$a1}^{$a1} x^2 dx \\ &= $a2 left( left x right|_{-$a1}^{$a1} right) - left( left frac{x^3}3 right|_{-$a1}^{$a1} right) \\ &= $a2($a1-(-$a1))-left(frac{$a1^3}3-frac{(-$a1)^3}3right) = $ans end{align*}

only displays this text to the screen when using typeset2 mode, but correctly displays an image when using typset mode. I was wondering if this is a bug in dvipng or if it is something wrong with our installation. Other images seem to display correctly using dvipng.

<| Post or View Comments |>

userJohn Jones - Re: dvipng align construction  blueArrow
11/19/2002; 10:30:08 AM (reads: 1961, responses: 2)
As you can see, it currently does not recognize math environments besides basic math mode, \( \), and displayed math \[ \]. This has nothing to do with dvipng itself. Formatted text (tth) will also not render an align environment as math. The source is of this is deeper inside WeBWorK where the decision is made as to what is math and what isn't. I imagine that WeBWorK can be taught to recognize other theorem type environments, although I haven't experimented with this yet. Then, dvipng would render this the way you want it to.

In the short term, if you make the analogous construction using displayed math and an array, dvipng mode will get it right and formatted text will improve (but not get it right).

Mike and Arnie, do you want me to look into having EV3 detect equation type environments?


<| Post or View Comments |>

userSteve Zeidner - Re: dvipng align construction  blueArrow
11/20/2002; 7:08:43 AM (reads: 2241, responses: 0)
I forgot to cut and paste the [ ] around this equation. Sorry about that. Those were there when I originally tried to display this problem, but it still did not render the image. You're saying that this should display correctly in displayed math mode, right? So, most likely this is something wrong with our installation of dvipng? Is there anything in the configuration that would cause it not to create the image?

<| Post or View Comments |>

userJohn Jones - Re: dvipng align construction  blueArrow
11/20/2002; 7:31:30 AM (reads: 1940, responses: 1)
Actually, not having the \[ \] was correct for align*. It is a LaTeX error to put an align* environment inside displayed math. On the other hand, there is the aligned environment, which can go inside displayed math:
\int_{-$a1}^{$a1} ($a2-x^2)dx
&= $a2 \int_{-$a1}^{$a1} dx - \int_{-$a1}^{$a1} x^2 dx \\
&= $a2 \left( \left x \right|_{-$a1}^{$a1} \right)
- \left( \left \frac{x^3}3 \right|_{-$a1}^{$a1} \right) \\
&= $a2($a1-(-$a1))-\left(\frac{$a1^3}3-\frac{(-$a1)^3}3right) = $ans


<| Post or View Comments |>

userSteve Zeidner - Re: dvipng align construction  blueArrow
11/21/2002; 4:09:43 AM (reads: 2238, responses: 0)
Thank you very much for your help!


<| Post or View Comments |>

userMichael Gage - Re: dvipng align construction  blueArrow
11/21/2002; 7:18:21 AM (reads: 2197, responses: 0)
Hi John,

Your analysis is exactly right. EV3() only passes the contents of \( \) and \[ \] along to tth or dvipng. I'd be happy to have you extend this capability. You may want to simplify the scanning operation used by EV3 during the rewrite. EV3 has not been changed much over the last 4years.

I suggest the following, as away of making these changes, and testing them, without undo effort in constructing new infrastructure.

While developing, first copy EV3 and it's subroutines and rename it EV4() Now make changes in EV4().

You can test with problems that use


some text here ...............


(In fact BEGIN_TEXT is simply expanded to be TEXT(EV3(<<'END_TEXT')); in the current WeBWorK rendering process.)

Once you have EV4 working to your satisfaction we will make a single change in PGtranslator which changes the way BEGIN_TEXT is expanded, namely to use EV4 instead of EV3.

Most problems will still be useable in the new scheme. If someone wants to write a problem for some reason that uses EV3 you can still do so, although you will have to use the explicit call instead of the BEGIN_TEXT short cut.

Incidently this is why EV2 is still around. Four or more years ago we went from evaluating scalars before evaluating perl functions (EV2 mode) to evaluating the perl functions first, then evaluating the scalars (EV3 mode). This corresponds more closely to what people intuitively expect, although in most problems it doesn't make a difference. Every now and then (but rarely) one wants the EV2 order of evaluation.

Thanks for offering to look at EV3, John. Let us know if we can help in building EV4.

Take care,


<| Post or View Comments |>

userJohn Jones - Re: dvipng align construction  blueArrow
11/21/2002; 9:46:29 AM (reads: 1930, responses: 0)
Hi Mike,

OK, I will take a look at it in terms of using EV4; that sounds like it is definitely the way to proceed.


<| Post or View Comments |>