When ReSTifying the documentation, my understanding is that the tag
.. MATH:: <put your LaTeX here>
would render whatever is in
<put your LaTeX here>
as LaTeX. That's OK, I can see that the LaTeX is rendered and shows up in the PDF version of the standard documentation (reference manual, tutorial, etc.). The problem is that in Sage 4.1, that tag doesn't render properly, if at all, in the HTML version of the documentation. For example, here is a link to a screenshot of a page in the reference manual in Sage 4.0.2:
Minh Nguyen wrote: > as LaTeX. That's OK, I can see that the LaTeX is rendered and shows up > in the PDF version of the standard documentation (reference manual, > tutorial, etc.). The problem is that in Sage 4.1, that tag doesn't > render properly, if at all, in the HTML version of the documentation. > For example, here is a link to a screenshot of a page in the reference > manual in Sage 4.0.2:
On Sun, Jul 12, 2009 at 2:37 AM, Pat LeSmithe<qed...@gmail.com> wrote:
<SNIP>
> Apparently, the jsMath library hides all display equations, even if they > are images.
I find this funny: I can view the rendered equations. It's just that I have to refresh my browser every second. Even at that rate, the equation would only be displayed for a fraction of a second :-)
Minh Nguyen wrote: > On Sun, Jul 12, 2009 at 2:37 AM, Pat LeSmithe<qed...@gmail.com> wrote:
> <SNIP>
>> Apparently, the jsMath library hides all display equations, even if they >> are images.
> I find this funny: I can view the rendered equations. It's just that I > have to refresh my browser every second. Even at that rate, the > equation would only be displayed for a fraction of a second :-)
Currently, an <img class="math" ...> displays the image, but an image inside of a <div class="math"> is deleted.
The relevant HTML is:
<p>Let <img class="math" src="../../_images/math/423e6d866fb7dea1490a6d84e9bd08e524a8ae74.png" alt="L = (a_1, a_2, a_3, \dots, a_n)" /> be a non-empty sequence of non-negative integers. Then <img class="math" src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" alt="L" /> is said to be super-increasing if each <img class="math" src="../../_images/math/412787c048e28774dc63fc27db42dc52ca858de7.png" alt="a_i" /> is strictly greater than the sum of all previous values. That is, for each <img class="math" src="../../_images/math/5104cf5e4b0a4dac3d89d924244871821acf1d22.png" alt="a_i \in L" /> the sequence <img class="math" src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" alt="L" /> must satisfy the property</p>
<p>in order to be called a super-increasing sequence, where <img class="math" src="../../_images/math/71b363cfed7a38259d24cb0ac71c239743efffe5.png" alt="|L| \geq 2" />. If <img class="math" src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" alt="L" /> has only one element, it is also defined to be a super-increasing sequence.</p>
(I just noticed that the </div> and </p> tags are in the wrong order for the <div class="math">; maybe that is part of the problem?)
Apparently, this is representative of what is now the standard python documentation program output (so this is probably a wider concern than just the Sage project). Is there an easy way to make jsmath look at the alt text of images as the latex source that should be there? Ideally, there would be a switch somewhere, maybe on the jsmath control panel, that would tell jsmath to either leave the images alone, or to extract and format the alt text and hide the image.
Jason Grout wrote:
> Minh Nguyen wrote:
>> On Sun, Jul 12, 2009 at 2:37 AM, Pat LeSmithe<qed...@gmail.com> wrote:
>> <SNIP>
>>> Apparently, the jsMath library hides all display equations, even if they
>>> are images.
>> I find this funny: I can view the rendered equations. It's just that I
>> have to refresh my browser every second. Even at that rate, the
>> equation would only be displayed for a fraction of a second :-)
Davide sent me this extremely helpful reply. Does anyone want to take this up as a small, but very helpful project?
Jason:
Here's what's going on: jsMath looks for DIV's and SPAN's that are marked by CLASS="math" and treats their contents as TeX source code to process. It replaces the original contents of the DIV or SPAN with the typeset version of the TeX code. Because the image's are not DIV's or SPAN's jsMath ignores them (even though they are CLASS="math"), but the <DIV CLASS="math"> that contains an image is processed by jsMath. It takes the text content of the DIV (empty in this case) and typesets it (the result is blank). Thus the image disappears and is replaced by nothing.
There are a couple of possible solutions: 1) have the python program produce a class other than "math" for its output; 2) have jsMath look for something other than class="math" for its trigger; 3) use a preprocessor (in javascript) to modify the class of the DIV's that python produces so jsMath won't modify them. It would need to run before jsMath.js.
I suspect 3 is the best solution. You mention that you would like jsMath to process the ALT text of the images and replace them by the typeset output. That function could also be folded into the preprocessor in (3) by searching for the images and changing them to SPAN's containing the TeX. This would show up on screen as a change of all the images then the loading of jsMath, which would be visually apparent. You might replace
This would not alter the visual display until jsMath actually processes the SPAN. It should not be that hard to write such a preprocessor. You would load it before loading jsMath (via easy/load.js).
> Currently, an <img class="math" ...> displays the image, but an image > inside of a <div class="math"> is deleted.
> The relevant HTML is:
> <p>Let <img class="math" > src="../../_images/math/423e6d866fb7dea1490a6d84e9bd08e524a8ae74.png" > alt="L = (a_1, a_2, a_3, \dots, a_n)" /> be a non-empty sequence of
> non-negative integers. Then <img class="math" > src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" > alt="L" /> is said to be super-increasing if
> each <img class="math" > src="../../_images/math/412787c048e28774dc63fc27db42dc52ca858de7.png" > alt="a_i" /> is strictly greater than the sum of all previous values.
> That is, for each <img class="math" > src="../../_images/math/5104cf5e4b0a4dac3d89d924244871821acf1d22.png" > alt="a_i \in L" /> the sequence <img class="math" > src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" > alt="L" /> must satisfy the property</p>
> <p>in order to be called a super-increasing sequence, where <img > class="math" > src="../../_images/math/71b363cfed7a38259d24cb0ac71c239743efffe5.png" > alt="|L| \geq 2" />.
> If <img class="math" > src="../../_images/math/859ccf4cd60c7bc6b8fa1afc9a42dc811a826d6f.png" > alt="L" /> has only one element, it is also defined to be a
> super-increasing sequence.</p>
> (I just noticed that the </div> and </p> tags are in the wrong order for > the <div class="math">; maybe that is part of the problem?)
> Apparently, this is representative of what is now the standard python > documentation program output (so this is probably a wider concern than > just the Sage project). Is there an easy way to make jsmath look at the > alt text of images as the latex source that should be there? Ideally, > there would be a switch somewhere, maybe on the jsmath control panel, > that would tell jsmath to either leave the images alone, or to extract > and format the alt text and hide the image.