Account Options

  1. Sign in
Google Groups Home
« Groups Home
ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Minh Nguyen  
View profile  
 More options Jul 11 2009, 8:12 am
From: Minh Nguyen <nguyenmi...@gmail.com>
Date: Sat, 11 Jul 2009 22:12:11 +1000
Local: Sat, Jul 11 2009 8:12 am
Subject: ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML
Hi folks,

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:

http://sage.math.washington.edu/home/mvngu/patch/sage-ref-4.0.2.png

And here is a screenshot of the same page in Sage 4.1:

http://sage.math.washington.edu/home/mvngu/patch/sage-ref-4.1.png

This problem might be due to ticket #5799

http://trac.sagemath.org/sage_trac/ticket/5799

Can someone confirm this?

--
Regards
Minh Van Nguyen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat LeSmithe  
View profile  
 More options Jul 11 2009, 12:37 pm
From: Pat LeSmithe <qed...@gmail.com>
Date: Sat, 11 Jul 2009 09:37:30 -0700
Local: Sat, Jul 11 2009 12:37 pm
Subject: Re: [sage-devel] ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML

Apparently, the jsMath library hides all display equations, even if they
are images.  There's a patch at

http://trac.sagemath.org/sage_trac/ticket/6512


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Minh Nguyen  
View profile  
 More options Jul 11 2009, 12:52 pm
From: Minh Nguyen <nguyenmi...@gmail.com>
Date: Sun, 12 Jul 2009 02:52:40 +1000
Local: Sat, Jul 11 2009 12:52 pm
Subject: Re: [sage-devel] Re: ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML

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 :-)

Thanks for looking into the problem.

--
Regards
Minh Van Nguyen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Grout  
View profile  
 More options Jul 11 2009, 1:29 pm
From: Jason Grout <jason-s...@creativetrax.com>
Date: Sat, 11 Jul 2009 10:29:38 -0700
Local: Sat, Jul 11 2009 1:29 pm
Subject: Re: ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML

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,

You can see this happening at
http://sagemath.org/doc/reference/sage/numerical/knapsack.html (search
for the text "must satisfy the property")

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>

<div class="math">
<p><img
src="../../_images/math/db83da90af912a511752f6af9626076764786f3b.png"
alt="a_i &gt; \sum_{k=1}^{i-1} a_k" />
</div></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.

Thanks,

Jason


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Grout  
View profile  
 More options Jul 13 2009, 9:42 pm
From: Jason Grout <jason-s...@creativetrax.com>
Date: Mon, 13 Jul 2009 18:42:52 -0700
Local: Mon, Jul 13 2009 9:42 pm
Subject: Re: ReST in Sage 4.1: using .. MATH:: doesn't render LaTeX in HTML

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

     <IMG CLASS="math" ... ALT="tex-code">

by

     <SPAN CLASS="math"><IMG ...><SPAN
STYLE="display:none">tex-code</SPAN></SPAN>

and

     <DIV CLASS="math">
     <p><IMG ... ALT="tex-code">
     </DIV>

by

     <DIV CLASS="math">
     <p><IMG ...>
     <SPAN STYLE="display:none">tex-code</SPAN>
     </DIV>

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).

Davide


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »