Opened 12 years ago

Closed 11 years ago

#2628 closed enhancement (fixed)

Literate notebook

Reported by: dunfield Owned by: mhansen
Priority: major Milestone: sage-3.3
Component: notebook Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

A key advantage of notebook interfaces over the command-line is that they can allow for literate programming, that is, interspersing of formated text and code. Literate programming allows the user to explore their ideas both in theory and code simultaneously, and is particularly useful in mathematics were writing comments in pure ASCII is cumbersome and distracting. Moreover, literate notebooks can be used as record of a computation (e.g. as the basis for an appendix to a paper), as an interactive tutorial for Sage, or for education (e.g. a calculus notebook using the "interact" feature to explore quadric surfaces). Both Mathematica and Maple have extensive literate programming features.

A simple way to provide this in Sage would be to have input cells of type "%latex" and "%html" behave as follows.

1) After (successfully) evaluating such a cell, the input would be hidden and only the output would be shown. This output would be shifted to the left compared to where it is now so that the Sage input/output is indented relative to the text.

2) To edit, the user would (double?) click on the output and the input box would reappear.

See the attached files for an example worksheet with mock-up of output.

Overlap with SageTeX:

Dan Drake's excellent SageTeX also provides literate programming for Sage. In practice, this is rather different than what is proposed here. In particular, SageTeX is awkward to use to write Sage code in compared to the notebook because because of the multi-step (latex/sage/latex) process. The strength of SageTeX is the quality of the final output and the fact that you have the whole of LaTeX to work with. It would be nice if the notebook was able to export a SageTeX file. (cf. Ticket #66)

Attachments (2)

literate_notebook.png (91.8 KB) - added by dunfield 12 years ago.
Mockup
notebook.txt (711 bytes) - added by dunfield 12 years ago.
"Source" for mockup

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by dunfield

Mockup

Changed 12 years ago by dunfield

"Source" for mockup

comment:1 Changed 12 years ago by gfurnish

  • Milestone set to sage-2.11

comment:2 Changed 11 years ago by dunfield

In a sage-dev thread where folks also requested this feature, William pointed out the following work-around:

Have you ever tried clicking the blue edit button in the upper right side of the screen? It gives you a plain text representation of the worksheet. You can enter arbitrary HTML between the cells (the {{{ }}}), and it appears looking more professional when you click the "Save and Use" button. In fact, internally all the text between subsequent {{{ }}} compute cells *is* a TextCell. There is also one bonus -- if you put math in $'s or $$'s, it will get typeset as mathematics.

comment:3 Changed 11 years ago by mhansen

I think this can probably be closed since TinyMCE (at #4705) was added.

comment:4 Changed 11 years ago by mhansen

  • Owner changed from boothby to mhansen
  • Status changed from new to assigned

comment:5 Changed 11 years ago by mhansen

  • Milestone changed from sage-3.4.1 to sage-3.3
  • Resolution set to fixed
  • Status changed from assigned to closed

I put a link on #66 back to this ticket. I think we can close this now as being fixed by TinyMCE.

Note: See TracTickets for help on using tickets.