4 Editing the logical structure

Structure schemas (see section 1) are used by the editor in order to provide the user with the elements he can create at any moment. These schemas also help the editor to generate the components of each new element. Thus, if you select a Section, the editor suggests that you create a new Section before or after the current Section. Once you have made a choice, the editor generates the minimum content of a Section, i.e a Section_title and a Seq._of_paragraphs (see the structure schema in Figure 2).

Operations acting on the logical structure of a document are based on the same principles as text operations: you first have to select the portion of document to be modified before issuing an editing command for that portion.

4.1 Structural selection

Selection does not only apply to character strings, as described in section 3.2; it also applies to the elements that constitute the logical structure of documents.

4.1.1 Selecting a logical element

There are several ways to select a logical element. All can be used equally:

Selection with the left mouse button
You can select a structure element by clicking with the left mouse button on certain positions of the element. Thus, by clicking on a section number, you select the section title; by clicking in the blank between the number and the title of a section, you select the corresponding section; by clicking on the paragraph indent, you select the paragraph; by clicking on the bullet of a list item, you select that item; etc.
Selection with the Escape key
You can also select a single character or a character string (see section 3.2) belonging to the element to be selected and then press the Esc key as many times as needed to reach the desired element: each time you press the Escape key, you select the element which encloses the current selection in the logical structure.
Selection with the Selection menu
You can use the ``Selection'' menu (click on the ``Selection'' button at the top of the document window). This menu is composed of, at most, four entries (some of them can be empty if the corresponding element does not exist) which allow movement within the tree of the document logical structure relative to the current selection. Each entry is made up of a symbol (^ < > _) followed by the type of the corresponding element:
^ selects the enclosing element (as the Escape key).
< selects the previous element (Control B).
> selects the following element (Control F).
_ selects the first enclosed element (Control -).

These different selection modes can be combined: for instance you can first select an element with the mouse, then move to the sibling element with the ``Selection'' menu and finally use the Escape key to move to the enclosing element.

Whatever selection mode is used, the type of the selected element (even when only text is selected) is displayed at the bottom of the window in the messages area. This area also displays the type of elements which enclose the current selection, on several levels.

4.1.2 Selecting several elements

When one element (or even a single character) is selected, you can extend the selection by clicking with the middle mouse button on another element. This operation selects a sequence of elements of the same level in the logical structure, the extreme elements of that sequence containing the element initially selected and the element on which the mouse pointer is positioned when you click.

You can extend the selection by holding down the left mouse button while dragging the mouse, in the same manner as for text selection.

When several elements of the logical structure are selected, the ``Selection'' area displays in square brackets the types of such elements, then the types of enclosing elements.

4.2 Searching for elements

The Search command described in section 3.8 allows the user to search not only according to the content but also according to the logical structure of the document. Other commands are available for different kinds of searches (the search commands for references, cross-references and hypertext links are presented in sections 5.4 and 5.5).

4.2.1 Searching for specified elements

The ``Text and structure'' entry from the ``Search'' sub-menu from the ``Edit'' menu (see section 3.8) displays a form that can be used to search for a logical element of a given type. When the ``Text and structure'' area is empty, you can select an element type within the ``Type to search'' list. You can also enter the type name within the input area located under the list. When you click on the ``Confirm'' button, the editor searches for the next element of the required type and selects it. The search occurs within the portion of document defined in the ``Search where'' menu of the form (see section 3.8).

When the document uses several structure schemas, you can select the ones whose element types appear in the ``Type to search'' list. To do this, just click on the square buttons in the ``Natures'' list: only types defined in the selected schemas are displayed in the ``Type to search'' list. The ``Attributes to search'' list is updated simultaneously (see section 6.4).

4.2.2 Compound search

You can search for a character string or a regular expression that appears within a specified element by filling the ``Search for'' and ``Type to search'' input areas. You can also combine this search operation with that of an attribute (see section 6.4).

It is also possible to ask for the replacement of the strings found in a given context by using the ``Replace by'' input area and the ``Replace'' options in the same way as described in section 3.8.

4.2.3 Searching for empty elements

The logical structure elements which do not contain anything are displayed under the form of a grey rectangle as below (it is an empty Paragraph element).

