Home | Download | Help | Contribute | Plug-ins | About | Contact | Search
Writing simple documents
Manual | Top | Previous | Next

1.Generalities for typing text

As soon as you have performed the preparatory actions as explained above, you can start typing. The usual English characters and punctuation symbols can easily be obtained on most keyboards. Accented characters from foreign languages can systematically be obtained using the escape key. For instance, “é” is obtained by typing A-' e. Similarly, we obtain “à” via A-‘ a and so on. Long words at borders of successive lines are automatically hyphenated. In order to hyphenate foreign languages correctly, you should specify the language of the document in the menu DocumentLanguage.

At the left hand side of the footer, you see the document style, the text properties at the current cursor position. Initially, it displays “generic text roman 10”, which means that you type in text mode using a 10 point roman font and the generic document style. You can change the text properties (font, font size, color, language) in the Format menu. You can also change the text properties of the text you have already typed by selecting a region and then using the Format menu. Some text properties can also be changed for all the document with the Document menu.

At the right hand side of the footer, the character or object (like a change in the text properties) just before the cursor is displayed. We also display all environments which are active at the cursor position. This information should help you to orient yourself in the document.

2.Typing structured text

Usually, long documents have a structure: they are organized in chapters, sections and subsections, they contain different types of text, such as regular text, citations, footnotes, theorems, etc. After selecting a document style in DocumentStyle, TeXmacs takes care of specific layout issues, such as numbering of sections, pages, theorems, typesetting citations and footnotes in a nice way and so on.

Currently, four standard document styles have been implemented: letter, article, book and seminar. The seminar style is used for making transparencies. As soon as you have selected such a style, you can organize your text into sections (see TextSection) and use specific environments. Examples of environments are theorem, proposition, remark and so on (see TextEnvironment). Other examples are lists of items (see TextItemize) or numbered lists (see TextEnumerate).

When you get more acquainted with TeXmacs, it is possible to add your own new environments in your own style file. Assume for instance that you often make citations and that you want those to appear in italic, with left and right margins of 1cm. Instead of manually changing the text and paragraph properties each time you make a citation, it is better to create a citation environment. Not only it will be faster to create a new citation when doing so, but it is also possible to systematically change the layout of your citations throughout the document just by changing the definition of the citation environment. The latter situation occurs for instance if you discover a posteriori that you prefer the citations to appear in a smaller font.

3.Content-based tags

The simplest examples of structure in a text are content-based tags. In Textcontent tags you see a list of them. Content based tags indicate that a given portion of text is of a particular kind or that it serves a specific purpose. For instance, important text should be marked using the strong tag. Its default rendering uses a bold type face, like in this strong text. However, strong text might be rendered in a different way according to the document style. For instance, strong text may be rendered in a different color on transparencies for presentations. Here follows a short list of the most common content-based tags and their purpose:

Tag Example Purpose
strong this is important Indicate an important region of text
em the real thing Emphasize a region of text
dfn A gnu is a horny beast Definition of some concept
samp the ae ligature æ A sequence of literal characters
name the Linux system The name of a particular thing
person I am Joris The name of a person
cite* Melville's Moby Dick A bibliographic citation
abbr I work at the C.N.R.S. An abbreviation
acronym the HTML format An acronym
verbatim the program said hello Verbatim text like computer program output
kbd Please type return Text which should be entered on a keyboard
code* cout << 1+1; yields 2 Code of a computer program
var cp src-file dest-file Variables in a computer program

Table 1. Some of the most common content-based tags.

4.Lists

Using TextItemize you may start an unnumbered list. You may either select a particular tag like • (bullets), - (dashes) or → (arrows) to indicate entries in the list or the default tag. Lists may be nested inside other tags, like in the following list:

The default tag is rendered in a different way depending on the level of nesting. At the outermost level, we used the • tag, at the second level ∘, and so on. When you are inside a list, notice that pressing return automatically starts a new item. If you need items which are several paragraphs long, then you may always use S-return in order to start a new paragraph.

Enumerate environments, which are started using TextEnumerate, behave in a similar way as itemize, except that the items are numbered. Here follows an example of an enumeration which was started using TextEnumerateRoman:

  1. A first item.
  2. A second one.
  3. And a last one.

The last type of lists are descriptive lists. They are started using TextDescription and allow you to describe a list of concepts:

Gnu
A hairy but gentle beast.
Gnat
Only lives in a zoo.

5.Environments

In a similar way as content-based tags, environments are used to mark portions of text with a special meaning. However, while content-based tags usually enclose small portions of text, environments often enclose portions that are several paragraphs long. Frequently used environments in mathematics are theorem and proof, like in the example below:

