Ticket #7326 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

html.table should automatically typeset math inside of strings

Reported by: jason Owned by: cwitty
Priority: major Milestone: sage-4.2.1
Component: misc Keywords:
Cc: whuss, rbeezer, kcrisman Work issues:
Report Upstream: Reviewers: Wilfried Huss
Authors: Jason Grout Merged in: sage-4.2.1.alpha0
Dependencies: Stopgaps:

Description

It would be *really* nice if you could include latex code in a table, like this:

var('t')
density=t^2
html.table([
["Density $\delta(x,y)$", density]
])

and have it do the jsmath magic on the $\delta(x,y)$ part.

Attachments

trac-7326-html-table-math.patch Download (2.3 KB) - added by jason 4 years ago.

Change History

comment:1 Changed 4 years ago by jason

  • Cc whuss added
  • Type changed from defect to enhancement

comment:2 follow-up: ↓ 4 Changed 4 years ago by whuss

As a workaround this already works:

var('t')
density=t^2
html.table([
['Density <span class="math">\delta(x,y)</span>', density]
])

I am not sure why jsmath does not pick up the $$s in this case.

Changed 4 years ago by jason

comment:3 follow-up: ↓ 5 Changed 4 years ago by jason

  • Cc rbeezer, kcrisman added
  • Status changed from new to needs_review
  • Summary changed from html.table should run jsmath on the resulting table to html.table should automatically typeset math inside of strings

This is a very easy patch to review.

comment:4 in reply to: ↑ 2 Changed 4 years ago by jason

Replying to whuss:

As a workaround this already works:

var('t')
density=t^2
html.table([
['Density <span class="math">\delta(x,y)</span>', density]
])

so does html.table(sage.misc.html.math_parse('hi $x^2$')?)

Maybe what is going on is jsmath seems to be not set up to try to find dollar signs, but to only pay attention to class="math" spans and divs.

comment:5 in reply to: ↑ 3 Changed 4 years ago by whuss

  • Status changed from needs_review to positive_review

Replying to jason:

This is a very easy patch to review.

It works, and passes the tests. Positiv review.

comment:6 Changed 4 years ago by mhansen

  • Status changed from positive_review to closed
  • Reviewers set to Wilfried Huss
  • Resolution set to fixed
  • Merged in set to sage-4.2.1.alpha0
  • Authors set to Jason Grout
Note: See TracTickets for help on using tickets.