Advanced functions in Cuckoo |
To create a horizontal rule (<hr/>) in the HTML page, create an empty paragraph in Horizontal style like this:
The <pre> element preserves the text format. Within a <pre> element all characters are interpreted literally and retained in display, including multiple spaces, tabs, carriage returns and linefeeds.
You can use two Word styles to create <pre> elements:
Cuckoo 0.0.5 and above support characters and styles used in Mathematics and Chemistry.
It leverages on Word and browser capabilities.
Mathematics and Greek support in Word 97/2000
Subscript and Superscript
In Mathematics you often need to write things such as x2.
In Chemistry you often need to write things such as H2O.
Cuckoo leverages on Word Superscript and Subscript to display smaller characters above or below the normal characters.
If you don’t yet have configured Word with Superscript and Subscript here is how to do it.
Open up the Tools... Customize menu and choose the All Commands category:
Scroll down to find the Subscript and Superscript options. Then click the desired option and drag it on the toolbar. Your toolbar should now contain x2 and x2:
Now if you want to write x2 type x as usual, click on x2 button, type 2 and click again on x2 to revert to normal mode.
Normally you don’t need to configure Word because Subscript and Superscript are already saved in cuckoo.dot.
The Equation Editor comes with Microsoft Office or Works (including OEM editions). However it is not installed under a standard installation. Therefore you need to retrieve your installation CDROM and do a custom installation. Once the Equation Editor is installed, just follow the same procedure as for Superscript and Subscript:
You can learn how to use the Equation Editor on spot.pcc.edu/academ/math/faculty/simonds/handouts/equation/ and on
When Cuckoo finds an Equation in the document it generates a small .gif image and a <img> element.
A Font named Symbol supports Mathematical symbols and Greek characters in Word.
If you type 'a' with the Symbol font a a is displayed.
The Symbol font is the same as the Symbol font of browsers. You can find the codes of Greek and Mathematical characters here. However in Word Symbol characters are stored on two bytes, for instance F022 or -4074 for ".
Support of Greek and Mathematical characters is buggy. There is a gap between what should be supported and what really works and there are problems on browsers as well as in Word.
HTML 4.0 uses Unicode as its base character set and we should be able for instance to display " with ∀. Furthermore named entities were defined and we should be able to use ∀, arguably easier to remember.
Before HTML 4.0 the only solution was to use the Symbol font. We could code " with
<font face="Symbol">"</font> where 34 is 22 in decimal.
The math browser page shows how well your browser supports HTML 4 and Symbol font.
The table below summarizes the situation:
To summarize it is impossible to display symbols and Greek characters on all browsers without checking the browser type.
Whatever symbol you choose, Word Insert Symbol inserts x0028 or '(' in the document. Ok the character code is stored somewhere else (it is displayed!) but impossible to retrieve with VBA. Therefore we created a Word document containing all supported characters.
Download and inflate this file. Then Copy | Paste Mathematical symbols from this file to your document.
For Greek characters, it is faster to type the Latin equivalent. You can easily remember that a a is an a, a b is a b and so on.
Browsers support UTF-8 (not so well in case of Netscape 4.7) with good reasons because it is a compact format where characters are represented on a minimal number of bytes. UTF-8 is the Unicode Transformation Format that serializes a Unicode code point as a sequence of one to four bytes. Here is the transformation table:
There are other representations of Unicode characters. The most important is UTF-16/UCS-2, which is supported by Windows API and by programs such as NotePad. It uses 16 bits to code 63K. It can use 2 x 16 bits to represent 1M characters. UCS stands for Universal Multiple-Octet Coded Character Set and is defined by ISO 10646.
For more information read the Unicode standard.
We can also represent Unicode characters in a 8-bit ASCII file using entity codes – code starting with &#, for instance ∀. For more information you can look at http://www.bbsinc.com/iso8859.html and at the RFC 2070. However in the entity codes, characters are coded in UCS-2. A great source of information is A tutorial on character code issues by Jukka Korpela.
cuckoo.dot processes characters written with the Symbol font.
If the character is a character listed in the Math browser page and in the Word document, it converts it into the equivalent Unicode numbered entity, for instance ∀ for ". Otherwise it copies the ASCII value of the character:
cuckoo.dot also identifies Subscript and Superscript and wraps the character(s) in a <span> element.
cuckoo.dot generates XML and HTML 4 files appropriate for a display in Netscape 6, Mozilla 0.9.6 and Opera 6.
These files will not display all Greek characters and Mathematical symbol on other browsers.
math-gen.js is a WSH script that makes two things:
math-gen.js is designed to process HTML files generated by cuckoo-gen.js.
UTF16to8 is a small utility that converts Unicode numbered entities into UTF-8.
Run UTF16to8 for HTML 4 files (Netscape 6, Mozilla, Opera 6 and IE 6 with the proper font installed), therefore not to files processed by math-gen.js.
The implementation is quite simple:
The use of UTF16to8 is optional. However, if your pages are written in non-Latin languages, UTF16to8 at least divides the page size by two. Yours pages are also easier to read.
We defined a MathGreek Word style with the Symbol font.
We also defined a MathGreek CSS class:
You don’t need to use MathGreek because Cuckoo tests the font.
However if you define another style with the Symbol font, you must also define a CSS class with a Symbol font-family.
Click on math-verif.html to see the different advanced functions of Cuckoo.