12.07.2015 Views

GLE User Manual - Fedora Project Packages GIT repositories

GLE User Manual - Fedora Project Packages GIT repositories

GLE User Manual - Fedora Project Packages GIT repositories

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

58 CHAPTER 7. ADVANCED FEATURES! draw the dooramove 1.5 0box 0.75 1.375 fill burlywood name door! draw the windowamove 0.25 0.625box 1 0.75 fill skyblue name windowend objectTo draw the house defined by the above block, one uses the following draw command. The first argumentof the command is the name of the object followed by a dot followed by a justify option (Table 7.1). Thejustify option is used to position the object. In this case, the house is drawn such that its bottom-centrepoint is horizontally in the middle of the figure and at a height of 1.5 cm.amove pagewidth()/2 1.5draw house.bcThe “draw” command names the object using the same name as the name of the object block by default.An alternative name can be given using its “name” option. In this example, the resulting object on thefigure will be called “house”. Note that the object definition for the house also includes names for thesub-objects “door” and “window”. These names can be accessed using the “dot” notation as follows:print ptx(house.door.cc)print pty(house.door.cc)These so-called hierarchical object names can also be used to position the object. The following exampledraws the house such that its door’s centre point is at position (5, 5).amove 5 5draw house.door.ccBy using the “draw” command inside an object’s definition, names can be arbitrary nested. For example,if “door” would be defined as an object block that includes the name “handle”, and if the object blockdefining “house” would include a draw command to draw the object “door”, then the global name of thedoor’s handle becomes “house.door.handle”.The hierarchical object names can be used to refer to points on the object. The following example showshow these can be used with the pointx and pointy function to draw labels on the figure.set just lcamove pointx(house.rc)+0.5 pointy(house.door.cc)begin name doorlabel add 0.05write "house.door.cc"end nameset just rcamove pointx(house.lc)-0.5 pointy(house.window.cc)begin name windowlabel add 0.05write "house.window.cc"end namejoin windowlabel.rc -> house.window.ccjoin doorlabel.lc -> house.door.ccThe resulting figure is shown in Fig. 7.2. The file “shape.gle” that is distributed with <strong>GLE</strong> containsobject block definitions for many useful shapes.7.2 L A TEX Interface7.2.1 Example<strong>GLE</strong> files can include arbitrary L A TEX expressions using the L A TEX interface. There are two ways toinclude a L A TEX expression. The first one is by using the ‘tex’ primitive. The second one is by using the‘\tex{}’ macro in a string.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!