Sometimes I have to put text on a path
Showing posts with label Literate programming. Show all posts
Showing posts with label Literate programming. Show all posts

Friday, July 8, 2011

All about "How to post mathematics?" mathML, LaTeX, MathJax with Chrome/Firefox and Best online/offline rich text editors (webmail, word processor); Comparison of off-line on-line HTML/text editors and browsers.

outline:
1-----free and multi-platform HTML editors
2-----Rich text/html editors inside blogger, Gmail, Knol, wordpress.com, webmail...
3-----Web-based word processor
4---- Two commercial applications & free equation editors
5-----Browsers and MATHML viewers
6-----Free javascript library for math on web pages: JavaScript display engine for mathematics that works in all browsers.
 

7-----Some interesting links 


8-----Inserting Characters (unicode, Math Font Styles)



How to post mathematics or web applications with mathematica and matlab, see :
http://ex-ample.blogspot.com/2011/06/web20-services-mathematica-and-matlab.html

How to post mathematics in wikipedia or in MediaWiki? , see:
http://ex-ample.blogspot.com/2011/07/mediawiki-api.html
An "ex-ample" : the online  NIST Digital Library of Mathematical Functions {Abramowitz and Stegun’s (1964) Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables}.
http://ex-ample.blogspot.com/2011/07/best-ex-ample-nist-digital-library-of.html

read this article (@1999, updated 2002) :
Approaches to WWW Mathematics Documents
http://hutchinson.belmont.ma.us/tth/webmath.html
------------------
preface:
ex-ample1 (mathML3): http://ex-ample.blogspot.com/2011/07/mathml3-sample.html
(this example comes from https://eyeasme.com/Joe/MathML/HTML5_MathML_browser_test.html
but this URL does not work with Chrome 14+STIX font+MathJax but works with firefox; MathML code without return must be included in HTML code of a post).

ex-ample2 (mathML2): http://www.w3.org/Math/testsuite/mml2-testsuite/TortureTests/Complexity/complex1.xml

ex-ample3: this blog (left sidebar and matML latex labels):
http://ex-ample.blogspot.com/2011/07/symbols-tex-1.html

Math ML(Mathematical Markup Language)  is an XML language designed to present complex equations:
http://en.wikipedia.org/wiki/MathML
http://www.w3.org/Math/
http://www.personal.psu.edu/ejp10/blogs/tlt/tutorials/mathml.html

