<< Chapter < Page Chapter >> Page >

Assigning key combination

Step 7 : Press “Assign” button and then “Close” button. Macro recording has started. A pair of buttons are displayed on the margin of the document as shown in the figure below. One of the button is “Stop” button, while the other is “Pause” button for macro recording.

Recording code lines

Now, looking at the code lines written in step 3, type exactly the same after one or two lines. Do not bother for key and cursor movements. It is advisable that we maintain the required indenting say between “mfrac” tag and “mi” tag. When the code lines have been reproduced, press “Stop” button to stop the recording.

Step 8 : You are now ready to use the macro. Hold “Alt” key and simulataneously press “F” key. The code lines as recorded are reproduced instantly as shown here :

<m:mfrac> <m:mi> x </m:mi> <m:mi> y </m:mi> </m:mfrac>

Macro recording is a powerful tool to reproduce a set of code lines. However, this facility is available in the normal document mode and not in the plane text mode. As such, codes are required to be first written in a document file, say “test.doc”. Once coding is complete in a major way, we need to save the file in plane text with Unicode character format (UTF -8) for renderer to display the content. It is implied here that a repository of macros corresponding to the basic forms of element encoding be prepared in advance in order to use the same, when required.

In the following section, we shall illustrate the use of macros and few improvisations to encode “Cauchy-Schwarz” inequality.

“cauchy-schwarz” inequality

Understanding of the underlying presentation framework of MathML is just one aspect of learning process. Equally important aspect is to develop the ability to convert presentation requirement in terms of codes. There is no universal set of algorithms that would help to successfully translate visual presentation requirement into MathML code lines in a mechanical manner - unless aided by specialized program or software. Unaided, this may be achieved by developing ability to visualize the presentation requirements in some logical modular work pieces like :

  • Break the presentation requirement in smaller components
  • Write building blocks of code with the help of macros
  • Copy and paste identical components and modify
  • Combine the code lines to make a “whole”

“Cauchy-Schwarz” inequality is shown here :

( k = 1 n a k b k ) 2 ( k = 1 n a k 2 ) ( k = 1 n b k 2 )

A visual inspection of the formula suggests that this inequality is built of three large blocks of similar composition. The first block is raised to apower of “2”. This can be implemented with “msup” element. Thus, we start with using macro for “msup” element :

<m:msup> <m:mi> x </m:mi> <m:mi> y </m:mi> </m:msup>

The superscript is changed to “2” as required. A code line for element “mo” is written using macro for “mo” element and its content is changed to parenthesis :

<m:math display="block"> <m:mo> ( </m:mo> <m:msup> <m:mi> x </m:mi> <m:mn> 2 </m:mn> </m:msup> </m:math>

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A primer in mathml. OpenStax CNX. Apr 19, 2006 Download for free at http://cnx.org/content/col10345/1.16
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A primer in mathml' conversation and receive update notifications?

Ask