Leo : Basics What is Leo

Leo is a unique, powerful computer program that you can use to organize, analyze and describe text and text files. Leo is a free program written by Edward K. Ream. For information about downloading Leo, see installation tutorial in this series. Leo runs on Windows, Mac, or Linux.

Use Leo:

- to brainstorm a new project
- as a Personal Information Manager
- to add multiple outlines and commentary to any text file
- as a tool to facilitate a new kind of literate programming.

Because Leo is unlike other tools you may have used, a series of examples may be the best way to demonstrate what can be done with Leo.

From one perspective, Leo is an outlining editor . This is a screenshot of Leo. You create an outline in the top left pane. (A later tutorial explains how to create an outline like the one in the screenshot).

Clicking on the indicated box will open the indicated node .

Here the node has been opened. Clicking on the box again will close the node.

Here the indicated node has been closed.

Clicking on a node headline (1) will show the text for that node in the body pane (2) below. The body pane is a text editor - you can enter, delete or change text here by typing it in.

You can save the outline in a leo file. Click File - Save.

Here we will save our outline in a file name "pim.leo".

The file is now saved, and the file name appears in the title bar.

You've just seen an introduction to Leo as an outlining editor. You can use Leo to make an outline, with optional text for each outline element. You can save the outline to a file. Outlines are explained more in a later tutorial in this series. The outlining capability of Leo goes far beyond what has just been demonstrated, including multipath outlines, and multiple outlines in one file .

What we've shown so far is no different from other outlining editors. What makes Leo unique is the addition of a new feature. Using simple directives, you can instruct Leo to extract text from any number of nodes, in any order, and write the text to a new file. You can also embed outline information in the second file, giving Leo the ability to read the text pieces back into the Leo outline, even if they have been changed.

In effect, Leo is a meta-text editor . It gives you the ability to create a structural document for a non structured document, or a document that is structured in some other way.

What does this mean in practice? Some examples should help clarify things...

Here is the "pim.leo" file again. We've:

1. Selected the "2000" node.
2. Entered a couple of directives. The second (@root) tells Leo the file name that we want to derive (extract to). (The @silent directive is explained in a later tutorial).
3. Entered some node text.

Now we tell Leo to tangle the node. This means Leo should

1. Start at the current node and look for a @root directive.
2. Create the file named in the @root directive or open it if it already exists.
3. Write all of the node text to the file named in the root directive.

Why is this operation called tangling? We'll see that a few pages from now.

Leo has derived the file (written the file to the hard disk).

Here the file is listed in Windows Explorer.

And here is the file displayed in a text editor.

That example wasn't very useful. All that we extracted was the text "This is my diary." We'll probably want to extract more than that.

In fact, when tangling, we can extract not only the node text as we just saw, but also all or part of the text of any subnode. And we can put these extracted pieces into the derived file in any order. That is why the process of extraction is called tangling.

Let's try this. Select the "Jul" node.

1. We add << >> angle brackets to the headline. This tells Leo that the node is a section.
2. We add the @c directive. This tells Leo where to start extracting text from this node.

Now we go back to the 2000 node. We enter the section name << Jul >> into the node text where we want the << Jul >> section text to be output. When tangling, Leo will replace this section name with the section text. This operation is recursive, so if a section text contains a section name, this also will be replaced with the named section's text.

Note: when we put a << section name >> into node text, the section name must correspond to a section located under the current node. Leo only looks in subnodes for section names.

Choose Tangle.

The file has been updated.

Here is the extracted file viewed in a text editor.

This tutorial has given you a brief introduction of Leo's:

- Outlining capacity
- Ability to create derived files.

These two things are the main features of Leo. However, there is much more to say about both of them:

- Outlining - see the Outlining tutorial in this series to see how Leo can be used to create outlines with multiple paths or views, making it a powerful tool for project planning or any kind of tree-based analysis.
- Derived files - we've seen the simple case of deriving a text file from a node. This give you the ability to collect a number of text files in one Leo outline. But Leo can do much more that that - Leo can extract not only node text, but also outline structure, and can then read back this embedded structure. For a look at this feature and why it is so useful, particularly for programmers, see the next tutorial in this series: What is Leo - Continued. In addition, in the following tutorials you will see much more complex examples of derived files.

In addition to Outlining and file deriving features like Tangle, Leo also has the following features:

- Can be scripted with Python.
- Contains a syntax highlighting programmer's editor.
- The .leo format is XML, meaning that a leo file can be easily converted to any other text format such as HTML.

Text Author: Joe Orr Copyright 2002 All Rights Reserved
Created with ScreenBook Maker Last update: 8/4/2002 Additional Trademark and Copyright Information