GLE for Linux Installation Guide

This tutorial explains how to install, configure, and run GLE on Linux (and Cygwin).

Installing GLE

GLE may be included in your Linux distribution's package repository. If so, install GLE using your Linux software install tool. If not, install GLE by downloading and compiling its source code. There are detailed instructions available about this proces here: "GLE Compilation Guide".

Running GLE

GLE should now be ready to use. Enter the command "gle" in your terminal to test it.

GLE version 4.0.12
Usage: gle [options] filename.gle
More information: gle -help

GLE should respond as in the example above. If you instead get the message "bash: gle: command not found", then the directory containing the "gle" executable is not in your system's search path. This is what happens if you have installed GLE in your home directory and "$HOME/apps/bin" is not in your path.

To fix this, enter "export PATH=$HOME/apps/bin:$PATH" and try again. Add this line to your "~/.bash_profile" file to make it permanent. Note: if this does not work, you can always start GLE using the full path, e.g., by entering the command "$HOME/apps/bin/gle".

GLE takes as input a script file containing GLE commands and outputs a graph or drawing, e.g., in PostScript or PDF format, which can be included in your LaTeX or OpenOffice document.

To create the script file we need a text editor. You may use any editor you like. Note that your editor should save files in UTF8 or ASCII format.

I will be creating my example GLE script file in the folder "GLE" in my home directory. Open your editor, type in the following GLE script, choose "Save" from the menu, create a new folder "GLE" in your home directory and save the file as "parabola.gle" in that folder.

size 12 8

begin graph
    let d1 = (x-2)^2 from 0 to 4 step 0.1
    d1 line color red
end graph

Next we are going to run GLE to create a PostScript ".eps" file from our script. In your terminal, enter the folldowing commands (replacing the argument of "cd" with the location where you saved "parabola.gle").

[~]$ cd GLE
[~/GLE]$ gle parabola.gle
GLE 4.0.12-rc1 [parabola.gle]-C-R-[parabola.eps]

GLE should respond as above. It has created the output file "parabola.eps".

[~/GLE]$ ls
total 10K
-rw-r--r-- 8.3K Jul 18 20:20 parabola.eps
-rw-r--r--   98 Jul 18 20:08 parabola.gle

To view "parabola.eps", we need a PostScript viewer like the program GhostView. Install GhostView on your system from your Linux DVD or package repository.

Viewing GLE's Output

After you have installed GhostView, enter the command "gv parabola.eps". If everyting went ok, then you will now see a preview of our parabola graph.

Try making changes to the GLE script in your editor, save it, rerun GLE, and preview in GhostView until you are satisfied with the output.

Try adding the following commands in the graph block of the GLE script.

title "Parabola"
xtitle "x"
ytitle "f(x) = (x-2)^2"

After running GLE, your output should include the title "Parabola" at the top of the graph and axis labels. Your graph is now ready for publication ;-).

Encapsulated PostScript (.eps) files are designed to be included as figures into other documents. If you want to print your file without including it in a larger document, tell GLE to create a regular PostScript (.ps) file instead. This can be done by running GLE with the "-d ps" option.

gle -d ps parabola.gle

Preview the resulting "parabola.ps" with GhostView. You will notice that the graph is now centered on a full page. Choose "File | Print" in GhostView to print it.

If you wish you can try running more examples from the GLE Example repository. You may also want to browse through the GLE documentation to learn more about writing GLE scripts.

Creating PDF, JPG, and PNG Output

GLE can create PDF, JPG, and PNG output by relying on GhostScript. GLE can use GhostScript if the "gs" executable is in your system's search path. This should normally be the case by default if you have installed GhostView.

We can now create PDF, JPG, and PNG output with the following commands.

gle -d pdf parabola.gle
gle -d jpg parabola.gle
gle -d png parabola.gle
gle -d pdf -fullpage parabola.gle

The command with the "-d pdf" and "-fullpage" options creates a full page PDF file with the parabola graph centered. This file can be printed with Adobe Reader.

The options "-d jpg" and "-d png" can be used in combination with "-dpi X", which changes the resolution of the resulting bitmap. Try, e.g., with "-dpi 75" and "-dpi 200".

Using the GLE Graphical User Interface QGLE

Starting from 4.0.12, GLE also has its own previewer called QGLE (written by A. S. Budden). As you make changes to your GLE script, QGLE will update its display.

Enter "qgle" to start QGLE. The first time you run QGLE it will ask you for the location of "libgs.so". This is the GhostScript library, which might come with your GhostScript installation. It is usually located in "/usr/lib/libgs.so".