Wikipedia uses LaTeX (and limited MathML).
 MS Office 2007 and OpenOffice.org (via OpenOffice.org Math: http://en.wikipedia.org/wiki/OpenOffice.org_Math), as well as mathematical software products such as Mathematica supports MathML.
Knol use LaTeX:
http://knol.google.com/k/stef42-ex-ample-blogger-com/mathematics-and-web-html5-latex-mathml/2fdyfc9mft4ir/1?hd=ns# 

MathML 3.0 was officially released as a W3C Recommendation (@Oct 2010). It is backward compatible with MathML 2.
MathML deals not only with the presentation but also the meaning of formula components (the latter part of MathML is known as “Content MathML”). Because the meaning of the equation is preserved separate from the presentation, how the content is communicated can be left up to the user.
If you work in science you probably know LaTeX. LaTeX is gorgeous; enabling scientific authoring in an unrivaled way. Nevertheless, LaTeX is somewhat outdated. It doesn't support the clear separation between content and style that modern standards imply. Editing complex equations can become a tedious job. An alternative might be the combination of DocBook with MathML.
DocBook is an XML language (http://en.wikipedia.org/wiki/DocBook). It's a semantic markup language for technical documentation (http://www.docbook.org/tdg/). It was originally intended for writing technical documents related to computer hardware and software but it can be used for any other sort of documentation.
As a semantic language, a DocBook document does not describe what their contents "look like," but rather the meaning of those contents. For example, rather than explaining how the abstract for an article might be visually formatted, DocBook simply says that a particular section is an abstract. It is up to an external processing tool or application to decide where on a page the abstract should go and what it should look like. And, indeed, to decide whether or not it should be included in the final output at all. It provides a vast number of semantic element tags. They are divided into three broad categories: structural, block-level, and inline. Because DocBook is an XML format, conforming to a well-defined schema, documents can be validated and processed using any tool or programming language which includes XML support.
The current version is DocBook, 5.0.DocBook 4.x documents are not compatible with DocBook 5, but they can be converted into DocBook 5 documents through the use of an XSLT stylesheet.
Source: http://sourceforge.net/projects/docbook/
A group of XSLT stylesheets for transforming DocBook into various viewable formats: http://en.wikipedia.org/wiki/DocBook_XSL

This post is focused on "how to publish mathematics" not on "document languages", beyond of the scope. And then we focused on these languages : 
  • "your screen image": browser rendering engine and javascript rendering engine (in this blog the javascript library MathJax), 
  • HTML, HTML5, CSS... (quality of the code source of the page)
  • MathML (quality of the code source of the page), 
  • laTeX (quality of the code source of the page).
------------------------------------------------------------------------------------
MathML is too verbose to edit using a text editor then we need a MathML editor.

Comparison of HTML editor (stand alone); 
http://en.wikipedia.org/wiki/List_of_HTML_editors
List of math editors:
http://www.w3.org/Math/Software/mathml_software_cat_editors.html

Comparison of open source and commercial WYSIWYG web-based editors (by replacing a textarea or by adding their own editable block): 
http://geniisoft.com/showcase.nsf/WebEditors). 



Some packages and Mathematics environments (also some corrections of bad rendering):
If your document requires only a few simple mathematical formulas,  LaTeX has most of the tools that you will need. If you are writing a scientific document that contains numerous complicated formulas, the amsmath package introduces several new commands that are more powerful and flexible than the ones provided by LaTeX. The mathtools package fixes some amsmath quirks and adds some useful settings, symbols, and environments to amsmath.


Sunday, October 11, 2009

Literate Programming is a system of programming pioneered by Donald Knuth that allows one to break programs into small chunks. Each chunk should be short enough (say less than ten lines of code) can be completely and clearly documented (html).

Literate Programming is a system of programming pioneered by Donald Knuth that allows one to break programs into small chunks. Each chunk should be short enough (say less than ten lines of code) can be completely and clearly documented. These chunks are assembled into a file and then run through a preprocessor to get either a documentation file (suitable for typesetting) or a just straight code.

A bunch of literate programming solutions exist, since there seems to be more interest in writing new literate programming systems than in actually using them. Everyone seems to have an opinion. Knuth’s ideas are set forth in an interview, a book, and published programs like the Stanford Graphbase. In my opinion only two systems are worth considering: noweband cweb.

noweb


noweb is an extensible system intended for a Unix environment written by Norman Ramsey. It is language independent and allows the creation of HTML documentation files automatically. Most people now use noweb. I really like the fact that chunks are numbered by page and then alphabetically by location on the page: “10c” refers to the third chunk on page 10.

I don’t use noweb because porting it to the Macintosh was hopeless. It is written in Icon and C. In fact, I was unable to get the existing noweb port for the Mac to work.

cweb


The philosophy behind CWEB is that programmers who want to provide the best possible documentation for their programs need two things simultaneously: a language like TeX for formatting, and a language like C for programming. Neither type of language can provide the best documentation by itself. But when both are appropriately combined, we obtain a system that is much more useful than either language separately. [Taken from the CWEB-3.0 User's Manual.] There are at least three variants of cweb available.

cweb
The original, canonical cweb by Donald E. Knuth and Silvio Levy. The cweb system consists a manual and the programs ctangle and cweave. No development is planned, but it is supported and bugs will still be fixed. It works and I use it.
cwebx
cweb was a translation of the original web system for Pascal. Something was lost in the translation. Marc van Leeuwen decided to rewrite it and add some rational features.
ctwill
ctwill was hacked by Donald Knuth and is an extension of cweave. It allows mini-indicies on every two page spread. This is great because every variable that is not defined on a two page spread is indexed and the relevant reference is available. It produces great documentation, at the cost of being a pain in the neck.
All this stuff is available your local TeX archive.

http://www.bme.ogi.edu/~prahl/

http://omlc.ogi.edu/software/lp/

Thursday, October 8, 2009

mesh generation, literate programming, matlab; mathematica; persson

http://library.wolfram.com/infocenter/MathSource/5475/

This Mathematica notebook is an effort to transcribe the MATLAB code of a 2-D mesh generation algorithm as described explicitly in Persson and Strang's paper [1]. The goal is to make the algorithm executable in Mathematica so that its users can also experiment with the algorithm.

Since the algorithm was expressed very clearly from their original paper [1] including the MATLAB code, which is a perfect example of literate programming in MATLAB, it is pretty easy to translate the MATLAB code "literally" into Mathematica. Such translation is virtually always possible in either direction even without human interference. And such a Rosetta Stone kind of translation might be useful if one species of people coding in either MATLAB or Mathematica were to disappear, future generations would still be able to rediscover one programming language by reading its interpretation in the other one.

However, it is so tempting to present the literate programming capability of Mathematica by following its general principles; that is, (a) documentation mingles with code and both get pretty-printed; (b) shuffle code pieces for human readability. I decided to transcribe the code manually.

The original MATLAB code was documented as 8 steps (sections) in sequential order, which is easy to follow because the ideas behind the code were explained beforehand in early parts of the paper. So it is recommended that you read part 1 and 2 of the original paper. Instead of following the MATLAB code literally in 8 steps, this notebook breaks the code pieces apart and examines each of them separately.

Tuesday, May 20, 2008

Literate programming _Donald Knuth


Literate programming _Prahl



Literate Programming is a system of programming pioneered by Donald Knuth that allows one to break programs into small chunks. Each chunk should be short enough (say less than ten lines of code) can be completely and clearly documented. These chunks are assembled into a file and then run through a preprocessor to get either a documentation file (suitable for typesetting) or a just straight code.A bunch of literate programming solutions exist, since there seems to be more interest in writing new literate programming systems than in actually using them. Everyone seems to have an opinion. Knuth’s ideas are set forth in an interview, a book, and published programs like the Stanford Graphbase. In my opinion only two systems are worth considering: noweb and cweb.

noweb


noweb is an extensible system intended for a Unix environment written by Norman Ramsey. It is language independent and allows the creation of HTML documentation files automatically. Most people now use noweb. I really like the fact that chunks are numbered by page and then alphabetically by location on the page: “10c” refers to the third chunk on page 10.

I don’t use noweb because porting it to the Macintosh was hopeless. It is written in Icon and C. In fact, I was unable to get the existing noweb port for the Mac to work.

cweb


The philosophy behind CWEB is that programmers who want to provide the best possible documentation for their programs need two things simultaneously: a language like TeX for formatting, and a language like C for programming. Neither type of language can provide the best documentation by itself. But when both are appropriately combined, we obtain a system that is much more useful than either language separately. [Taken from the CWEB-3.0 User's Manual.] There are at least three variants of cweb available.

cweb
The original, canonical cweb by Donald E. Knuth and Silvio Levy. The cweb system consists a manual and the programs ctangle and cweave. No development is planned, but it is supported and bugs will still be fixed. It works and I use it.
cwebx
cweb was a translation of the original web system for Pascal. Something was lost in the translation. Marc van Leeuwen decided to rewrite it and add some rational features.
ctwill
ctwill was hacked by Donald Knuth and is an extension of cweave. It allows mini-indicies on every two page spread. This is great because every variable that is not defined on a two page spread is indexed and the relevant reference is available. It produces great documentation, at the cost of being a pain in the neck.
All this stuff is available your local TeX archive.

http://www.bme.ogi.edu/~prahl/

http://omlc.ogi.edu/software/lp/