Those empty elements are temporarily displayed: the user must either remove them or fill them. A command allows you to search for empty elements in order to make sure that all such elements are processed.

To issue that command, select the ``Empty element'' entry from the ``Search'' menu (in the menu bar, at the top of the document window). A form containing the same ``Search where'' submenu as the text search command is displayed (see section 3.8). Once you have selected the search area, each time you click on the ``Confirm'' button, the next empty element is searched for and selected until all empty elements contained in the search area are found. The ``Not found'' message will appear at the bottom of the form if there are no remaining empty elements.

4.2.4 Moving to a specified page

The ``Pages'' menu contains a ``Goto page number'' entry which allows you to move to a specified page. Select the entry and type the number of the page you want to display. Once you have entered the number, click on the ``Confirm'' button in order to display the required page in the window.

4.3 Creating new elements

You can add elements in the logical structure either by creating new elements or by pasting elements that have been copied or cut elsewhere (see section 4.5).

Use the ``Insert'' menu to create new elements within the logical structure. You can also use the Return key under certain conditions. In both cases, you must select a logical element in the vicinity of the new element you want to create.

4.3.1 Insert menu

The ``Insert'' menu can be called by the ``Edit'' menu from the menu bar or by using the right mouse button when the mouse pointer is positioned in a Thot document.

This menu is built according to the current selection and the document structure schema. Thus, it may vary. It displays all element types that can be created before or after the current selection. By selecting an entry from this menu, you choose the element to be created and its structural position.

The element is then created with all its mandatory components (those that are not preceded by a question mark in the structure schema, see Figure 2) as they are described in the structure schema. Obviously, those components are empty and appear under the form of a grey rectangle.

The structure schema can offer various possibilities for the content of some elements. In this case, the user must indicate his choices within one or several other menus. By way of example, you can try to create a new paragraph after this one; first select the paragraph (by clicking with the left mouse button on the first line indent for instance), then choose among the following options in the successive menus: Paragr, Paragraph, Simple Paragraph, Text.

When you select an empty element (as the one in section 4.2.3) or an element that does not contain all the components defined in the structure schema, ``Within selection'' is the first entry offered by the ``Insert'' menu. This entry allows you to create the missing elements within the selected element. This entry is also offered when you have selected a reference (see section 5.3).

4.3.2 Return key

Using the Return key is a quicker but less flexible way to create a new element after the selected element. It creates, if the structure schema allows, i.e. if the ascendant element is a List (for example, a sequence of sections, a sequence of paragraphs, an itemized list), a new element of the same type as the selected element after which it is placed. When the selection is in the middle of a paragraph, it allows the paragraph to be split in two.

By way of example, you can select this paragraph (by clicking with the left mouse button on the first line indent) and press the Return key: a new paragraph is created. You can also try to create a section by performing the same operation.

4.3.3 Typing text

When a new element is created, it is empty and it appears under the form of a grey rectangle. If that element is to contain text, just select it (if it has not been selected by the creating command) and type the required text on the keyboard. A terminal element of type Text is added to the logical structure of the document and each character typed on the keyboard is entered within this element.

If you create a Section after this section, the editor generates two elements within the new section: a title containing a text element and an empty Block element (the first paragraph of the new section). The Block element is transformed into a Simple_paragraph that contains a text element as soon as you select it and type text; the ``Selection'' area at the top of the screen indicates the changes made to the logical structure.

4.4 Deleting elements

The commands used for deleting the elements of the logical structure are the same as those used for deleting character strings (see 3.6).

When one or more elements are selected, you can delete them by pressing the Delete key or by using Control D. You can also use the ``Edit'' menu and choose the ``Delete'' entry. In all cases, the deleted elements are definitely lost (note that there is no Undo command in this version). Use the ``Cut'' command to store deleted elements for future use (see section 4.5).

Before deleting an element, check whether this element is referenced (see section 5.4) or included (see section 4.6) by other elements.

4.5 Cutting, Copying and Pasting elements

The ``Cut'', ``Copy'' and ``Paste'' commands presented in section 3.7 for handling text can be used in the same way for structure elements.