Theorem 1. There exist no positive integers a, b, c and n with n⩾3, such that an + bn = cn.

Proof. I do not have room here to write the proof down.

You may enter environments using TextEnvironment. Other environments with a similar rendering as theorems are proposition, lemma, corollary, axiom, definition. You may use the dueto macro (entered using \ d u e t o return) in order to specify the person(s) to which the theorem is due, like in

Theorem 2. (Pythagoras) Under nice circumstances, we have a2 + b2 = c2.

Other frequently used environments with a similar rendering as theorems, but which do not emphasize the enclosed text, are remark, note, example, warning, exercise and problem. The remaining environments verbatim, code, quote, quotation and verse can be used in order to enter multiparagraph text or code, quotations or poetry.

6.Layout issues

As a general rule, TeXmacs takes care of the layout of your text. Therefore, although we did not want to forbid this possibility, we do not encourage you to typeset your document visually. For instance, you should not insert spaces or blank lines as substitutes for horizontal and vertical spaces between words and lines; instead, additional space should be inserted explicitly using InsertSpace. This will make your text more robust in the sense that you will not have to reconsider the layout when performing some minor changes, which affect line or page breaking, or major changes, such as changing the document style.

Several types of explicit spacing commands have been implemented. First of all, you can insert rigid spaces of given widths and heights. Horizontal spaces do not have a height and are either stretchable or not. The length of a stretchable spaces depends on the way a paragraph is hyphenated. Furthermore, it is possible to insert tabular spaces. Vertical spaces may be inserted either at the start or the end of a paragraph: the additional vertical space between two paragraphs is the maximum of the vertical space after the first one and the vertical space before the second one (contrary to TeX, this prevents from superfluous space between two consecutive theorems).

As to the paragraph layout, the user may specify the paragraph style (justified, left ragged, centered or right ragged), the paragraph margins and the left (resp. right) indentation of the first (resp. last) line of a paragraph. The user also controls the spaces between paragraphs and successive lines in paragraphs.

You can specify the page layout in the DocumentPage menu. First of all, you can specify the way pages are displayed on the screen: when selecting “paper” as page type in DocumentPageType, you explicitly see the page breaks. By default, the page type is “papyrus”, which avoids page breaking during the preparation of your document. The “automatic” page type assumes that your paper size is exactly the size of your window. The page margins and text width are specified in DocumentPageLayout. Often, it is convenient to reduce the page margins for usage on the screen; this can be done in DocumentPageScreen layout.

7.The font selection system

In TeXmacs, fonts have five main characteristics:

Notice that in the font selection system of LaTeX 2ε, the font name and family are only one (namely, the family). Notice also that the base font size is specified for the entire document in DocumentFontSize.

8.Mastering the keyboard

8.1.General prefix rules

Since there are many keyboard shortcuts, it is important to have some ways of classifying them in several categories, in order to make it easier to memorize them. As a general rule, keyboard shortcuts which fall in the same category are identified by a common prefix. The main such common prefixes are:

C-x
Control key based shortcuts are used for frequently used editing commands. They depend very much on the “look and feel” in EditPreferences. For instance, if you use an Emacs-compatible look and feel, then the shortcuts of the form C-x correspond to Emacs commands, like C-y for pasting text.
A-x
The alternate key is used for commands which depend on the mode that you are in. For instance, A-s produces strong text in text mode and a square root sqrt () in math mode. Notice that escape escape is equivalent to A-.
M-x
The meta key is used for general purpose TeXmacs commands, which can be used in all modes. For instance, M-! produces a label. It is also used for additional editing commands, like A-w for copying text if you use the Emacs look and feel. Notice that escape is equivalent to M-.
H-x
The user keyboard modifier key is used for producing special symbols like Greek characters in math mode. You may configure your keyboard so as to let caps-lock play the rôle of the hyper key. The F5 is equivalent to H-.

We recall that the particular modifier keys which are used in order to obtain the M- and H- prefixes can be configured in EditPreferences.

8.2.Some fundamental keyboard shortcuts

Some standard keyboard actions which are valid in all modes are:

S-return
always starts a new paragraph.
C-backspace
remove the containing object or environment.
A-space
insert a small space.
A-S-space
insert a small negative space.
M-A-home
manually set start of the selection.
M-A-end
manually set end of the selection.
M-<
go to the start of the document.
M->
go to the end of the document.

8.3.Keyboard shortcuts for text mode

