]>
I would be happy to hear from you if you have problems, so I can improve this tutorial.
Gemse is inspired by the texteditor Vim. It is difficult to learn, but hopefully will be a powerful tool once it is finished. However, I am sure you will master it, if you want to.
You won't need any knowledge about vim for this tutorial. But you will need knowledge about Presentation MathML. How you can edit Content MathML and OpenMath is discussed as well in this tutorial, but you may skip the corresponding sections if your are unfamiliar with them. Gemse's documentation contains a short introduction to presentation MathML. Additionally, you can find tutorials and the specification of MathML on the MathML page of the w3c. Information on OpenMath can be found on the OpenMath website. Of course learning presentation MathML requires learning the fundamentals of XML. Gemse directly edits the XML structure of presentation MathML.
Gemse 1 is an application written in Javascript using Mozilla. So, if you have installed Firefox, you are already lucky. If you do not like the idea of installing Firefox, you can use XULRunner. Please refer to the base documentation to find out how to install and run Gemse.
There is an input box at the very bottom. The cursor should be placed there automatically. If not, do that manually, for example by clicking in the box. Now you can start typing commands. As soon as you have entered a complete command, it will be executed and the box will be cleared. If you have typed something wrong, you can clear the box manually by hitting the escape key.
Let's try it: Enter :help&enter; (&enter; means that you have to hit the enter key.) This opens the index of Gemse's help sites in a new window or a new tab. Close it to get back to the editor. Observe that the input box is empty at this point. If you have made a typo, hit &esc; (that is, hit the escape key.) to clear the input box and try again.
There are a couple of example equations included in the documentation of Gemse. We will use some of them. You will now learn how to load them.
Basically loading works like this: You enter :load followed
by a space and the URI of the file you want to load. Finally, you hit
enter. Yes, you have to enter the URI. This allows you to load any
file from the web you can access. Of course, files on your computer
can be loaded like that too. Their URIs begin with
file://
. So, for example, in order to load the file
/home/john/foo.xml
you have to use the URI
file:///home/john/foo.xml
and in this case, the command is
:load file:///home/john/foo.xml&enter;. You can also use
a relative URI.
In this tutorial, when I tell you to load a file
examples/foo.xml
, you have to do that like this: If you use
Gemse as Firefox extension or as XULRunner application, type
:load chrome://gemse/content/doc/examples/foo.xml&enter;.
If you use the demo on the web or if you opened
editor.xul
in your browser not using a
chrome://
URI, try
:load doc/examples/foo.xml&enter;.
Alternatively, you can just enter :example foo.xml&enter;.
Try it: Load the file examples/pres01.xml
.
You should see something like shown below.
The topmost box contains the rendering of the current equation, whereas the second box from the top shows the MathML tree structure of it. Below the second box, you can see the (a little bit simplified) source of the equation and a table of attributes of the selected element. On the righthand side, you can see a list of all equations that you currently have opened. At the bottom, there is a status line which informs you about the editor's current state. In the following sections you will learn what all this means.
From now on, I will show you only those boxes that I think are important. Actually, these boxes are called views as you will learn in a later section of this tutorial.
The most important thing is the cursor. It highlights an element of
the equation. If you issue a command, it gets applied on the
highlighted element. Currently, the cursor is at the math
element, the topmost element of the equation.
You can move the cursor
around using the keys h, j, k,
l. (Well, I am actually writing what you have to enter. So
J means that you have to press the shift key and the key
with the letter J on it. When I write j you have to press
the key with the J on it, which enters a lower case j.) h
moves the cursor to the left, l moves it to the right. Of
course, the math element does not have an element to the right nor one
to the left. It has no siblings, if you want to express it in XML
terms. k moves the cursor to the parent of the currently
highlighted element. However, the math
element is the
topmost element. Now press j.
The cursor has been moved, but it is difficult to see where exactly. In order to see exactly which element the cursor is on now, look at the tree view in the box below the equation. Press j again.
j moves the cursor to the first child element. Now you
can press l to move the cursor to the next sibling. Now the
mo
element with the =
in it is higlighted.
h moves the cursor to the previous sibling, usually the
element to the left. Now use these command several times to get used
to it.
Observe that h, l do not always mean to
the right
or to the left
respectively. For example, select
the mfrac
element. You can reach it by putting the cursor
over the math
element by using k several times
followed by jjlljl. (Note that I sometimes join commands
that you have to enter one after the other. This for example means that you have
to hit j, then j, then l and so on.)
Now hit j once again. This selects the first child of the
mfrac
element.
In MathML, the first child of an mfrac
element is the
enumerator of the fraction. The second one is its denominator. So
enumerator and denominator are siblings in the XML tree. That means
that you have to use h and l to switch between
the two. j and k do have a different meaning in
this context: k moves to the parent, i.e. the
mfrac
element. j moves to the first element
contained in the enumerator or denominator respectively. Try it. Also
try to find out what happens on the msup
and
munderover
elements.
Now you know how to move around. You also have seen that movements are relative to the XML tree structure, not relative to where something appears in the rendered equation. There are and will be many more commands to move around faster, but what you have seen should suffice for now.
We start with the easy thing. Its deleting. (Who would have thought
that it is something destructive?) If you hit x the
element that is highlighted by the cursor gets removed, including all
its descendants. Move the cursor to the (
after the
exp
and hit x. What you get is
Do the same with the closing bracket )
by
lx. Now you have
Beware: x can be dangerous: Select the denominator of the fraction. Now hit x to delete it. You immediately see that this was not good.
What does cause this? Well, some MathML elements must have a fixed
number of children, in case of mfrac
this number is two.
If an mfrac
element does not have two children, it is
invalid. The MathML renderer no longer understands what is meant by
the mfrac
element and can not render the equation
completely. If something like this happens, you have to look at the
tree view in order to fix the problem, since the rendering of the
equation is incomplete. You can also fix it by undoing your mistake,
as you will learn in the next section.
Of course, Gemse has also undo and redo commands. u undoes your last change. &ctrl;r undoes your last undo. (&ctrl;r means that you have to hold down the control key and hit r. Something like &ctrl;ab&alt;c says that you have to hold control, hit a, releae control, hit b, hold down alt, hit c and releaste alt.) Now hit u. The denominator you just deleted is back.
You can not only undo the last change, you can even undo changes before it. For this hit uu. Now the two brackets you deleted are back too.
If you have undone too many changes, you can reapply them by hitting &ctrl;r. Now, do that twice. The brackets are gone again.
Of course, you can undo again what you have redone, and so on.
Vim provides history information in form of a whole history tree. Gemse only stores changes in a linear fashion. In vim, if you make changes after an undo, the undone change gets remembered. Gemse forgets all undone changes if you make new changes.
Being destructive is fun, but being constructive is even more fun.
Well, to insert something, you have to switch from the edit mode to the insert mode. This can be done with various commands, depending where you want to insert something. a (think: append) calls the insert mode such that it inserts new elements behind the current cursor. If you want to insert before it, you have to use i. The insert mode also has a cursor quite like the edit mode, but it looks different. Well, it doesn't only look different, it has a further very important difference: It lies between two elements, not on an element.
It is important to know that the insert mode of gemse is not yet final and will probably change in the future. Even more, different insert modes can coexist. At the moment, there are two insert modes, the UCD insert mode and the trivial insert mode. While in edit mode, you can switch the insert mode to be used by hitting &tab; (the tabulator key). In this tutorial we will use the UCD insert mode, which is the default. If you want, you can also take a look at the documentation of the trivial insert mode. This mode is called like that because it was trivial to implement, not because it is trivial to use it. Though it is tricky to use it, it is easy to grasp how it works.
But let us concentrate on the UCD insert mode:
Position the cursor over the munderover
element of the
sum sign, like this:
Now hit i. Do you see the cursor? It is right in front
of the sum sign, or more precicely, in front of the
munderover
element.
However, for the moment we let it be. Press &esc;. (Well, here you have to hit the escape key, not E then S then C.) This puts you right back into the edit mode.
What is an infinite sum? Well, it is the limes of partial sums.
Now, let us write it as such. First, let us change the
Press n. The insert mode recognizes n
as a
letter and inserts it as an identifier into the equation. Now close the
insert mode with &esc;.
Now press k in order to put the cursor on the
munderover
element. Now we are going to insert the
limes. Press i.
Well, the current implementations of the insert modes are sometimes
cumbersome. The
main problem (of both insert modes) is that if you want to write
We want to insert an operator
If you make a mistake in the insert mode, you can hit &esc; (maybe twice) to leave the insert mode and then use u and try again.
To do that we need an munder
element. Press
&ctrl;u to tell the insert mode that you want to have such an
element.
You can see it already. When you now continue to insert elements,
they will replace the boxes you can see. Now press &ctrl;o. This
says that you are going to insert an operator. Now insert
lim&enter;. We can not insert lim directly
without indicating explicitely that we enter an operator using
&ctrl;o, because if we did, the insert mode would think
that we want the identifier l
followed by the identifier
i
followed by m
.
Actually, whenever we need an identifier or an operator which is longer than one character or which is treated by the insert mode the wrong way, we have to first hit &ctrl;o for an operator or &ctrl;i for an identifier, then we have to enter the characters and finally terminate with &enter;. Similarly, for numbers you can use &ctrl;n, but normally you do not need to do that, since the UCD insert mode is more clever when it comes to numbers.
Good. Since what we want to write below the limes consists of
multiple elements, we have to insert an mrow
element. Do
that by hitting &space; (denoting the space bar).
Now press n. It is put as an identifier into the
mrow
element. Hit → to get the arrow operator
and finally ∞ for the infinity sign.
Now hit &esc; and we are done.
I think we have done enough to get a break. You do not need to save the equation for this tutorial, since later, you can just load the equation as it is now from a file included in the documentation. But anyway, I want to tell you here how to save an equation to a file.
Important: Gemse will overwrite existing files without moaning. (The author has still not yet taken care of a proper implementation.) If you give the save or load commands a relative URI, then it is considered to be relative to the current working directory, as indicated by firefox. Also be aware, that if you are using gemse not as Firefox extension or XULRunner application, it has no permission to write to your harddisk.
For saving you simply write :save&space;, followed by the URI where you want to save your equation, followed by &enter;. The URI may be a relative one, which then is interpreted as reltive to the current working directory. If the URI points to a remote resource on a HTTP server, Gemse tries to save the file using the PUT method. However, if the URI points to a local file, Gemse will use the filesystem to save it.
So you can write :save example.xml&enter; to save the equation as an XML file in your current working directory. Or use something like :save file:///home/urs/math/example.xml&enter; to give an absolute path. Depending on your operating system, this looks a little bit different.
If you have loaded the equation from a file, Gemse remembers that. In such a case you can use :save&enter; to write it back into this file.
Alternatively, instead of saving to a file, you can also use the command :serialize&enter; which displays the XML source code on the screen.
Let us construct the following formula:
Nothing easier than that. First, create a new equation with :new&enter;. Your other equation is still here, with :previous&enter; and :next&enter; you can switch between the two. (And :close&enter; or :close!&enter; gets rid of one.) Here, I show you only the new one.
The newly created equation is a math
element
containing an mrow
element. Move the cursor to the mrow
element.
Unfortunately, we can not use i nor a, since
they would insert before or after the mrow
element. We want to insert
in the mrow
. To do this, there is the command
&ctrl;i, which you now perform.
Press &ctrl;r. This creates a squareroot. (&ctrl;R would
give you a general root.) Now type ^a2&enter;.
Then +&space;. Here, the spacebar
creates an mrow
element. Go on with
2ab&enter;, +^b2&enter;&enter;,
=.
And now &ctrl;r(&space;a+b&enter;).
Rats! We have forgotten something important. The expression inside the brackets including the brackets actually should be the base of a power. Actually, we should have hit ^&space; right before the (. This mistake happens regularly (at least to me). Usually, one thinks of the power after having written the base. Unfortunately, the current insert mode does not work like that, it needs you to enter the ^ before writing the base. However, there is a feature that allows you to fix this situation. Find out yourself what the commands &ctrl;h and &ctrl;l do. Well, they select what you already wrote. Good. use these two commands to select the brackets and their content:
Now, hit ^. The selected elements are enclosed inside an
mrow
which becomes the first element of the new
msup
element.
Now, we put the exponent 2 and continue with our work: &enter;&enter;=.
To finish the whole thing, press &space;(&space;a+b&enter;)&enter;&enter;. Actually, the last hit of the enter key terminates the insert mode, you also could have used &esc; instead.
Done. Note that at certain places, we could have skipped the
insertion of an mrow
. As you will see in the next section, such
optional mrows can be added easily later on in the edit mode.
You can now close this equation. Since you do not have saved your changes, :close&enter; will not work. Instead, use :close!&enter;, which will throw away all unsaved changes.
In this section we are going to use the equation from the file
examples/pres01a.xml
. If you started from the beginning of
this tutorial, this is what you should have now. If this is not the
case, simply load it as described in the introduction to this
tutorial.
Sometimes you want to do something not only with the element the cursor is on, but with a whole sequence of elements. Using the visual mode (name inspired by vim), you can select a set of siblings.
Put the cursor on the munderover
element of the sum
sign. We are going to put the munderover
element and the
following mfrac
element into an mrow
element. This makes
sense, since they together form the argument of the lim
operator.
Press v. This throws you directly into visual mode.
If you use the default skin, you now see a beautiful blue. You can now use l, h and o. Find out yourself what they do. Be careful not to hit any other key. Now select the sum and the fraction.
Now you can hit a command from the editMode. In this case, execute
the command &space; (i.e. hit the space bar). This
command puts an mrow
element around the selected
elements.
You are back in the edit mode. In the tree view you can see the
new mrow
element. The cursor is currently on it.
Since you now know how the visual mode works, copying is no more
difficult. Gemse uses the command y for copying the
selected elements into a register. A register is
simply a place where copied elements are stored. If you use a command
that works on a register and you do not say on which one, it will use
the default register (which is called "
).
Delete commands put the removed nodes into a register. Let us try that. Move the cursor to the left side of the equation.
Hit x to remove it and move the cursor to the right side of the equation.
Hit p. This command pastes the content of a register after the cursor.
Move the cursor to the equal sign and hit xp again.
You can use xp to interchange the numerator and denominator: Put the cursor on the numerator.
Now hit xp.
There is also the command P which puts the content of a
register before the cursor as opposed to after it. Sometimes one wants
to put something into an empty element. In such a case, P
and p do not help. Select all children of the topmost
mrow
element (not the element itself, but its children).
You can do that for example by typing ggjjv$.
(gg moves the cursor to the math
element.
$ moves to the last sibling of the current element.)
Now delete the selected stuff, that is, hit d. This
leaves you with an empty mrow
element.
Press &ctrl;p. What we removed is back in.
Select the equal sign and the right hand side of the equation using the visual mode (v).
Hit y. This copies the selected nodes into a register
without removing them. (This command is not named c, since
this letter is already used for the change command. You can think of
y as yank
.) Move the cursor to the right and press
p.
Be aware that delte, copy and even change commands all put the
respective elements into a register. By default, they use the default
register. This makes it sometimes tricky to use the default register.
You gan prepend "x to such a command or to a paste command
in order to use another register, where you have to write the name of
the register in the place of x
.
Every register
has a name consisting of exactly one character. (Unlike in vim, you
can use every unicode character as name. This extends the amount of
available registers far beyond 26. Gemse's register names are case
sensitive, for example, register A and a are distinct registers.)
Hit u once to undo the mess from above. Move the cursor to the left hand of the equation and type "ay. Put the cursor on the righthand side and hit "by. Now try "ap and "bp and see what happens. Undo your changes afterwards.
Note that the commands that put something into a register always put the stuff in the default register as well when you tell them to use another register. The main reason for this is that it is done like that in Vim.
If you start here, load examples/pres01a.xml
. It is
what you should have now if you went through the last section.
In MathML, one can put various attributes on elements. They control their (semantically significant) appeareance. It is also possible to put attributes of a foreign namespace on them. One useful example for this are attributes from XLink, which allow you to make links out of MathML elements.
In edit mode, you can call the attribute mode which allows you to edit the attributes of this element. At the moment, the attribute mode is called with @. This may change in the future, since in vim, @ has another meaning, which could be important for gemse too.
Select the fraction, i.e. the mfrac
element. Now hit
@. You are now in the attribute mode. The selected element
does not yet have any attributes declared. However, the attribute view
below the tree view does also show you the default values of all
attributes. If an attribute is not declared, MathML uses its default
value. Let us add the attribute bevelled
. For this, write
ibevelled&enter;true&enter;. Note that the i
at the beginning tells the attribute mode that you want to insert a
new attribute. Behind the i you have to write the name of the
attribute, then hit enter followed by the value of the attribute and
then enter again. As you can see, the attribute has been added to the
list of attributes and indeed, the fraction changed its
appeareance.
Let us add another attribute: ilinethickness&enter;0&enter;. And antother one: ifoo&enter;bar&enter;.
By looking at the attributes table you can see that there
is also a cursor in the attribute mode.
You can move it with j and k. Select the
bevelled
attribute and insert cfalse&enter;.
This changes the value of the attribute under the cursor. You can also
remove an attribute by moving the cursor to it and hitting
x. Do that now with the foo
attribute.
Don't forget to hit &esc; after you are done with the attributes in order to get back to the edit mode.
Gemse provides different ways to look at an equation: Its rendering, its tree structure shown by using nested boxes, its XML source and more. These are what is called views in Gemse. But the concept of views goes even further. The list of attributes of the selected element, the list of dictionary entries, the list of the other opened equations and the status bar are views as well. (However, the input box is not a view.) The arrangement of views in the window is called a viewset.
There are some predefined viewsets. The command :viewset lets you choose the viewset you want to use. Currently, you are using viewset 0. Type :viewset 1&enter; and note the difference. In oder to get a list of all available viewsets, enter :viewset&enter;. As you can see, every viewset has a name. Indeed, you can give the command :viewset also the name of a viewset instead of its number.
You can create and modify viewsets using the viewset configuration window. It can be opened with the command :viewsetconf&enter;. It is the only part of Gemse that requires a mouse.
At the top are edit boxes for the name and the description of the
view. Below is a preview of the arrangement of the views using boxes.
Note that the thick black boxes are views and the thin gray ones are
XUL boxes which are used for more complex arrangements. You can click
a box to make it active. The active box is marked red. Below the
preview is a list of attributes of the active view or XUL box. For a
XUL box, you may like to set the attributes orientation
and flex
. For views, you also see their options. This
allows you to easily adjust the options of a specific view, while
using :set in edit mode only allows you the set options for
all views of the same kind. Use the context menu in the list of
attributes to add or remove attributes or options. To change a value
(namespace, name or value of an attribute, name or value of an
option), double click it. (After adding an attribute or an option, all
its fields are empty, so you may not see it, but it is there anyway,
at the end of the list. Double cklick in its fields to fill in the
values.) Below the list of
options is a drop-down button which allows you to insert views or XUL
boxes inside, in front of or behind the active box.
Note that changes to a viewset take effect immediately. All equations using this viewset will be affected. Maybe you want to safe the viewset under a different name first. The button at the bottom causes all equations to use the viewset you are currently editing.
We will make use of this feature in the section about editing notations.
Many aspects of the behaviour of Gemse can be configured (without messing around in
the source code). The command :set
is used to set
options. Here you will see some options and their effect. We take
examples/pres02.xml
for the equation. Again, the
screenshots here only show the relevant views.
Perhaps you want to see the attributes in the source view. Enter
:set SourceView.showAttributes=yes&enter; and voilà, here
they are. The source view has another useful feature: folding. When
you have a big equation, the source view spans below the window. You
can fix that by configuring the source view such that it only shows an
extract of the source. Enter :set SourceView.foldingDepth=3&enter;.
Now the source view only shows
the elements three levels deep. Does an element at the third level contain children
they are replaced by ...
.
Unfortunately, there is no way to see the children of the
munderover
anymore, even moving the cursor to one of its
children won't help. Here comes another option into play. Set it with
:set SourceView.foldingStart=-1&enter;. This causes the
view to begin with the element that is the parent of the element under
the cursor. (Using -2
as value, the view would begin at
the grandparent, for -3
at the grandgrandparent and so
on.)
Now, move the cursor and see what happens. Perhaps you also want to do :set SourceView.syntaxHighlighting=on&enter;. Try it and see the effect.
Note that options that can be set either to true
or
false
, also allow the values yes
,
on
, 1
for
true
and no
, off
,
0
for false
.
Of course, gemse has many more options.
What you learned up to now extends to Content MathML in a natural way. All you have to do is to choose the content insert mode.
Load the file examples/content01.xml
. Hit
&tab; until the content insert mode is selected.
As you can see, the equation view is now little helpful, it does not show the equation in a rendered form. Instead, it seems to just show garbage. The reason for this is that Mozilla's MathML rendering engine does not handle Content MathML. Indeed, it is not trivial to render Content MathML, i.e. to transform it to Presentation MathML. However, there is a view that can do that, called the NTNView. It uses the java library JOMDoc. Unfortunately, Gemse can only load java libraries if it is running with full permissions, that is, you have to run it as Firefox extension or XULRunner appilcation. Additionally, you must have installed a Java plugin which is scriptable. Please read the instructions. If you get it working, you can enter :viewset content&enter; to see the rendered equation, as in the screenshots of this section. In any way, you should not forget that Gemse always acts on the XML structure of the equation and that the rendered equation can differ significantly in its structure. Therefore, you will have your eyes on the source view or on the nested boxes most of the time. Whether you get the NTNView working or not, you can go through this section anyway.
Move around the cursor and watch how the NTNView shows the cursor in the rendered equation as well.
When your cursor is on a Content MathML element, or the first
element of the selection is a Content MathML element, then the command
&space; creates an appply
element instead of
an mrow
element. Move the cursor to the identifier
element for b
. Hit &space; once.
Now enter ji*. As you see, * places a times
symbol, +, -, / do the analogue.
(Note: If you got an mo
element instead of a
csymbol
, you haven't selected the content insert mode. In
this case, hit escape, undo your wrong change, select the content
insert mode and try again.)
Hit &esc; and do Acde.
Assume, instead of multiplying
d
and e
with the rest, we want to multiply
their sum with the rest. We are still in insert mode. Hit
&ctrl;h&ctrl;h. At this point, we could use
&space; in order to put an apply
around them
and the insert a csymbol manually later on. But it is even easier:
Just hit + and watch the magic happen. Terminate the insert
mode with &esc;.
Of course you want to be able to insert an arbitrary symbol from a content dictionary of your choice. Hit ggjj and then c. Finally, do $relation1&enter;eq&enter;.
The content insert mode has more features: Numbers can be inserted like in the UCD insert mode. That is, just type them. Should it ever happen that you want to insert a number right after a number, hit first &ctrl;, so that the digits you type are not appended to the preceding number. Cotent MathML has many elements (especially a lot of pragmatic elements). Therefore, Gemse has the commands # and < which allow you to insert arbitrary MathML elements. Please look up their meaning in the documentation of the content insert mode.
Now we are done with Content MathML, at least for this tutorial.
Content MathML is very similar to OpenMath. (Actually, is has been designed to be so.) Because of this, the content insert mode can create OpenMath as well. To insert some OpenMath construct, you use the same commands as for the analogue Content MathML.
Load examples/openmath01.xml
. Make shure you still
have the content viewset by entering :viewset content&enter;.
Also make shure that you have the content insert mode selected by
hitting &tab;.
Move the cursor to the variable b
. Hit a in
order to add another summand. With &space; insert an
OMA
element. Now insert a symbol with
$calculus1&enter;defint&enter;.
Let us insert the range of the integral: &space;$interval1&enter;interval&enter;. Namely, we want to integrate from 0 to 1. Insert those two integers with 0&ctrl;,1. So much about the interval.
Hit &enter; and let us go on. Let us insert a lambda
expression. Just hit (. The cursor is now located in the
new OMBVAR
element.
Hit x in order to
integrate over the variable x
. Hit &enter; to
jump into the application and hit fx. Hit
&esc; to terminate the insert mode.
Unfortunately, there are some small and nasty differences between OpenMath and Contant MathML: Mainly bindings, attributions and numbers. The content insert mode tries to make your life easier by using the same commands for the equivalent expressions in both languages. This however, is not always perfect. Please refer to the documentation of the content insert mode in order to learn about these details.
In order to render Presentation MathML or OpenMath, notation
definitions are needed. By default, Gemse uses the ones bundled with
jomdoc. As they currently cover only a small set of the public
OpenMath content dictionaries, you probably want to configure how
external notations are collected. This is done using the option
NTNView.notations
. (In some cases you also need to set
the NTNView.documentURI
and
NTNView.theoryName
.) For details, see the
documentation of the NTNView.
Here we want to open a formula from an OMDoc document.
First load all equations from examples/sets.omdoc
. This
can be done by typing
:loadall chrome://gemse/content/doc/examples/sets.omdoc&enter;.
It takes some seconds to load them all.
Switch to the last equation. (By :goto 16 if you had no
other equations open before.)
Make shure you are using the viewset content
by entering
:viewset content&enter;.
As you see, the NTNView renders the symbol eq
from
content dictionary relation1
correctly, because a
notation definition for it is bundled with JOMDoc. This is not the
case for the symbols intersection
and union
introduced by the OMDoc document the equation belongs to. Therefore,
the default rendering is used for these symbols. However, the OMDoc
document containing the equation does have notation definitions for
them. In order to activate them, do :set NTNView.notations=I&enter;. You
need to force Gemse to rebuild the view by hitting &ctrl;l,
as the changes do not apply automatically.
The intersection and the union are now rendered as we want it, but
now the symbol eq
is rendered using the default notation.
This is because we removed the notations bundled with JOMDoc as a
notation source. It is possible to use more than one notation source
by listing them all in the option NTNView.notations
using
spaces to separate them: Do :set NTNView.notations=I B&enter;.
This causes NTNView to use the notations defined in the document as
well as those bundled with JOMDoc. Again, hit &ctrl;l.
So far so good, let us clean up. Do :set NTNView.notations=B&enter; and :close!&enter;.
You don't like the notations used in your newly bought book? Gemse helps you fixing them (if it has been written in JOMDoc). It is useful to look at an example formula while editing a notation definition, and Gemse allows you to do exactly this! Let's see how it works:
Again, we open equations from the document of the last section,
however, this time we open the notation definitions as well. Use the
command :loadall chrome://gemse/content/doc/examples/sets.omdoc&enter;
if you haven't loaded them anymore from the last section.
Issue the command :goto 10&enter; to
to switch to a notation definition. (In case the equations are
numbered differently, just switch to the one which is displayed as a
union sign in fences. The first line of its source code is
<notation cd="sets" name="union">
.)
Now do :viewsetconf&enter;. If the viewset
content
has not been automatically chosen (look at the
box to the top left), do that
manually with the button load viewset
. Now, click into the
NTNView
. Its box is now red.
Let us insert two more NTNViews. (Be careful, sometimes the active
box changes unexpectedly, in this case, make shure to click the
NTNView again.) Choose twice the NTNView
from the insert
drop down box.
In the main window of Gemse you can see that the views have been
added immediately. Now let us set some options. Click the first
NTNView. Open the contextmenu on the list of attributes (e.g. by
clicking with the right mouse button into the list). Choose Add
arbitrary option
. A row Options
has been inserted, but it
is just a header below which all options are listed. An empty option
has been inserted, it is the row below the header. Since it contains
no values yet, it might be invisible. Anyway, double click into the
Attribute
field of this invisible row.
Now, type in the name of the option we want to set, namely
NTNView.equation
and hit enter. Now double click on the Value field of
the same row and insert 16
. Now add another option
by opening the context menu, choosing Add arbitrary option
,
double clicking the field Attribute
of the new row, insert
NTNView.notations
and hit enter. In the
Value
field insert E I B
and hit enter. Now it
should look like this:
We do exactly the same with the second and third NTNViews. But we
use for the option NTNView.equation
the values
15
and 14
instead. Do this as above, click
the view, use the right mouse button to add an option, fill in the
name of the option and its value (double click).
As a final action, click on the button Choose for all
equations
. You can now close the window Viewset
configuration
(or enter in the main window the command
:viewsetconf close&enter;).
Now let's see what we have done. The NTNViews show three different equations. We are currently editing a notation definition. We can make a change to it and then hit &ctrl;l in order to update the views. Now we immediately see how our change affects the equations shown by the NTNViews. (Hitting &ctrl;l is unfortunately necessary to update the views. Mabye this will be addressed in a later version of Gemse.) Let us try it:
Move the cursor to ∪]]>
and change it to a -]]>
. (I.e. move
the cursor to the said element and enter c-&enter;. Just
make shure, you have the insert mode ucd
activated.) Now hit
&ctrl;l and watch the magic!
You wonder why you find here a section about scalable vector graphics? It is just here to show you that Gemse can load any element of an XML document even if it is not the root element of a MathML or OpenMath formula. However, in practice this is useless. (There is no mode yet that lets you input SVG or arbitrary XML elements.)
Make shure that you are using the viewset
presentation
. (If not, enter
:viewset presentation&enter;.)
Let us load an SVG image. For this to work, we have to deactivate
the sanity check that makes shure that what you load is alway a
formula. You can do that by setting the option
loadAnyAsRoot
to true, i.e. enter
:set loadAnyAsRoot=true. Now you can load
the file examples/vectorgraphics01.svg
as usual.
Now move the cursor around to see what happens to the figures.
(Note that this SVG image contains some CSS rules which make shure
that one can see the cursor in the image itself. If you wanted to work
with SVG in Gemse, you would better put them in Gemse's
gemse.css
.)
This section quickly gives you a hint how to customize some
internals of Gemse. Be aware that these things are internal and
therefore Gemse will break if you mess it up. You find the files
mentioned below in the subdirectory chrome/content
of
the installation directory of Gemse. The command
:help installation-directory&enter; helps you with locating
the installation directory (which can otherwise be a pain with Firefox
extensions on windows).
If you want to change the appearance of Gemse, you have to lay hands on
the file gemse.css
. Note that the documentation also uses this
stylesheet file, so the examples in it are always consistent with your
changes.
For example, if you want to change the size of the renderings of
the formula, open gemse.css in a text editor, look out for
*[internal|viewClass="DirectView"], *[internal|viewClass="EquationView"]
and change the
font-size
for example to large
.
If you want to modify the pre-defined viewsets, you find them in the file
editor.xul
.
If you do not like the keyboard layout, i.e. you want to change the
name of the commands, you have to look into the javascript file
for the table for the respective mode. For example, if you want to
change the commands of the attribute mode, open the file
attributeMode_commandTable.js
. Those files are not
exactly self-explaining, but you can try to change them.
We reached the end of the tutorial. You should now read the important basic information. Afterwards, you can peek into the rest of the documentation.