If you want to remove the selected elements and place them elsewhere, use the ``Cut'' command from the ``Edit'' menu or press the Control W keys. The selected elements are then removed from the document and stored in the Thot clipboard; the cut elements automatically replace the previous contents of the clipboard.

To insert the contents of the Thot clipboard in a document, select the element before which you want to place the contents, then issue the ``Paste'' command from the ``Edit'' menu (or use the Control Y keys on your keyboard). If the clipboard contains structure elements and not a single character string, a menu similar to the one offered by the ``Insert'' command (see 4.3.1) is displayed. This menu allows the user to indicate the desired type and position in which the contents of the Thot clipboard are to be pasted. Note that the ``Paste'' command may fail if the option selected in the menu is not consistent with the contents of the clipboard. In such cases, the following message is displayed in the main window of the editor: ``The element Type_Name cannot be pasted here''.

The selected structure elements can be copied to the Thot clipboard with the ``Copy'' command from the ``Edit'' menu or with the Control C keys. These elements can then be pasted in another place within the document or in another document.

When structure elements are selected, the ``Copy to X'' command from the ``Edit'' menu copies to the X clipboard the text contained by these elements. This text will be truncated if its length exceeds the capacity of the X clipboard buffer (the capacity depends on the machine). That text can then be pasted into an X window as described in section 3.7.

4.6 ``Live'' copy: the Include command

The ``Paste'' command inserts a dead copy. In some cases, you may wish to obtain a live copy, i.e. a copy which is automatically updated each time you modify the copied element.

To do this, use the ``Include'' command from the ``Edit'' menu. That command does not use clipboards. Thus, a previous copy is not required; the command creates a link between the element to be copied and the desired position of the new copy (see article [Quint92a]).

The ``Include'' command presents the same menu as that offered by the ``Insert'' or ``Paste'' command, i.e. the list of elements that can be created before or after the selected part. Once you have selected the type and the position of the copy, click with the left mouse button on the element to be copied. You can click in any Thot window of a document provided that you click on an element of the required type. You can move throughout the document by using the scroll bars in order to display the desired element before clicking on it.

Once you have designated the element, the copy appears at the desired position in color to indicate that it is a link (the color can be chosen by the user, see section 23.1.3; however, printing is always black and white). A live copy cannot be directly modified and you cannot select within it [1]. Modifications must be made on the original element. They are automatically carried out on the copy.

You can easily access the original from the copy by double-clicking with the left mouse button on the copy.

You cannot directly modify the content of a live copy. However, the copy element itself can be altered: you can change its presentation (see section 8.3), you can delete it, copy it, paste it, etc.

4.7 Splitting a structure element

It is sometimes necessary to split one part of a document into two: for instance, a lengthy section can be divided into two sections. To do this, use the ``Split'' command from the ``Edit'' menu.

This command is activated only when the selection is within an element which, according to the structure schema, can be repeated (the section in the previous example). In this case, the menu explicitly indicates, after the word ``Split'' the type of the element which will be split into two. If none of the elements enclosing the current selection can be repeated, the ``Split'' command is not available in the ``Edit'' menu.

When valid, the ``Split'' command creates an element of the specified type, after the corresponding element which encloses the current selection. All elements from the first selected element to the end of the element to be split are removed from the original element and placed into the newly created element. Both the original element and the newly created element are completed if necessary, so that they have a content consistent with the minimum specified in the structure schema.

By way of example, when you select this paragraph, the ``Edit'' menu contains a ``Split Section'' entry. By issuing that command, you create a new section after section 4.7. This new section is composed of an empty title, this paragraph and the following one. Section 4.7 no longer contains these two paragraphs.

The ``Split'' command is a generic command, as are all Thot commands. It can be applied to other elements than sections or subsections.

4.8 Changing the type of an element

The ``Change'' command from the ``Trnsform'' sub menu of the ``Edit'' menu change the type of the selected element. When the command is issued, a pop-up menu present the types the selected element can be transformed to.

4.9 Other transformations

The ``Other'' command from the ``Transform'' submenu of the ``Edit'' menu applies pre-defined transformations to the selection. Such transformation are declared in the .trans file in schemas directories. The transformation language syntax is described in the README.trans file.


[Section 5] [Table of contents]