To write a text in an european language with a keyboard which does have the appropriate special keys, you can use the following shortcuts to create accented characters. Note that they are active regardless of the current language setting.

Shortcut Example Shortcut Example
A-' Acute ´ A-' e é A-‘ Grave ‘ A-‘ e è
A-^ Hat ˆ A-^ e ê A-" Umlaut ¨ A-" e ë
A-~ Tilde ˜ A-~ a ã A-C Cedilla ¸ A-C c ç
A-U Breve ˘ A-U g ğ A-V Check ˇ A-V s š
A-O Above ring ˚ A-O a å A-. Above dot ˙ A-. z ż
A-H Hungarian ˝ A-H o ő

Table 2. Typing accented characters.

Special characters can also be created in any language context:

Shortcuts
S-F5 a æ S-F5 A Æ S-F5 a e æ S-F5 A E Æ
S-F5 o ø S-F5 O Ø S-F5 o e œ S-F5 O E Œ
S-F5 s ß S-F5 S SS
S-F5 ! ¡ S-F5 ? ¿ S-F5 p § S-F5 P £

Table 3. Typing special characters.

When you press the " key, an appropriate quote will be inserted. The quote character is chosen according to the current language and the surrounding text. If the chosen quoting style is not appropriate, you can change it in EditPreferencesKeyboardAutomatic quotes. You can also insert raw quotes:

Shortcuts
S-F5 " " , ,
< tab > tab
< < « > > »

Table 4. Typing raw quotes.

“English” quotes are considered ligatures of two successive backticks or apostrophes. They can be created with ‘ ‘ and ' ' but these are not actual keyboard commands: the result is two characters displayed specially, not a special single character.

Some shortcuts are available in specific language contexts. You can set the text language for the whole document with DocumentLanguage or only locally with FormatLanguage (see generalities for typing text).

Hungarian Spanish Polish
S-F5 o ő ! tab ¡ S-F5 a ą S-F5 o ó
S-F5 O Ő ? tab ¿ S-F5 A Ą S-F5 O Ó
S-F5 u ű ! ‘ ¡ S-F5 c ć S-F5 s ś
S-F5 U Ű ? ‘ ¿ S-F5 C Ć S-F5 S Ś
S-F5 e ę S-F5 x ź
S-F5 E Ę S-F5 X Ź
S-F5 l ł S-F5 z ż
S-F5 L Ł S-F5 Z Ż
S-F5 n ń S-F5 z tab ź
S-F5 N Ń S-F5 Z tab Ź

Table 5. Language-specific text shorthands.

Language-specific shortcuts override generic shortcuts; for example, you cannot easily type “ø” in hungarian context.

8.4.Hybrid commands and LaTeX simulation

TeXmacs allows you to enter LaTeX commands directly from the keyboard as follows. You first hit the \-key in order to enter the hybrid LaTeX/TeXmacs command mode. Next you type the command you wish to execute. As soon as you finished typing your command, the left footer displays something like

    <return>: action to be undertaken

When you hit the return-key at this stage, your command will be executed. For instance, in math-mode, you may create a fraction by typing \ f r a c return.

If the command you have typed is not a (recognized) LaTeX command, then we first look whether the command is an existing TeXmacs macro, function or environment (provided by the style file). If so, the corresponding macro expansion, function application or environment application is created (with the right number of arguments). Otherwise, it is assumed that your command corresponds to an environment variable and we ask for its value. The \-key is always equivalent to one of the commands M-i l, M-i e, M-i a, M-i # or M-i v.

To insert a literal \ (backslash) character, you can use the S-F5 \ sequence.

8.5.Dynamic objects

Certain more complex objects can have several states during the editing process. Examples of such dynamic objects are labels and references, because the appearance of the reference depends on a dynamically determined number. Many other examples of dynamic markup can be found in the documentation about writing style files.

When entering a dynamic object like a label using M-!, the default state is inactive. This inactive state enables you to type the information which is relevant to the dynamic object, such as the name of the label in our case. Certain dynamic objects take an arbitrary number of parameters, and new ones can be inserted using tab.

⟨label|pythagoras

Figure 1. Inactive label

When you finished typing the relevant information for your dynamic object, you may type return in order to activate the object. An active dynamic object may be deactivated by placing your cursor just behind the object and hitting backspace.

8.6.Customization of the keyboard

It is possible for the user to modify the keyboard behaviour. In order to do so, we suggest first to look at the files in the directory $TEXMACS_PATH/progs/keyboard, where the standard keyboard behaviour is defined. Then you may redefine the keyboard behaviour in your private initialization file.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".