The Jolly Writer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 272

The Jolly Writer

The Jolly Writer


© 2020, Joris van der Hoeven

Dépot légal : août 2020


ISBN : 978-2-9572100-0-8
Première édition

Achevé d'imprimer en août 2020 par W i r m a c h e n D r u c k


Mühlbachstraße 7, 71522 Backnang, Allemagne
Imprimé en Allemagne

Scypress
6, rue de Versailles
78460 Chevreuse
The Jolly Writer
Joris van der Hoeven
Table of contents
PREFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.1 How to read this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2 Making science beautiful . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 Structuring your documents . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.4 The joy of wysiwyg-ness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5 TEXMACS as a structured editor . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.6 Towards a scientific office suite . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.7 Creating your own extensions . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.8 TEXMACS and (LA)TEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2 THE USER INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25


2.1 Basic principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 The main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3 Mastering the keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.1 Notation for keyboard shortcuts . . . . . . . . . . . . . . . . . . . . . 28
2.3.2 How to remember keyboard shortcuts . . . . . . . . . . . . . . . . . 29
2.3.3 Hybrid commands and LATEX emulation . . . . . . . . . . . . . . . 30
2.3.4 Common modifier combinations and prefix rules . . . . . . . . . 31
2.3.5 Substitution rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3.6 Standards conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4 Organization of the menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.5 Dialogue windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.6 User preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.7 The current focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.8 Finding documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

3 READY, STEADY, GO! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42


3.1 Typing ordinary text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.2 Foreign languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.2.1 Latin languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3 Starting a new document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.1 Entering the title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.3.2 Entering the abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.4 Subdividing your document into sections . . . . . . . . . . . . . . . . . . 50
3.5 Quotations and prominent statements . . . . . . . . . . . . . . . . . . . . 51
3.5.1 Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.5.2 Quotations and poetry . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.5.3 Other prominent text . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6 Item lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5
6 TABLE OF CONTENTS

3.7 Special textual markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56


3.8 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.8.1 Font management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.8.2 Selecting a font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.8.3 Font characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.9 Paragraph layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.10 Page layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4 MATHEMATICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.1 Incorporating mathematical formulas . . . . . . . . . . . . . . . . . . . . . 66
4.2 Mathematical symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.2.1 Letter-like symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.2.2 Other symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.2.3 Keyboard shortcuts for common symbols . . . . . . . . . . . . . . . 71
4.2.4 When a symbol is hard to find . . . . . . . . . . . . . . . . . . . . . . 73
4.3 Two-dimensional mathematical markup . . . . . . . . . . . . . . . . . . . 74
4.4 Big operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.5 Large delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.6 Wide accents and extensible arrows . . . . . . . . . . . . . . . . . . . . . . 79
4.7 Matrices and mathematical tables . . . . . . . . . . . . . . . . . . . . . . . 80
4.8 Commutative diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.9 Semantics of mathematical formulas . . . . . . . . . . . . . . . . . . . . . 83
4.10 Common errors and syntax corrections . . . . . . . . . . . . . . . . . . . 84
4.11 Semantics of mathematical symbols . . . . . . . . . . . . . . . . . . . . . 86
4.12 Customizing the semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5 TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.1 Different flavors of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.2 Basic table editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.3 Cell properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.3.1 Cell operation modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.3.2 Width and height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.3.3 Borders and padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.3.4 Horizontal and vertical alignment . . . . . . . . . . . . . . . . . . . . 95
5.3.5 Line-wrapping and block content . . . . . . . . . . . . . . . . . . . . 96
5.4 Table properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.4.1 Number of rows and columns . . . . . . . . . . . . . . . . . . . . . . 97
5.4.2 Width and height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.4.3 Borders and padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.4.4 Alignment with respect to the surrounding text . . . . . . . . . . . 98
5.4.5 Breaking up large tables . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.5 Joined cells and subtables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.6 Artistic tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.7 Table macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6 CONNECTED DOCUMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.1 Labels and references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
TABLE OF CONTENTS 7

6.2 Hyperlinks and actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106


6.3 Inserting images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.4 Content extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.4.1 Tables of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.4.2 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4.3 Glossaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6.4.4 Lists of figures and tables . . . . . . . . . . . . . . . . . . . . . . . . 110
6.4.5 Multiple extractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.5 Bibliographies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.5.1 Importing bibliographic references . . . . . . . . . . . . . . . . . . 112
6.5.2 Inserting citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.5.3 Compiling the bibliography . . . . . . . . . . . . . . . . . . . . . . . 114
6.5.4 Quick survey of BIBTEX . . . . . . . . . . . . . . . . . . . . . . . . . . 116
6.5.4.1 Entry types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6.5.4.2 Field types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
6.5.4.3 Field values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
6.5.5 Editing BIBTEX entries with TEXMACS . . . . . . . . . . . . . . . . . 121
6.5.6 Managing your personal bibliographic database . . . . . . . . . 122
6.5.6.1 Searching and rendering of entries in the database . . . . 123
6.5.6.2 Insertion and removal of entries . . . . . . . . . . . . . . . . 123
6.5.6.3 Importing and exporting entries . . . . . . . . . . . . . . . . 124
6.5.6.4 Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.5.7 Local bibliographies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
6.5.8 Multiple bibliographies . . . . . . . . . . . . . . . . . . . . . . . . . . 125
6.6 Large documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

7 ADVANCED LAYOUT FACILITIES . . . . . . . . . . . . . . . . . . . . . . . . . 127


7.1 General style considerations . . . . . . . . . . . . . . . . . . . . . . . . . . 127
7.2 Line breaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.2.1 The first-fit versus the global method . . . . . . . . . . . . . . . . . 131
7.2.2 Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.2.3 Manual line breaking . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.2.4 Microtypography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.3 Page breaking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.4 Multiple text flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.4.1 Footnotes and marginal notes . . . . . . . . . . . . . . . . . . . . . . 137
7.4.2 Floating figures and tables . . . . . . . . . . . . . . . . . . . . . . . . 138
7.4.3 Multiple columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.5 Finishing touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.5.1 Horizontal spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.5.2 Vertical spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7.5.3 Adjusting the position and extents . . . . . . . . . . . . . . . . . . 143
7.5.4 Phantoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.6 Miscellaneous typesetting utilities . . . . . . . . . . . . . . . . . . . . . . 144
7.6.1 Linear transformations . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.6.2 Device dependent rendering . . . . . . . . . . . . . . . . . . . . . . 145
8 TABLE OF CONTENTS

7.6.3 Repeating a pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146


7.6.4 Line breaking of transformed text . . . . . . . . . . . . . . . . . . . 146
7.7 Font effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.8 Graphical effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

8 DRAWING PICTURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151


8.1 Introduction . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
8.2 Starting new pictures . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
8.3 Graphics mode . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
8.4 Graphical objects . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
8.5 Style properties . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
8.6 Editing groups of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8.7 Snapping . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

9 LAPTOP PRESENTATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166


9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
9.2 Themes and style options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
9.3 Switching, folding, and unrolling . . . . . . . . . . . . . . . . . . . . . . . 168
9.4 Overlays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
9.5 Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
9.6 Graphical screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
9.7 Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
9.7.1 Basic animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
9.7.2 Merging and time bending . . . . . . . . . . . . . . . . . . . . . . . 175
9.7.3 Continuous deformations . . . . . . . . . . . . . . . . . . . . . . . . 176
9.7.4 Graphical animations . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
9.8 Exporting beamer presentations . . . . . . . . . . . . . . . . . . . . . . . 179

10 SPECIAL EDITING FACILITIES . . . . . . . . . . . . . . . . . . . . . . . . . . 180


10.1 Cut and paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
10.2 Search and replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
10.3 Spell checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
10.4 Undo and redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
10.5 Structured editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
10.6 Structured cursor movement . . . . . . . . . . . . . . . . . . . . . . . . . 184
10.7 Structured variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
10.8 Positioning and resizing objects . . . . . . . . . . . . . . . . . . . . . . . 186
10.9 Versioning tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

11 SCIENTIFIC COMPUTATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . 191


11.1 Shell-like sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
11.1.1 Starting and ending sessions . . . . . . . . . . . . . . . . . . . . . . 191
11.1.2 Editing sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
11.1.3 Input and output options . . . . . . . . . . . . . . . . . . . . . . . . 193
11.1.4 Alternative session styles . . . . . . . . . . . . . . . . . . . . . . . . 194
11.1.5 Miscellaneous extras . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
TABLE OF CONTENTS 9

11.2 Plug-ins as scripting languages . . . . . . . . . . . . . . . . . . . . . . . 197


11.3 Spreadsheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
11.4 Remote plug-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

12 GET IT YOUR WAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202


12.1 Creating macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
12.1.1 Hello Nebuchadnezzar . . . . . . . . . . . . . . . . . . . . . . . . . 202
12.1.2 Adding arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
12.1.3 Customizing an existing macro . . . . . . . . . . . . . . . . . . . . 204
12.1.4 Anatomy of a macro . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
12.2 Pilgrimage to the source . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
12.2.1 Documents as trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
12.2.2 Selecting your preferred presentation of source code . . . . . 208
12.2.3 Data or program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
12.2.4 The ASCII religion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
12.3 Grouping your macros together . . . . . . . . . . . . . . . . . . . . . . . 213
12.3.1 Preambles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
12.3.2 Style packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
12.4 The style-sheet language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
12.4.1 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
12.4.2 Macro expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
12.4.3 Formatting primitives . . . . . . . . . . . . . . . . . . . . . . . . . . 217
12.4.4 Evaluation control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
12.4.5 Control flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
12.4.6 Computational markup . . . . . . . . . . . . . . . . . . . . . . . . . 222

13 DESIGNING WITH STYLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223


13.1 Some words of caution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
13.2 Anatomy of a style package . . . . . . . . . . . . . . . . . . . . . . . . . . 225
13.3 Some tips before things get technical . . . . . . . . . . . . . . . . . . . . 228
13.4 Customizing the general page layout . . . . . . . . . . . . . . . . . . . 232
13.5 Processing title information . . . . . . . . . . . . . . . . . . . . . . . . . . 233
13.6 Customizing sectional tags . . . . . . . . . . . . . . . . . . . . . . . . . . 234
13.7 Customizing numbered textual environments . . . . . . . . . . . . . 236
13.8 Customizing list environments . . . . . . . . . . . . . . . . . . . . . . . 238

14 EXTEND BEYOND IMAGINATION . . . . . . . . . . . . . . . . . . . . . . . . 240


14.1 A quick introduction to SCHEME . . . . . . . . . . . . . . . . . . . . . . . 240
14.1.1 SCHEME sessions and atomic data types . . . . . . . . . . . . . . 240
14.1.2 Lists and SCHEME trees . . . . . . . . . . . . . . . . . . . . . . . . . 241
14.1.3 Declaring functions and macros . . . . . . . . . . . . . . . . . . . 243
14.1.4 Basic control structures . . . . . . . . . . . . . . . . . . . . . . . . . 244
14.2 Customizing the graphical user interface . . . . . . . . . . . . . . . . . 245
14.2.1 Your personal boot file . . . . . . . . . . . . . . . . . . . . . . . . . 245
14.2.2 Adding your own keyboard shortcuts . . . . . . . . . . . . . . . 246
14.2.3 Adding your own menus . . . . . . . . . . . . . . . . . . . . . . . . 247
10 TABLE OF CONTENTS

14.3 Extending the editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248


14.3.1 Manipulation of active content . . . . . . . . . . . . . . . . . . . . 248
14.3.2 Contextual overloading . . . . . . . . . . . . . . . . . . . . . . . . . 250
14.4 Typesetting via SCHEME . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
14.4.1 Hello world! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
14.4.2 Integration into the editor . . . . . . . . . . . . . . . . . . . . . . . 252
14.4.3 Highlighting subexpressions . . . . . . . . . . . . . . . . . . . . . 253
14.4.4 Circulant matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Preface

The ultimate aim of a typesetter is to compose books in such a perfect manner


that nobody will notice it. Nothing is more dishonorable than to make a reader
stumble over an ill-placed comma. What the typesetter wants is to bury you
cozily in your armchair, with your complete focus on the book, and in a spell
not to be broken by trivial typographic details.
If you are a writer instead of a reader, then it takes far more than an armchair
to put you in the right creative state of mind. The ideal text editor should help
you to maintain this state for as long as possible. You don't want to be torn out
of trance by a misguided comma key that suddenly starts inserting apostro-
phes. The ideal writing tool should behave as your first art pen from school:
it should unleash your desire to write, make you feel one with the tool, and
occasionally surprise you with the beauty of your own words.
Back in 1996, when I was writing my PhD in computer science, none of the
existing text editors were even close to this ideal. General purpose editors such
as MICROSOFT WORD produced documents of poor quality and made it diffi-
cult to type mathematical formulas. In order to compose professional-looking
scientific documents, the main alternative was to use (LA)TEX. Although this
solution was nice from the reader's perspective, it forced writers to encode
their prose in a technical pseudo-language. (LA)TEX then relied on an akward
“compilation” process in order to transform this pseudo-code into a printable
and human-readable document.
After my PhD, this unsatisfactory state of the art led me to start the devel-
opment of GNU TEXMACS, a free office suite for scientists. Before anything
else, TEXMACS allows you to create beautiful scientific documents with special
types of content, such as mathematical formulas or technical pictures. TEXMACS
also provides interfaces for various external systems for symbolic and numeric
computations. Recent versions further include a laptop presentation facility,
versioning tools, integrated documentation, etc. In the areas of science and
education, the ultimate aim is to provide a complete suite for the most fre-
quent tasks on a computer.
One distinctive feature of TEXMACS is that it does not compromise on quality.
First of all, the final documents have a professional typesetting quality, similar
or even superior to what is achieved by (LA)TEX. Yet, user-friendliness has not
been sacrificed, since the system also provides an intuitive wysiwyg (what-
you-see-is-what-you-get) graphical interface. Finally, TEXMACS favors the com-
position of so-called “structured” documents, in contrast to existing wysiwyg
interfaces of general purpose office suites, which are mainly “presentation ori-
ented”.

11
12 PREFACE

The name “GNU TEXMACS” is explained by the facts that TEXMACS is part of
the GNU project and that some initial inspiration was drawn from the (LA)TEX
systems [36, 38] and GNU EMACS [53]. However, it has become clear over
time that this choice of name was one of the biggest mistakes of the project.
Indeed, the name incorrectly suggests that TEXMACS is some kind of interface
to (LA)TEX. So let me stress once and for all: the current TEXMACS system is
completely independent from (LA)TEX. Of course, TEXMACS does provide con-
verters between its native format and LATEX.
As a free software, the development of TEXMACS has benefitted from the help of
a wide community of contributors around the globe. Particular thanks go to the
following main co-developers throughout the years: David ALLOUCHE, Miguel
DE BENITO DELGADO, Darcy CHEN, Andrey GROZIN, Massimiliano GUBINELLI,
Philippe JOYEZ, Grégoire LECERF, Henri LESOURD, François POULAIN, and
Denis RAUX. Further thanks go to the many other contributors and supporters;
see http://www.texmacs.org/tmweb/about/authors.en.html for a more
extensive list. I am indebted to Basile AUDOLY and Kostas OIKONOMOU for
their careful proofreading.
I also wish to express my gratitude to those who have provided financial sup-
port to the TEXMACS project: CNRS, CRI-TECH de Haute-Savoie, DIGITEO, Rennes
MÉTROPÔLE, SPRINGER-VERLAG, INRIA, Dan GRAYSON, and Christoph BENZ-
MUELLER.

TEXMACS is built on top of a lot of other software. The QT, GUILE, FREETYPE, and
HUMMUS libraries are particularly essential [47, 33, 63, 34]. Recent versions
integrate an increasing amount of artwork, such as the TEX Gyre fonts [32] (the
main font of this book is PAGELLA), various “Subtle Patterns” [61], more fonts
from DAFONT [9], and further freely available pictures from WIKIMEDIA [65].
Last but not least, I wish to thank SYLVIE, JUDITH, and NIELS for their support
and patience.
Chapter 1
Introduction

1.1 How to read this book


The fact that you are reading these lines makes it is quite likely that you are
already a convinced TEXMACS user. Maybe you actually bought this book in
order to support our development efforts rather than to actually read it. Indeed,
we tried to make TEXMACS so user-friendly that you will naturally learn the
software while using it. The system also ships with a lot of integrated doc-
umentation that is most easily searched and consulted from within TEXMACS
itself.
So why read this book? If you are a TEXMACS user or plan to become one,
then you probably spend a considerable amount of your time on writing doc-
uments, doing computations, or making presentations from your laptop. In
comparison, reading parts of this book will be a minor investment that might
help you get the most out of TEXMACS.
On top of being an up-to-date manual for TEXMACS 2.1, this book indeed con-
tains a substantial amount of information that is not so obvious to acquire
just by using the software. For example, you can learn some of the basics of
professional typesetting; typing kilometers of text will not miraculously instill
such knowledge into your mind. Similarly, although every single feature of
TEXMACS is rather self-explanatory, interesting results can be obtained through
less obvious combinations of them. In this book, we present several tips and
tricks of this kind.
One of the original motivations for developing TEXMACS was that traditional
office suites such as MICROSOFT OFFICE [42] and LIBREOFFICE [13] offered poor
support for scientific users. For instance, the typesetting quality of mathe-
matical formulas was low in comparison to (LA)TEX [36, 38] and visual format-
ting was favored over structural markup (see section 1.3). For this reason,
TEXMACS is particularly well suited for scientists, teachers, and students. But
other types of users may also appreciate the combination of high typesetting
quality, a wysiwyg front-end (what you see is what you get), and the pos-
sibility to write structured documents [28, 21].
As a non-native English speaker, the one thing I cannot teach you is how to
write English. Pinker's The Sense of Style [44] is one excellent book that I can
recommend to any fellow scientist who wants to become a better writer. Of
course, you have a wealth of other options, such as Strunk and White's The Ele-

13
14 INTRODUCTION

ments of Style [55] or Fowler's Dictionary to Modern English Usage [14]. Besides
these classics, a few more recent style guides are Thomas and Turner's Clear
and Simple as the Truth: Writing Classic Prose [60] and Williams's Toward clarity
and grace [66]. The Cambridge Grammar of the English Language [31] is one of the
bibles on grammar, whereas Merriam-Webster's Dictionary of English Usage is
a dictionary that elevates words beyond the ordinary.
This book is organized as follows. The remainder of the present chapter is
devoted to a quick introduction to some of the main features of TEXMACS and its
design philosophy. The next chapter discusses the the graphical user interface.
These two chapters introduce the most important concepts and terminology,
so we recommend that you read them first. The other chapters are fairly inde-
pendent and organized by increasing order of difficulty.
Let us mention a few conventions that are followed throughout this book. We
use a sans serif font for menu entries: “you may create a new file using File „
New”. Sometimes, clicking on a menu button will open a new popup window
in which you have to click on yet another series of buttons. The menu notation
naturally extends to this case, as in Edit „ Preferences „ Convert „ Pdf.
We use boxes such as ⌘⇧x and - > for keyboard shortcuts. The first
example ⌘⇧x corresponds to simultaneously pressing the modifier keys
⌘ (meta) and ⇧ (shift) together with the letter x . In the second example - > ,
you first have to press and release the - key and next press and release
the > key. For more information, we refer to section 2.3.1.
Notice that the default behavior of the menus and keyboard depends on your
operating system. Indeed, TEXMACS attempts to follow the same conventions as
the other programs on your computer, and these conventions may vary with
your operating system. The default behavior can be overridden by selecting
another “look and feel” in the user preferences (Edit „ Preferences „ General).
The keyboard shortcuts in this book hold for the EMACS look and feel on MAC
computers. That said, many of them work for all look and feels, up to minor
prefix adjustments. See section 2.3.6 for more details.

1.2 Making science beautiful

Modern word processors have made it easy for just about anyone to create
nice-looking documents. Yet, there exists a difference between “nice” and
“beautiful”. A few decades ago, typesetting books was the job of professionals.
Whereas most of the typesetting can nowadays be carried out automatically,
some design decisions still have to be made by humans. So let us step back
and ask ourselves what makes a document attractive.
Typography is a matter of technical craftsmanship. Although we might com-
pare it with architecture or the building of a bridge, typography does not
involve emotions, as do arts like poetry, painting, or literature.
1.2 MAKING SCIENCE BEAUTIFUL 15

One fundamental idea about the esthetics of technology is that beauty is


strongly correlated with adequacy to the purpose. A skillfully conceived and
presented book usually provokes a quiet feeling of harmony, whereas clumsy
formatting or an abundance of exuberant fonts will distract and thereby irri-
tate the reader. In a sense, the better the typesetting quality, the less you will
notice it. An advertiser, on the contrary, will use flashy colors and bold fonts
to attract your attention. This may convince you to buy washing powder, but
it does not make you better at differential geometry.

How to put this into practice? When starting a new document, you will first
have to decide on the global layout, such as the page size, the extent of the
actual text, the number of columns, the main fonts, etc. Here are a few useful
rules:

• Do not make your paragraphs too wide, since wide paragraphs make it
harder for the eye to find the next line, and thereby cause fatigue for the
reader.

• Consistently stick to the same layout throughout your document. Use


a different layout only if there is a special reason for it.

• In particular, keep the number of fonts to a minimum. Use alternative


fonts for specific purposes only.

• Use fonts and a general layout that are well suited to the medium of
publication and to the intended purpose. For example, sans serif fonts
are more readable on a computer screen (so you might prefer them for
web pages and laptop presentations) but may look unprofessional on
paper.

To ease the choice of a general layout, TEXMACS offers document styles for various
purposes: you may select Document „ Style „ Article for writing an article, Doc-
ument „ Style „ Beamer for creating a laptop presentation, and so on. TEXMACS
also supports some of the most important styles used by publishing compa-
nies. For instance, Document „ Style „ Article „ Springer „ llncs can be used for
articles in Springer's series of “Lecture Notes on Computer Science”.

Style files rely on markup to map specific intentions of the author to appro-
priate layouts. For example, it is customary to use either an italic or a bold font
for important text. Such choices are made once and for all in the document
style and then consistently applied throughout the entire document. We will
return to this issue in the next section about document structure. For now, we
observe once again that the consistent use of a minimal number of fonts and
layouts is helpful in several ways: it allows the reader to stay focussed, without
getting distracted by incongruous design decisions; it eases navigation within
the document; and ideas can be transmitted through the mere use of appro-
priate typography.
16 INTRODUCTION

The same lines of thought also apply to the main text. Many authors put a lot
of effort into the science, some good will into the English spelling, and little
energy into punctuation and other typographic issues. Fortunately, profes-
sional typesetting systems such as (LA)TEX and TEXMACS have taken over a large
part of this task. However, despite sophisticated algorithms for spacing, line-
breaking, page-breaking, positioning individual characters, etc., they occasion-
ally require some human assistance.
Basic punctuation rules specify that you enter a space after a period “.” at the
end of a sentence, before starting a new one. If you correctly apply this rule,
then TEXMACS will understand your intent and use this during the typesetting
process (for instance, the space between two sentences will be slightly larger
than between two ordinary words). Although TEXMACS does not forbid you to
omit spaces after periods, it will fail to do the typesetting correctly if you break
basic punctuation rules.
Explicit human intervention is typically required when using periods “.” for
other purposes, such as decimal dots, or inside abbreviations. Note that the
space after an abbreviation is somewhat smaller than after the final period
of a sentence. By identifying abbreviations through the use of appropriate
markup, you may help TEXMACS to get the typesetting right.
Punctuation, typography, and even spelling are often perceived as dull and
unimportant details. Please keep in mind that some of your readers might
even if you don't. Your sloppiness may easily irritate or confuse others and lead
to ambiguities or even errors. The good news is that it requires only minimal
awareness and discipline to do things right in the first place. Furthermore,
TEXMACS will do a big part of the job for you, as long as you follow a few basic
rules. In sections 3.1 and 3.7, we will come back to these issues in more detail.

1.3 Structuring your documents


We have already stressed the importance of a consistent layout and the use of
appropriate fonts. TEXMACS has been designed so as to make it as easy as pos-
sible to create so-called structured documents. When properly used, this ensures
in particular a uniform visual appearance.
The aim of structured documents is to focus on meaning or intent rather than
presentation. For example, instead of manually typesetting all section titles in
a bold 17 point sized font, we urge you to use a special markup element section
(also called tag) that is dedicated to section titles. This has many advantages:
TEXMACS will automatically number your sections, guarantee a uniform pre-
sentation of all section titles, build an automatic table of contents, etc. Further-
more, whenever you change your mind, and wish to opt for another rendering
of section titles, then it will not be necessary to modify the layout of every
individual title in your document: it suffices to tell TEXMACS once and for all
how to display the section tag.
1.3 STRUCTURING YOUR DOCUMENTS 17

The rendering of a document usually reflects its structure, which makes it nat-
ural to edit structured documents in a wysiwyg manner. For instance, it is
likely that a short line, typeset using a bold 17 point font, and starting with
a number, is always a section title. However, some of the structure may not
directly be apparent: from the mere rendering of
n
n
= 2 n, (1.1)
k
k=0

it is not clear whether nk was entered as a vector or as a binomial coefficient.


Indeed, if we were not aware of the existence of the appropriate binom tag,
then we might have entered the binomial coefficient as a vector instead, which
has a similar visual appearance. The use of appropriate tags becomes essen-
tial whenever the precise semantics of the formula matters. This happens for
instance when you want to check the correctness of the formula, by copying it
into your favorite computer algebra system. Another example concerns French
translations, in which case the traditional notation for binomial coefficients
becomes C nk.
Even in cases when it seems overkill to use structural markup for producing
a certain visual effect, doing so remains a good habit. On the one hand, the sys-
tematic use of appropriate markup helps you to formalize what you are doing.
On the other hand, structured documents are more sustainable, in the sense
that they can more easily be reused in situations that you did not anticipate,
initially.
The precise way in which markup elements are rendered is specified in so-
called style files and packages. If you are new to TEXMACS, then you do not
have to worry about how the actual translations take place: just select a style
file that suits your needs and aesthetic preferences. The standard style files
and packages offer a large number of markup elements that can be used in
common situations.
More advanced users may actually want to define or customize some of the
document structure by themselves. This typically happens when you intro-
duce your own notations or if you frequently need a specific non-standard
layout pattern. The simplest way to add a new markup element to TEXMACS is
through the definition of a macro, using Tools „ Macros „ New macro. By default,
such macro definitions are put in the preamble of your document. If you want
to reuse the same macros in several of your documents, then you may group
them together in your own style files or packages. See chapter 12 for more
details.
The design of more and more complex macros requires some skill, but one nice
aspect of the integrated nature of TEXMACS is that it is easy to study the way the
built-in style files and packages work. For example, if your cursor is inside the
binomial coefficient of formula (1.1), then the precise markup element binom
that was used to produce this coefficient is displayed on the status and focus
bars of your window (see Figure 2.1 on page 27), as well as in the Focus menu.
18 INTRODUCTION

Using Focus „ Preferences „ Edit macro you may then edit the macro defini-
tion that specifies the rendering of the binom tag. You may also inspect the
style package in which the binom tag is defined, using Focus „ Preferences „ Edit
source. Through trial and error, this allows you to progressively learn how to
write more and more sophisticated style packages by yourself.

1.4 The joy of wysiwyg-ness


In the same way as professional typesetters strive to produce documents that
allow readers to fully concentrate on what they are reading, we feel that good
text editors should allow authors to remain entirely focussed on the creative
process of writing. Whereas readers may get distracted by typos, clumsy for-
matting, or loud fonts, the writing process gets interrupted whenever you are
obliged to address technical details before you can enter your thoughts into the
computer.
One prerequisite for maximal user comfort is to use a wysiwyg (what you see is
what you get) editor. It is indeed most natural to edit documents in the actual
form that you want to look in print; this is probably also closest to your mental
representation of the document. However, mere wysiwyg-ness is not enough,
since the precise way in which documents are being edited should also be both
natural and efficient.
For instance, several basic mathematical formula editors propose ”palettes”
with the available mathematical symbols, which tend to clutter the screen.
If even simple symbols need to be entered via these palettes, then this also
gives rise to a lot of back and forth movements between the keyboard and
the mouse. Similarly, most front-ends to (LA)TEX force you to remember a long
list of symbol names, or to interrupt the writing process just to look up the
appropriate name of a symbol. In TEXMACS, a more efficient and user-friendly
system was developed from scratch. Most symbols can be entered in an intu-
itive fashion, following a small number of basic rules (see section 4.2). For
example, you may enter →, ↦, 𝛼, ⩽ / , and ⊆ via the keyboard shortcuts - > ,
| - > , a ⇥ , < = / , and < ⇥ ⇥ = , respectively.

Historically speaking, early wysiwyg editors such as MICROSOFT WORD often


lacked adequate tools for the efficient composition of scientific documents,
especially those that contained many mathematical formulas. Moreover, their
focus on visual rather than logical design often resulted in documents of poor
quality. For this reason, such editors became a frequent target of mockery,
“wysiwyg” being denigrated as “what you see is all you've got” [38, section 1.5].
As a result, the (LA)TEX movement took the rather dramatic step of abandoning
the wysiwyg idea altogether. In (LA)TEX, documents are encoded in a tex-
tual pseudo-language, and a special compiler is required in order to obtain
the desired printable versions. However, not everyone is comfortable using
such a pseudo-language, which forces you to imagine the text you are typing,
instead of actually seeing it.
1.4 THE JOY OF WYSIWYG-NESS 19

Nevertheless, some of the historical criticism on wysiwyg editors is indeed


justified and points to real problems. For example, the visual presentation
of a document does not necessarily reflect its full structure, as we saw in the
binomial coefficients example (1.1) of the previous section. But this drawback
mostly vanishes for well written documents, under the reasonable assumption
that the author (yourself) always used appropriate markup at the first place:
if you see a binomial coefficient, then it is a binomial coefficient. In TEXMACS, the
problem is further reduced by the fact that it is not only the final presentation
on paper that matters, but rather the “full interaction” between the text and
the author inside the editor. For instance, we already noticed that the struc-
ture becomes apparent when positioning the cursor inside. Similarly, one may
select an alternative rendering style, and even a “LATEX-source-like” rendering
style in which the full structure is visually exposed.
Another issue concerns the ability to position the cursor at all relevant places
inside the text. For example, consider the text “bolditalic”. In most wysiwyg
editors, there is a single cursor position available between the bold 'd' and
the first italic 'i', which makes it difficult to guess whether an extra keystroke
typed at this cursor position will produce bold, italic or plain text. By con-
trast, TEXMACS offers three cursor positions [24], one after the 'd' inside the bold
environment, one between the two environments, and one before the 'i' inside
the italic environment. The user knows exactly which of these positions the
cursor is in, thanks to visual clues in the interface: in particular, the first englo-
bing environment is displayed at the bottom-right of the window.
Cursor movement raises some other interesting problems in structured docu-
ments with formulas that heavily rely on two dimensional layout. For instance,
some early structured wysiwyg editors would move the cursor according to
the abstract structure. This typically implied that pressing the → button at the
end of a numerator of fraction would move the cursor to the start of the denom-
inator. It turns out that this way of doing it can be very confusing. In TEXMACS,
the cursor movement is mostly graphical: if you press → , then you will go to
the right, if possible [24, 1]. There are some exceptions, such as a cursor at
the end of the line, or the cursor movement in computer algebra sessions, in
which case it is natural to jump from one input to the other when moving
up and down.
Other historical arguments against wysiwyg editors are more dubious. For
example, some people believe that a “format” such as (LA)TEX is “more script-
able” in the sense that (LA)TEX documents can more easily be generated,
combined and manipulated by external tools than TEXMACS documents. On
a superficial level and for some very simple tasks, this may be so, because oper-
ating systems include many tools for the manipulation of text files. However,
since TEXMACS documents are truly structured, it is unnatural to manipulate
them as strings: one should rather regard them as expression trees, to be manip-
ulated in a scripting language that can handle such objects. A large part of
the TEXMACS interface is written in the SCHEME language, whose syntax and
other features are particularly well suited for this task. Moreover, for those
20 INTRODUCTION

who really want to manipulate TEXMACS documents as text files, we offer sev-
eral plain text formats, such as XML, SCHEME expressions, etc. The syntax of
these formats is systematic and well-defined, contrary to (LA)TEX.
In summary, the most annoying drawbacks of early wysiwyg text editors have
been addressed in TEXMACS through the implementation of various, occasion-
ally novel, ideas. The further advantages of wysiwyg editors become most
apparent for two dimensional layouts. For example, consider a table or a matrix.
In TEXMACS, it is easy to insert a new column using a keyboard shortcut ( ⌥←
or ⌥→ ), the menus, or the toolbars. In (LA)TEX or HTML, this requires you to
modify every individual row of the table. Technical pictures are an even more
convincing example. The original LATEX picture environment invites you to
enter the coordinates of each individual component. No wonder that (LA)TEX
eliminated pictures from mathematical textbooks more surely than the BOUR-
BAKI movement did!

1.5 TEXMACS as a structured editor


We have explained why structured documents help you to ensure a uniform
presentation. We also discussed how TEXMACS allows you to efficiently write
such documents, using a user-friendly, wysiwyg interface. You may even
create new kinds of markup yourself, using the integrated macro language.
Another important advantage of structure is that it leads to new opportuni-
ties for enhancing the editing experience.
One of the main ways to exploit structure inside the TEXMACS editor is through
the Focus menu. The current focus refers to the innermost tag at the current
cursor position. For example, assume that we positioned the cursor after the
two in the following equation:

x 2| x
=1 + 3. (1.2)
y y
The current focus is highlighted using a cyan box, whereas the grey boxes cor-
respond to the other tags that contain the current cursor at higher levels.
The entries in the Focus menu allow you to directly perform editing opera-
tions on the current focus. For instance, in the example (1.2), the superscript
can be turned into a subscript using Focus „ Superscript „ Subscript or the key-
board shortcut ⌃⇥ . You may also jump to the next and previous scripts inside
the document using Focus „ Next similar and Focus „ Previous similar (or ⌃⇟
and ⌃⇞ ), or obtain contextual help on the “superscript” tag rsup using Focus „
Describe. See sections 2.7 and 10.5–10.7 for more details.

The document structure is also taken into account for several common editing
operations. For example, when searching “a” inside a mathematical formula,
TEXMACS will only search for the symbol “a” inside other mathematical for-
mulas. If you were editing a (LA)TEX source file, then such a search would
typically result in many parasite non-mathematical “a” hits inside the main
1.6 TOWARDS A SCIENTIFIC OFFICE SUITE 21

text. Using the TEXMACS search facility, it is even possible to find text in a struc-
x
tured way (see section 10.2). For instance, when searching for , you will find
any fraction in which x occurs in the numerator, such as
x 1+x 1 + √x
, , ,....
y 1+y 1 − √x

Another example of a structured editing facility concerns the computation,


presentation and editing of the differences between two versions of a file (see
section 10.9). As a general rule, the number of TEXMACS features that exploit
document structure steadily grows with the years.

1.6 Towards a scientific office suite


Besides a scientific text editor, there are several other functionalities that can
be expected from an office suite dedicated to science and education: the possi-
bility to perform scientific computations from within the editor, an easy way
to draw technical pictures, a spreadsheet facility, a laptop presentation tool,
version control, collaborative authoring over the web, maintaining databases
with bibliographic references, etc.
From early on, TEXMACS comes with interfaces for various computer algebra
systems and other mathematical software. This allows you to perform com-
plex mathematical computations directly from inside TEXMACS, while ensuring
a professional rendering and a flawless integration of such computer algebra
sessions into papers, books, and class material. Here is an example of a session
inside the MAXIMA system:
x
(%i1) diff(x x , x, 2)
x x
(%o1) x x (x x log (x) (log (x) + 1) + x x−1)2 + x x x x log (x) (log (x) + 1)2 +
x−1
x x−1 log (x) + + x x−1 (log (x) + 1) + x x−1 log (x)
x
x5 + 2 x − 1
(%i2) dx
x2 − 3 x + 7
2x−3
57 log (x 2 − 3 x + 7) 37 arctan 19 x 4 + 4 x 3 + 4 x 2 − 60 x
(%o2) − + +
2 19 4
Besides this traditional kind of interface, recent versions of TEXMACS also pro-
pose other mechanisms to interact with external software. For instance, any
TEXMACS plug-in can be used as the computational engine of the built-in spread-
sheet facility. Currently, it is also possible to use external software for silent
computations in the background, such as evaluating or simplifying a selec-
tion while editing some formula. Finally, it is fairly easy to add your own plug-
ins to external software. Chapter 11 is dedicated to the use of TEXMACS as an
interface.
22 INTRODUCTION

The technical picture editor is another extremely useful tool in the TEXMACS
office suite. Although the tool is not as complete as dedicated editors for scal-
able vector graphics, it is well suited for simple images. One important advan-
tage is that the tool is fully integrated, which makes it easy to put formulas
or hyperlinks inside your pictures. Of course, it remains possible to embed
pictures that were made using another tool into your documents. The tech-
nical picture editor is presented in detail in chapter 8.
A few decades ago, scientific presentations at conferences were done on a black-
board or using slides on an overhead projector. Nowadays, it is most common
to directly project the screen of your laptop using a beamer. TEXMACS con-
tains special markup for creating such laptop presentations, allowing you to
progressively uncover content, play simple animations and sounds, compose
complex overlays, etc. Various standard themes can be used for the general
appearance and it is easy to add your own ones using the style package mech-
anism. It should be stressed that TEXMACS presentations are very dynamic:
you may add new content or make corrections during your show. Computer
algebra sessions can also be replayed in real time. See chapter 9 for more infor-
mation about the presentation tool.
Recent developments aim at making TEXMACS more “web-aware”. Indeed,
when coauthoring papers with several people, it is fashionable to create a cen-
tral repository on the web from where such papers are accessible to everyone
and where to keep a record of all successive versions. SVN [6, 7] and GIT [62,
51] are well known versioning tools that allow you to accomplish this task.
TEXMACS comes with an interface for SVN, and a special mode for going through
the differences between various versions. Future plans exist for a centrally
available TEXMACS server, with many other features beyond mere file sharing
and version control.

1.7 Creating your own extensions


(LA)TEX [36, 38] and the GNU EMACS [53] text editor share the common strength
that they make it easy for users to extend the system. (LA)TEX allows you to
extend the system through the definition of new macros. This makes (LA)TEX
quite different from other common markup languages such as HTML [41],
where the allowed markup elements often form a fixed set, specified by a so-
called DTD. The EMACS editor comes with a so-called extension language (called
EMACS-LISP, a special dialect of LISP), which allows you to customize the editor
and to program new features. One common application is to add support for
a new programming language (e.g. syntax highlighting, automatic indenta-
tion, etc.).
TEXMACS offers several similar mechanisms for customizations and extensions.
We already mentioned the possibility of defining new macros and bundle such
macro definitions together into style files and packages (see chapters 12 and 13).
TEXMACS uses SCHEME instead of EMACS-LISP as its extension language. All
high level editing routines are written in this language and new routines can
easily be implemented by the user. In particular, the TEXMACS menus, key-
1.8 TEXMACS AND (LA)TEX 23

board shortcuts, and most elements of the graphical interface are programmed
in SCHEME. Besides, certain TEXMACS macros may occasionally call SCHEME
routines for computing their rendering. The last chapter 14 of this book con-
tains an introduction to SCHEME programming for TEXMACS.
TEXMACS offers one more extension mechanism, which is also used for the
creation of interfaces with external software. A TEXMACS plug-in consists of
a directory with a collection of various files: TEXMACS style files and packages as
above, SCHEME files with customizations or extensions of the editor, TEXMACS
files with useful documentation, and any other files of interest, such as com-
munication scripts with external programs. TEXMACS plug-ins can easily be
shared among users and it suffices to put them at a dedicated place in order
to activate them. For more details, we refer to the integrated documentation
in Help „ Interfacing.

1.8 TEXMACS and (LA)TEX


Before anything else, we stress that recent versions of TEXMACS are completely
independent from (LA)TEX [36, 38, 16]. Contrary to what its name might sug-
gest, TEXMACS is not a (LA)TEX front-end.
Initially, the development of TEXMACS got some of its inspiration from (LA)TEX
and EMACS, whence its name. For instance, TEXMACS uses the same fonts as
TEX, and borrows several of its typesetting algorithms (such as the way para-
graphs are hyphenated and broken into separate lines). The graphical interface
of older versions of TEXMACS looked similar to the EMACS interface, espe-
cially concerning keyboard shortcuts and the menus. Finally, as mentioned in
the previous section, TEXMACS offers similar extension mechanisms as (LA)TEX
and EMACS.
Over time, the differences between TEXMACS, (LA)TEX, and EMACS have become
more important. Recent versions of TEXMACS strive to use the same graphical
user interface conventions as other software on your system, although you
may still opt for an EMACS look and feel in the preferences. TEXMACS has also
continued to grow out into a complete scientific office suite, whose capacities
go far beyond the production of good looking scientific documents (see sec-
tion 1.6).
Obviously, the major advantages of TEXMACS with respect to LATEX are its higher
versatility and its user-friendly, wysiwyg graphical user interface. The inte-
grated drawing tool and presentation mode are highly convenient as well.
There are also a few less prominent improvements. For example, TEXMACS uses
better algorithms for page breaking and the computation of space between
successive lines. Mathematical formulas also carry more semantics than in
LATEX, which is important for interfacing purposes with external software. For
example, (LA)TEX makes no essential distinction between the formulas f (x + y)
and a (b + c). However, we probably meant “ f applied to x + y” versus “a mul-
tiplied with b + c”; TEXMACS encourages you to make the intended meaning
explicit.
24 INTRODUCTION

When it comes to more specialized features, (LA)TEX occasionally conserves its


advantages over TEXMACS. Due to its large user base, there are many packages
for exotic typesetting needs: if you are writing an essay on Egyptian mathe-
matics and wish to combine mathematical formulas with hieroglyphs, then you
will still need (LA)TEX. If you have special ideas on how to present algorithms,
then you may be lucky to find a LATEX package that implements precisely your
point of view. A few useful LATEX features have also not yet been implemented
in TEXMACS, such as page breaking of long tables and wrapping text around
figures. Of course, such features are on the TEXMACS developer's wish lists,
so it will only be a matter of time before they will also appear in TEXMACS.
The main advantage of LATEX with respect to TEXMACS is of a social nature:
most publishers require scientists to send final versions of papers in LATEX and
many professors force their students to learn LATEX, sometimes even through
dedicated courses. This is a sad situation for many of our users. Fortunately,
PDF is an even more standard format nowadays, so we recommend users to
systematically push publishers towards accepting either TEXMACS or PDF doc-
uments. For those who do not need to collaborate with colleagues who use
LATEX or send their work to publishers, the above “advantage” of LATEX van-
ishes. This holds in particular for high school education or for less formal
documents in academia.
Besides its lack of wysiwyg-ness, (LA)TEX also has another major drawback:
there does not exist such a thing as a (LA)TEX document format. In fact, (LA)TEX
is really a programming language, but, unlike other programming languages,
(LA)TEX does not obey any well-defined formal syntax. This means that (LA)TEX
documents can essentially only be processed in a reliable way by (LA)TEX itself.
For instance, it is easy to write a (LA)TEX package in which * means “plus” on
even pages and “start a new theorem” on odd pages.
The lack of a well-defined (LA)TEX format has caused endless headaches and
frustration for the TEXMACS developers, since it makes it impossible to write
100% reliable converters between LATEX and other formats, despite a huge
amount of work in this direction. Unfortunately, few LATEX users are aware of
this fact and its corollary that their “source code” might be of little use within
ten or twenty years from now. It is also plausible that this “locking up in the
LATEX non-format” effect has slowed down the development of other math-
ematical software besides TEXMACS.
Although TEXMACS comes with high quality converters from and to LATEX, the
above discussion shows that one cannot consider these mechanisms as 100%
reliable black boxes. For those who frequently need to convert documents
between TEXMACS and LATEX, there exist various conversion options so as to
make the conversion process as smooth as it can get.
Chapter 2
The user interface
The graphical user interface of TEXMACS has been designed to be as intuitive
as possible. In particular, recent versions of TEXMACS strive to respect stan-
dard conventions that are also used by other software on your computer: basic
keyboard shortcuts will be the same and parts of the menus are organized sim-
ilarly. It is therefore likely that you will learn much of TEXMACS just by using
it. Nevertheless, for getting the most out of the software, it may be useful to be
aware of some general design principles and conventions that are used inside
TEXMACS and this book.
Of course, explanations about user interfaces are easier to remember when you
start putting them into practice. You may therefore wish to skip some of the
details when reading this chapter for the first time. Once you understand the
basics, you may use this chapter as a reference and return to it for more specific
questions about the TEXMACS user interface.

2.1 Basic principles


First of all, different users have different backgrounds and distinct preferences
when it comes to ergonomics. As long as individual habits do not conflict with
each other, TEXMACS strives to support as many of them as possible. Take the
example of a simple editing action like the insertion of a new section title. If
you are new to TEXMACS, then the Insert „ Section menu or the icon is the nat-
ural place to look at. However, if you frequently need to insert new sections,
then it is more convenient to use a keyboard shortcut. The appropriate one
is ⌥1 , as indicated in the Insert „ Section menu. Finally, if you already know
LATEX, then you may prefer to use the \section command. For this, simply
type \ s e c t i o n , followed by enter ↩ . The \ -key is heavily overloaded in
TEXMACS and can also be used in order to enter other markup elements that do
not necessarily exist in LATEX.
A second basic principle is that TEXMACS tries to be as contextual as possible.
If we permanently advertised all features of TEXMACS on your screen, then
blinking buttons would soon drive you crazy. Many features therefore only
appear when they are most relevant. One problem with this is that you may
miss certain functionalities if you are not looking at the right place. In order
to reduce this risk, the interface contextualization is governed by a few simple
rules:
1. On the most global level, you may enable or disable certain features in
the user preferences or using the Tools menu.

25
26 THE USER INTERFACE

2. On an intermediate level, many of the relevant editing actions depend


on the current editing mode, which reflects the kind of object you are
manipulating: text, mathematics, graphics, programs, etc. There are
only a very limited number of editing modes, but they greatly affect
the general behavior of the editor.
3. On the finest level, many structured editing actions depend on the cur-
rent focus. The current focus corresponds to the innermost tag at the
current cursor position. Since TEXMACS defines hundreds of different
markup elements, the Focus menu and other focus-dependent editing
actions are highly contextual.
Imagine for instance that we wish to enable a European numbering style of
theorems inside TEXMACS (meaning that theorems, propositions, etc. are num-
bered individually instead of sharing a common counter). In this case, a search
for “European numbering” in the documentation (using F1 or Help „ Search „
Documentation) will lead you to the relevant place. However, it is likely that
the very terminology “European numbering style” is new to you. In order to
find the appropriate information in that case, the idea is to first insert a the-
orem, using Insert „ Enunciation „ Theorem. The contextual Focus „ Preferences
menu then contains an item European numbering style that you may try out
and hope that it does what you want.

2.2 The main window


After starting a new document, the main TEXMACS window will usually look
similar to the screenshot in Figure 2.1 below. The screenshot was taken on
a computer that runs MACOS, so it might look slightly different on other sys-
tems. Furthermore, the TEXMACS menus are displayed at the top of the screen
under MACOS, rather than in the window itself, as under GNU/LINUX or WIN-
DOWS.

Let us briefly describe the components of the main TEXMACS window:


• The title bar displays the name of your document and also indicates
whether the changes you made in your document have been saved on
disk.
• The main icon toolbar contains context-independent icons that are gener-
ally useful (opening, saving, and printing files, opening the user prefer-
ences, closing TEXMACS, copying and pasting, search and replace, undo
and redo, navigation buttons). Most of the icons correspond to entries
in the File, Edit, and Go menus.
• The mode-dependent icon toolbar varies with the current editing mode and
contains different icons when you are editing mathematical formulas or
graphics instead of plain text. Most of these icons are used for inserting
new markup elements into your document and correspond to entries in
the Insert menu.
2.2 THE MAIN WINDOW 27

• The focus toolbar contains icons that depend on the current focus. This
toolbar frequently changes when moving your cursor around in a struc-
tured document. Most of the icons correspond to entries in the Focus
menu.

• The status bar contains useful information. The left footer generally shows
the current mode and font properties, whereas the right footer indicates
the structure at the current cursor position. The status bar is also used
for certain warnings, error messages and interactive input from the user.

• The search toolbar is not displayed by default, but gets activated when
starting a new search. The bar can be expanded into a separate window
by pushing the button and closed by pushing . The replace and
spell toolbars work in a similar way and it is likely that future versions of
TEXMACS will implement more and more toolbars of this kind.

Menu bar Title bar


Main icon toolbar

Mode dependent icon toolbar


Focus toolbar

Search toolbar
Status bar

Left footer message Right footer message

Figure 2.1. The main TEXMACS window. On most computers, the menu bar is part of
the TEXMACS windows. Some operating systems such as MACOS rather display them
at the top of the screen.
28 THE USER INTERFACE

Key Meaning EMACS GNU/LINUX WINDOWS MACOS


⇧ Shift S- Shift Shift shift
⌃ Control C- Ctrl Ctrl control
⌥ Alternate A- Alt Alt option
⌘ Meta M- Meta Windows command
Table 2.1. Notations for modifier keys in this book.

Not all icon toolbars are always visible. Their visibility can be controlled from
within the View menu. It is also useful to know that most of the icons on the
toolbars are self-explanatory: when keeping your mouse over the icon during
a second or so, a help balloon with a short description of its purpose will
appear. The help balloon also indicates an equivalent keyboard shortcut if
there exists one.

2.3 Mastering the keyboard

Many editing operations in TEXMACS can most efficiently be executed using


keyboard shortcuts. There is an abundance of such shortcuts in TEXMACS and
new ones can be defined by the user. Before we present general principles that
will help you to learn and remember them, let us start with explaining how
they will be represented in this book.

2.3.1 Notation for keyboard shortcuts

Keyboard shortcuts are combinations of keys that are pressed either concur-
rently or in a sequence. In the case when several keys are pressed at the same
time, all but one of the keys being pressed are so-called modifier keys. Such
modifier keys are somewhat larger than the other keys on your keyboard, so
your fingers can find them easily. TEXMACS uses four modifier keys: Shift ⇧ ,
Control ⌃ , Alternate ⌥ , and Meta ⌘ . Most keyboards contain Shift, Control
(or Ctrl), and Alternate (or Alt) keys. The “Meta” key usually carries another
name, which depends on your keyboard model and operating system. The
naming conventions for different keyboard models and operating systems are
summarized in Table 2.1.

We represent keyboard shortcuts by small boxes that graphically recall the


idea of a key on your keyboard. When several keys are displayed in the same
box, they are assumed to be pressed at the same time. Otherwise, we assume
that you press them in succession. For instance, ⌘⇧a stands for “simultane-
ously press the three keys ⌘ , ⇧ , and a ”. The shortcut - > means “first press - ,
2.3 MASTERING THE KEYBOARD 29

Key Meaning Key Meaning


⇧ Shift modifier ← Cursor left
⇪ Caps lock → Cursor right
⌃ Control modifier ↑ Cursor up
⌥ Alternate modifier ↓ Cursor down
⌘ Meta modifier ↖ Home
↩ Return (or Enter) ↘ End
⌦ Forward delete ⇞ Page up
⌫ Backspace ⇟ Page down
⎋ Escape ␣ Space
⇥ Tab
Table 2.2. Notations for special keys in this book.

then release - , next press > ”. Similarly, ⌃x ⌃f stands for “simultaneously


press ⌃ and x , then release both keys (or at least x ), next simultaneously press
⌃ and f .

It is convenient to extend the short graphical representations ⇧ , ⌃ , ⌥ , and ⌘


for the modifier keys to other special keys on your keyboard. Table 2.2 sum-
marizes the notations that are used in this book.

2.3.2 How to remember keyboard shortcuts

Unfortunately, there are far more useful editing operations than keys on your
keyboard. This raises the question of how to associate keyboard shortcuts
to editing actions in a way that is easy to remember. TEXMACS achieves this
through a mixture of ideas.

First of all, recent of versions of TEXMACS try to respect as much as possible


standard conventions used by other software on your computer; see also sec-
tion 2.3.6. The most common keyboard shortcuts that you already learned for
other programs should therefore also work inside TEXMACS.

Secondly, many editing operations are similar or at least share one common
characteristic. For instance, we may single out the class of “structured inser-
tions/removals”. TEXMACS attempts to group shortcuts for operations in such
a class together via a distinctive prefix, modifier key, or modifier key combi-
nation. Structured insertions and removals are assigned the common modifier
key ⌥ , with the consequence that you may insert a new column in a table or
a new argument in a list of bibliographic citations using ⌥← or ⌥→ . You may
also perform the corresponding removals of columns and citations using ⌥⌫
and ⌥⌦ .
30 THE USER INTERFACE

The next idea is based on the concept of “variants”. In the case of a list of sim-
ilar editing operations, you may use the Tab-key ⇥ to cycle among the different
variants. This mechanism is highly useful for entering mathematical symbols:
∈, ⊂, and ≺ are examples of variants of <, which are entered using < ⇥ , < ⇥ ⇥ ,
and < ⇥ ⇥ ⇥ . The variant mechanism is also used when several editing oper-
ations compete for the same key. For example, inside mathematics, we use
the keyboard shortcuts ^ and _ for entering superscripts and subscripts, as
does (LA)TEX. Inside text, these shortcuts rather insert the symbols “^” and
“_”, yet superscripts and subscripts can be obtained through the shortcuts ^ ⇥
and _ ⇥ . The Tab-key ⇥ is highly versatile: it is also used for “Tab-completion”
of words and the selection of the appropriate object in the graphical mode,
whenever ambiguities arise through superposition. The Tab-key also produces
interesting effects when combining it with modifier keys: ⇧⇥ allows you to
circle back, whereas ⌃⇥ is used for “structural variants” such as turning a the-
orem into a proposition.

There are a few other noteworthy mechanisms that are mode-specific. In math
mode, one such mechanism is “graphical concatenation”, which allows you to
type → using - > , ⟺ using < = = > , and ⩽ using < = . We refer to section 4.2
for further examples and tables with mathematical symbols. In text mode,
accented characters are formed using the ⌘ modifier key (e.g. ⌘' e yields “é”)
and special symbols are obtained using the prefix ⇧F5 (e.g. ⇧F5 s yields ß):
see section 3.1.

One should also be aware of the fact that the TEXMACS keyboard behavior is
highly contextual: it depends on the user preferences, the current mode, as
well as the current focus. For instance, inside “math mode”, you have spe-
cial keyboard shortcuts that are handy for typing mathematical formulas, but
which are useless in text mode. This allows for a substantial amount of over-
loading, in the sense that the same keyboard shortcuts serve different purposes
in different contexts. For example, after activating a computer algebra system
as a scripting language (using Document „ Scripts), you may use ⌃↩ in order to
evaluate a mathematical formula. When going through the differences between
two TEXMACS documents using the versioning tool, the same shortcut ⌃↩ is
rather used for retaining a selected version.

We finally recall that menu entries indicate equivalent keyboard shortcuts


whenever they exist. The keyboard equivalent for an icon on the toolbars
appears in a popup menu, when hovering the mouse pointer over the icon
for a while. In math mode, the same holds for the submenus with “palettes”
of mathematical symbols.

2.3.3 Hybrid commands and LATEX emulation

TEXMACS uses \ as an important multi-purpose key. By hitting the \ key, you


enter the hybrid LATEX/TEXMACS command mode. As soon as you finished
2.3 MASTERING THE KEYBOARD 31

typing a LATEX or TEXMACS command, the left footer displays something like

<return>: action to be undertaken

At this stage, hitting the return-key ↩ will execute your command. For instance,
in math-mode, typing \ f r a c ↩ creates a fraction.

Technically speaking, TEXMACS first checks whether you typed a LATEX com-
mand. If your command is not recognized as a LATEX one, then TEXMACS looks
whether it is an existing TEXMACS command, macro argument or environment
variable (provided by the style file; see chapters 12 and 13). If so, the cor-
responding macro expansion, macro argument or environment variable is
inserted, with the right number of arguments. The \ key is always equivalent
to one of the more specific shortcuts ⌘i l (LATEX command), ⌘i c (TEXMACS
command), ⌘i a (macro argument), or ⌘i v (environment variable).

To insert a literal \ (backslash), you can use ⇧F5 \ or \ ⇥.

2.3.4 Common modifier combinations and prefix rules

We have seen that shared modifier combinations or prefixes make it easier to


remember keyboard shortcuts for editing operations of a similar nature. The
precise behavior heavily depends on the selected “look and feel” in Edit „ Pref-
erences „ General. I personally own a MAC laptop, on which I use the EMACS
look and feel. Under these circumstances, the most common modifier combi-
nations and prefixes are as follows:

⌃ . Standard shortcuts, that are similar to shortcuts used by other applica-


tions (for the selected look and feel). For example, ⌃y can be used for
pasting text (as in EMACS).

⌥ . TEXMACS shortcuts that may rely on the current editing mode. For
example, ⌥s produces strong text in text mode and a square root √ in
math mode.

⌘ . Compound TEXMACS shortcuts. Usually, these shortcuts first indicate the


kind of markup to which the command will apply and then specify the
specific command. For instance, the ⌘e prefix is used for inserting exe-
cutable markup, which is useful for writing style files (see chapter 13).
One example is the shortcut ⌘e + for inserting an addition.

⌘ . This modifier key is used in combination with arrow keys and certain
other special keys for positioning and resizing objects (see section 10.8).

⌘⌥ . This modifier combination is used in combination with arrow keys


and some other special keys for structured cursor movements (see sec-
tion 10.6).
32 THE USER INTERFACE

Purpose EMACS GNOME KDE WINDOWS MACOS


Standard ⌃ ⌃ ⌃ ⌃ ⌘
Mode-specific ⌥ ⌥ ⌥ ⌥ ⌃
TEXMACS-specific ⌘ ⌘ ⌘ ⌘ ⌘⌃
Position & resize ⌘ ⌘⌃ ⌘⌃ ⌘⌃ ⌘⌥
Structured navigation ⌘⌥ ⌘⌥ ⌘⌥ ⌘⌥ ⌘⌃
Extra ⌘⌃ ⌥⌃ ⌥⌃ ⌥⌃ ⌥⌃
Special symbols ⇧F5 ⇧F5 ⇧F5 ⇧F5 ⇧F5

Table 2.3. Common prefix rule correspondences for different look and feels. Recall that
the shortcuts in this book correspond to the EMACS look and feel.

⌘⌃ . This modifier combination is occasionally used in combination with


letters and punctuation symbols for creating some additional easy to
remind shortcuts.

⇧F5 . This prefix can be used in combination with normal letters for the inser-
tion of special symbols. For example, ⇧F5 s yields ß and ⇧F5 a yields ⨿.
The ⇧F5 prefix is also used for the insertion of “literal characters”. For
instance, ⇧F5 \ will always produce the \ character, whereas the \ key
is used for entering hybrid commands.

If you are using a different computer or look and feel, then some of these prefix
rules may change: see Table 2.3.

2.3.5 Substitution rules

On certain keyboards, important modifier keys such as the “Meta” key (or
a substitute) are sometimes missing, or reserved for other purposes. For
instance, ⌥ -based shortcuts are used for entering accented characters and
common special symbols under MACOS. Certain important TEXMACS keyboard
shortcuts can also be superseded by shortcuts from the operating system. For
example, the MACOS application SPACES uses the shortcuts ⌃← , ⌃→ , ⌃↑ , ⌃↓ ,
⌃1 , ⌃2 , ⌃3 , and ⌃4 to switch between multiple screens.

One solution to the second problem is to change the problematic global short-
cuts that got overridden in the responsible applications. For example, SPACES
can be configured to use ⌘⌥⌃ as a prefix instead of ⌃ (click on the popup menu
behind “To switch between spaces” and simultaneously press ⌘ , ⌥ , and ⌃ ).
Notice that fn is another key that is not used by TEXMACS.

If you cannot or do not want to change the system-wide shortcuts, or if one


or more modifier keys are missing on your keyboard, then you may use the
2.3 MASTERING THE KEYBOARD 33

Shortcut EMACS GNOME KDE WINDOWS MACOS


⎋ ⌘ ⌘ ⌘ ⌘ ⌥
⎋ ⎋ ⌥ ⌥ ⌥ ⌥ ⌃
⎋ ⎋ ⎋ ⌃ ⌃ ⌃ ⌃ ⌘
⇧⎋ ⌘⌥ ⌘⌃ ⌘⌃ ⌘⌃ ⌘⌥
⇧⎋ ⇧⎋ ⌘⌃ ⌥⌃ ⌥⌃ ⌥⌃ ⌥⌃
⇧⎋ ⇧⎋ ⇧⎋ ⌥⌃ ⌘⌥ ⌘⌥ ⌘⌥ ⌘⌃

Table 2.4. Keyboard shortcuts for modifier keys or modifier key combinations. Recall that
the shortcuts in this book correspond to the EMACS look and feel.

Escape-key ⎋ in order to produce equivalents for the modifier keys ⌘ , ⌥ ,


and ⌃ . For instance, under MACOS, ⌃ is equivalent to ⎋ ⎋ . Hence, the TEXMACS
shortcut ⌃→ can also be obtained by typing ⎋ ⎋ → , which may coexist with the
SPACES shortcut ⌃→ . Table 2.4 shows the modifier key combinations that can
be obtained using ⎋ .

2.3.6 Standards conformance

TEXMACS attempts to be as standards-conforming as possible for each of the


supported look and feels in Edit „ Preferences „ General. However, there are
a few general situations in which TEXMACS reserves keyboard shortcuts for the
sake of user-friendliness:

• The function keys F5 – F12 are reserved for special actions.

• Most operating systems admit a “principal modifier key” for forming


keyboard shortcuts (e.g. ⌃ for the EMACS look and feel) as well as a
“secondary modifier key” for a few other shortcuts (e.g. the Windows
key under WINDOWS and ⌥ under MACOS). The remaining free modi-
fier key (e.g. ⌥ for the EMACS look and feel) is reserved for TEXMACS.

• TEXMACS contains many keyboard macros involving one or more mod-


ifier keys and the special keys ← , → , ↑ , ↓ , ↖ , ↘ , ⇞ , ⇟ , ⌫ , ⌦ , ␣ , ⇥ , and
↩ . The behavior of shortcuts of this kind is occasionally non-standard.

The TEXMACS-specific shortcuts are rarely in conflict with standard conven-


tions. Nevertheless, in Table 2.5, we have listed a few more or less standard
shortcuts, that might work in other applications, but that will usually not work
inside TEXMACS.
34 THE USER INTERFACE

Look& feel Shortcut Alternative Meaning


Emacs F10 Show menu bar in window
Emacs ⌘! Shell command
Emacs ⌘' / ⌘` / ⌘^ Needed for TEXMACS accents
Emacs ⌘/ / ⌘\ / ⌘: / ⌘;
Emacs ⌘← / ⌘→ ⌃← / ⌃→ Move word back/forward
Emacs ⌘a / ⌘e ⌃↑ / ⌃↓ Move paragraph back/forward
Emacs ⌘b / ⌘f ⌃← / ⌃→ Move word back/forward
Emacs ⌘l / ⌘t Locase/transpose words (not impl.)
Windows F5 Refresh/Switch to next pane
Windows F6 / ⌃F6 / ⌃⇧F6 Switch to next/previous pane/tab
Windows ⌃␣ Remove formatting
Windows ⌃⇥ Switch to next child window
Windows ⌃⌫ / ⌃⌦ Delete word
MacOS ⌃F5 / ⌃F6 / ⌃⇧F6 Move focus to toolbar/panels
MacOS ⌃F7 Override keyboard access mode
MacOS F9 / F10 Tile or untile windows
MacOS F11 / F12 Hide or show windows/dashboard
MacOS ⇥ / ⇧⇥ Navigate through controls
MacOS ⌃⇥ , ⌃⇧⇥ Move focus within control groups
MacOS ⌃␣ / ⌘⌃␣ Toggle between input sources
MacOS ⌃← / ⌃→ ⌘⌥← / ⌘⌥→ Move one cell left/right in table
MacOS ⌃↑ / ⌃↓ ⌘⌥↑ / ⌘⌥↓ Move one cell up/down in table
MacOS ↖ /↘ ⌘↑ / ⌘↓ Move to start/end of document
MacOS ⌥⇞ , ⌃↑ , ⌃⇞ ⇞ Page up
MacOS ⌥⇟ , ⌃↓ , ⌃⇟ ⇟ Page down
MacOS ⌃a / ⌃e ⌥↑ / ⌥↓ Move to start/end of block
Table 2.5. Shortcuts that might work in other applications, but usually not in TEXMACS.

2.4 Organization of the menus


Recall that we use a sans serif font for menu entries in this book. For instance,
the menu entry for creating a new file is denoted by File „ New. The top-level
menus of TEXMACS were designed according to the following principles:
• The File menu contains the most common operations on files: opening,
saving, closing, and printing of documents, as well as conversions to
other formats.
• The Edit menu is also pretty standard and contains the most basic editing
operations: copying and pasting of text, undoing and redoing changes,
search and replace, as well as spell checking. TEXMACS also allows you
to copy and paste fragments of documents that use other formats. For
example, when copying and pasting a selection from your favorite web
browser, most of the formatting properties will be preserved.
2.5 DIALOGUE WINDOWS 35

• The Insert menu is mode-dependent and used for the insertion of struc-
tural markup. In text mode, it allows you for example to insert section
titles, theorems, numbered lists, emphasized text, etc. In math mode, it
allows you to insert fractions, wide accents, matrices, etc.

• The Focus menu corresponds to editing operations that act on the cur-
rent focus; see section 2.7. Assuming that your cursor is inside a section
title, it allows you to transform the section into a subsection, to toggle
the numbering, to jump to other sections, etc.

• The Format menu is dedicated to visual fine-tuning of the layout and


presentation of pieces of your document. You may change the font, the
color, the alignment and spacing of paragraphs, insert extra whitespace,
control line and page breaking, adjust the position and size of pieces
of text, etc.

• The Document menu allows you to specify the global properties of your
document, such as its style and language, the page size and color, the
main font, metadata, etc.

• The View menu is used for controlling the presentation of the TEXMACS
windows. It specifies which toolbars are visible and the zoom factor
that is applied to your document. It also allows you to enter and leave
presentation mode.

• The Go menu allows you to change the document that is visible in the
main window. Its Back and Forward entries can be used for browsing
a collection of TEXMACS files, such as the built-in documentation.

• The Tools menu contains miscellaneous utilities. It also allows you to


enable additional tools for debugging, code development, versioning,
etc. When enabling the versioning tools, for example, a new top-level
Version menu will appear with additional document versioning facili-
ties.

• The Help menu gives access to the built-in documentation. TEXMACS


includes a manual, a reference guide, and more technical information
about its implementation. It is also possible to search for specific key-
words inside the documentation.

2.5 Dialogue windows


In old versions of TEXMACS, most of the complex editing operations were accom-
plished through the menus. More recently, a big part of the user interface
has been redesigned so as to make more extensive use of dialogue windows.
For instance, fonts can be picked through a special font selector and the page
layout can be modified using a dedicated widget.
36 THE USER INTERFACE

Figure 2.2. The dialogue window for changing the layout of paragraphs.

In order to explain how dialogue windows work, it is convenient to extend


the notation that we introduced for menus. Let us see how this works on an
example. In Figure 2.2 below, we have displayed the dialogue window for
modifying the layout of paragraphs. This window is opened using Format „
Paragraph. Then Basic „ Alignment „ justify corresponds to the selection of jus-
tify for the paragraph alignment in the list of choices next to Alignment. The
notation Format „ Paragraph „ Basic „ Alignment „ justify stands for the combined
action of opening the dialogue window and selecting the justified paragraph
alignment.
Some users do not like their screen to be cluttered by dialogue windows and
prefer to use the menus as much as possible for complex editing operations.
TEXMACS provides a special user preference for this: Edit „ Preferences „ General „
Complex actions „ Through the menus.

2.6 User preferences


Many functionalities of TEXMACS can be configured according to the prefer-
ences of the user. Some of the most important user preferences can be changed
in Edit „ Preferences. However, many settings are relevant for specific tools or
markup elements only. Changing such settings is done in the preference menu
of the corresponding tool or in an appropriate context-dependent preference
menu. Some of your likings are even determined automatically by TEXMACS.
For example, the size and position of the TEXMACS window are remembered
when closing and restarting the application.
In Edit „ Preferences „ General, you will find a few important global user prefer-
ences that control the general behavior of the user interface:
Look and feel. Each particular operating system comes with its own user
interface conventions for common editing operations like “cut and
paste”. By default, TEXMACS tries to conform to the conventions of your
2.7 THE CURRENT FOCUS 37

operation system, but you are free to choose another “look and feel”.
You may also choose the Emacs look and feel in order to enable many
of the GNU EMACS keyboard bindings.

User interface language. Whenever appropriate translations are available,


TEXMACS will use the specified language for the user interface (e.g. the
menus, dialogue windows, etc.).

Complex editing actions. By default, TEXMACS opens dedicated dialogue


windows for accomplishing complex editing operations. Some users
prefer not to clutter their screen with other windows and rather per-
form such operations through the menus.

Interactive questions. Some editing operations require extra input from


the user. Such additional feedback can either be entered in popup win-
dows or via the footer.

Details in menus. TEXMACS offers many possibilities. For some applications


(e.g. high school education), one may wish to simplify the user inter-
face by only exposing a subset of it.

Buffer management. Many applications create a separate window for every


new document that you open. Some users prefer the GNU EMACS con-
vention of using a single window in which you may switch between
multiple documents, also called buffers.

2.7 The current focus

TEXMACS offers a wide range of features. The main mechanism through which
only the most relevant functionalities in a given context are exposed to the
user is based on the concept of current focus. Recall that TEXMACS documents
are structured. At a given cursor position, we find ourselves inside a list of
structures (also called tags or markup elements), ordered from innermost to out-
ermost. For instance, assume that our cursor is behind the “w” of “brown”
inside the following quotation:

The quick brow|n fox


Jumps over the lazy dog.

Then we are inside two structures: a change of color into brown and a quota-
tion. TEXMACS displays this information in the right footer. It also indicates the
innermost structure through a cyan box and all other surrounding structures
through light grey boxes. The innermost structure at the current cursor posi-
tion is called the current focus.
38 THE USER INTERFACE

Remark. When selecting text, the current focus rather becomes the innermost
structure that contains the selection. Here it is useful to know that the ⌃␣
keyboard shortcut enlarges the current selection to its surrounding structure.
Through the repeated use of this shortcut, any of the tags that contain the
cursor can thus be selected efficiently and act as the focus tag.

The main editing operations that correspond to the current focus are accessible
through the Focus menu and the focus toolbar. The items in this menu and on
this toolbar are highly context-dependent by design. Whenever appropriate,
they allow you to perform the following types of actions:
Navigation. The icons , , , and (which correspond to the menu
entries First similar, Previous similar, Next similar, and Last similar) can
be used for jumping to similar tags in your document. Assuming that
you are inside a theorem, clicking on will for example bring your
cursor to the next theorem, proposition, lemma or corollary.
Insertion and removal. Certain tags (such as bibliographic citations,
“switches” in presentations, tables, etc.) admit a variable number of
arguments. Using the icons and (or the menu items Insert argu-
ment before and Insert argument after), you may add new arguments.
Similarly, and (or Remove argument before and Remove argument
after) can be used for the removal of arguments. In the case of tables, the
above icons (or menu entries) can be used for the insertion and removal
of columns. In addition, you may use , , , and for the inser-
tion and removal of rows.
Variants. Certain tags admit variants or alternative states. Theorems can
be numbered or not for example and they behave much alike proposi-
tions, lemmas and corollaries. Other markup elements can be folded or
unfolded (this is useful for presentations and exercises). Now the focus
menu and toolbar always indicate the name of the tag that corresponds
to the current focus. If this tag has interesting variants, then a submenu
with the list of variants is proposed under its name. Similarly, the icons
, , , and can be used to toggle the numbering or state of the tag,
whenever applicable.
Exit. The icons and (or Exit left and Exit right) can be used in order to
exit the focus tag at the left or the right.
Destroy. The focus tag can be destroyed using , Delete or ⌃⌫ . More pre-
cisely, the tag and its arguments will be replaced by the argument that
contains the cursor.
Customize. The presentation of the focus tag can be customized via
or Preferences. Notice that customizations of this kind will act on the
style properties and preamble of your document and not on the user
preferences, strictly speaking. In other words, alternative settings will
only impact on the document that you are editing and not on any other
2.7 THE CURRENT FOCUS 39

documents that you may open in the future. The following types of
customizations are most common:

• Some tags come with one or more style options that correspond
to customized renderings through the use of special style pack-
ages. For example, theorems may be told to use an alternative
“European numbering style” using Focus „ Preferences „ Euro-
pean numbering style.

• Various style parameters (also called environment variables) may


influence the rendering of a tag. For example, list environments
come with two style parameters item-hsep and item-vsep that
control the horizontal and vertical spacing of list items. The Pref-
erences menu comes with an entry for specifying each style para-
meter of the focus tag.

• All non-built-in TEXMACS tags are defined using macros in the


TEXMACS style packages or directly by the user. If applicable, then
you may use Focus „ Preferences „ Edit source in order to jump
to the relevant place in the style package that defines the focus
tag. You may also edit the corresponding macro inside a spe-
cial dialogue window using Focus „ Preferences „ Edit macro; see
section 12.1 for more information.

Documentation. Contextual help about the focus tag can be obtained


using or Describe.

Arguments. Certain tags come with one or more “hidden” arguments that
are invisible in the document itself and therefore require special mech-
anisms for being edited. Typical examples of hidden arguments are the
color “brown” in the example at the beginning of this section or the
names of labels and references. In many cases, such hidden arguments
are short names, colors or lengths, that can be edited via extra input
fields on the focus toolbar. In general, tags with hidden arguments can
be deactivated and reactivated using or Show hidden. Alternatively,
you may place the cursor just behind the tag and press ⌫ in order to
deactivate it. After editing the hidden arguments, you may reactivate
the tag using ↩ .

In the case when the current cursor is not inside any particular tag, the current
focus is on the whole document. This happens for instance when the cursor is
at the extreme top-left position in the document. Some of the most important
entries of the Document menu are then exposed more directly on the focus
toolbar:

Style. On the extreme left, you may specify the style of your document,
and select any additional style packages to be used. We recall that style
packages that are really style options for particular tags should rather
be specified via the Focus „ Preferences menus for these tags.
40 THE USER INTERFACE

Page style. The current page size is indicated on the focus bar and can be
modified. Similarly, the orientation and number of columns are indi-
cated through one of the icons , , , , , or . These settings can
also be changed by clicking on the displayed icon.
The default page rendering mode is Paper, which corresponds to the
way your document will be printed. However, in this mode, the posi-
tions of page breaks may heavily change while you are typing, which
can be annoying. This can be avoided by using the alternative Papyrus
mode, in which your document is displayed on a single page of fixed
width and flexible height. The Papyrus mode also allows for faster type-
setting, which makes the editor more responsive when your document
gets large.

Font. The main document font and its size are indicated and can be mod-
ified from the focus bar. The proposed main fonts are on a restricted
shortlist of fonts that are particularly well supported by TEXMACS.

Language. The icon with the little flag indicates the main document lan-
guage. This language is used by the typesetter for punctuation and
hyphenation of words. It is also relevant for the spell checker.

Section. If your document contains several sections, then the focus bar also
indicates the current section. By clicking on it, a list with all sections
appears, which allows you to jump to any other section inside the doc-
ument.

2.8 Finding documentation


The easiest way to find documentation on a topic inside TEXMACS is to search
for it using F1 or Help „ Search „ Documentation. Search queries are similar to
those for popular search engines on the web: just type one or more keywords
separated by spaces and TEXMACS will return a list of matching pages in the
documentation, ordered by expected relevance.
We also recall from the previous subsection that Focus „ Describe provides con-
textual help on the current focus tag. If the focus is on the entire document,
then Focus „ Help will provide help on the current document style and any
selected style packages. Minimal contextual explanations of icons and menu
entries are also available via help balloons that appear as soon as you hover
your mouse pointer over them for a short while.
The bulk of the built-in documentation on TEXMACS is available from the Help
menu. The available material is organized as follows:

• In the Help „ Manual menu, you find the main documentation about how
to use TEXMACS. The manual is quite complete, but not very detailed.
2.8 FINDING DOCUMENTATION 41

• In the Help „ Reference guide menu, you find more detailed documenta-
tion about the TEXMACS format, its primitives and environment variables,
and the standard style files.

• TEXMACS plug-ins may (or may not) include documentation. Any avail-
able auto-documentation of this kind is made available through the
Help „ Plug-ins menu.

• The Help „ About menu contains more information about TEXMACS, like
information about its authors, how to contact us, and changes in dif-
ferent versions of the program.

• More information is available for developers (Help „ Interfacing, Help „


Scheme extensions, Help „ Future plans) and anyone who wants to sup-
port the development of TEXMACS (Help „ Help us).

In addition, book versions of the existing documentation are available in Help „


Full manuals. An interesting feature of TEXMACS is that any documentation page
can be expanded into an article or a full manual using Help „ Full manuals „
Compile article or Help „ Full manuals „ Compile book. For instance, if you start
browsing the manual using Help „ Manual „ Browse, and click on Help „ Full man-
uals „ Compile book, then TEXMACS will compile the user manual [25]. Please
be patient... Compiling a full manual may take a few minutes...
The Internet provides another valuable source of information. On the TEXMACS
web site http://www.texmacs.org, you may find videos, tutorials and
research papers about TEXMACS. The FAQ and the mailing list archives also
contain answers for many questions by users. Do not hesitate to subscribe to
the mailing lists and ask your own questions there, or help others out!
Chapter 3
Ready, steady, go!

3.1 Typing ordinary text

When it comes to typing ordinary text, we have nothing extraordinary to say:


most of the time, TEXMACS will behave similarly to other programs on your
computer. Nevertheless, there are a few points worth mentioning for entering
certain symbols and for getting the punctuation, spacing, and other typographic
details right.

Special symbols

TEXMACS reserves the \ , $ , and " keys for entering special commands, mathe-
matical formulas, and quotes. The literal symbols \, $, and " can be produced
using the shortcuts ⇧F5 \ , ⇧F5 $ , and ⇧F5 " , or alternatively using \ ⇥ , $ ⇥ ,
and " ⇥ . The ⇧F5 keyboard prefix is also used for entering other special sym-
bols; see Table 3.1.

Punctuation

TEXMACS assumes that you are familiar with basic punctuation rules for the
language you are writing in. English rules stipulate that each of the principal
punctuation symbols

. , : ; ! ?

should be followed by a space, except at the end of a paragraph, but not pre-
ceded by any spaces. French rules on the contrary require you to also put
a space before these symbols, except for periods and commas.

Assuming that you correctly follow these language-specific rules, TEXMACS


takes care of the more precise spacing conventions around punctuation sym-
bols. For example, periods are followed by slightly larger spaces than commas.
This makes it easier for the eye to spot separate sentences. Similarly, French
typographers use as slightly smaller “thin” space before colons, semicolons,
exclamations marks, and question marks.

42
3.1 TYPING ORDINARY TEXT 43

Shortcuts
⇧F5 a æ ⇧F5 A Æ ⇧F5 a e æ ⇧F5 A E Æ
⇧F5 o ø ⇧F5 O Ø ⇧F5 o e œ ⇧F5 O E Œ
⇧F5 s ß ⇧F5 S S
⇧F5 ! ¡ ⇧F5 ? ¿ ⇧F5 p § ⇧F5 P £
Table 3.1. Typing special characters using the ⇧F5 keyboard prefix.

Whitespace
negative space xy \ ! ↩
no space xy
tiny space xy \ , ↩
small space x y \ : ↩
thin space x y \ ; ↩
normal space x y ␣
quad space x y ␣ ⇥ ⇥ or \ q u a d ↩
double quad space x y \q q u a d ↩

Table 3.2. Common amounts of whitespace and how to obtain them.

There are a few exceptional cases that require additional care. The period
sign is also used inside abbreviations, for example, in which case it should
be followed by a normal space (instead of the slightly larger space between
sentences). We recommend that you systematically “tag” abbreviations using
Insert „ Content tag „ Abbreviation or the keyboard shortcut ⌥a . This in par-
ticular allows TEXMACS to adjust the spacing.

Whitespace

We have seen above that TEXMACS automatically determines the appropriate


amount of whitespace to be inserted for each space character in the document.
However, TEXMACS does not force you to enter a space after, say, a period.
This flexibility is useful whenever periods are used for other purposes as
ending sentences (e.g. inside numbers 1.234, abbreviations, names of websites
www.texmacs.org, etc.).

It is generally a bad idea to insert several spaces in a row, just for the visual
effect of obtaining a somewhat larger space. In the case when you need an
explicit whitespace of, say, one inch, you should rather use Format „ White-
space „ Rigid and enter 1 in at the prompt. Certain amounts of whitespace are
very common for tweaking the presentation of text; see Table 3.2 for some
useful shortcuts to this effect. For more details about horizontal whitespace,
we refer to section 7.5.1.
44 READY, STEADY, GO!

Shortcuts
` ‘ ' ’
` ` “ '' ”
< ⇥ ‹ >⇥ ›
< < « >> »
⇧F5 " " , , „
Table 3.3. Keyboard shortcuts for specific quotes.

When entering several spaces in a row, the default behavior of TEXMACS is to


glue them together into a single big space. More precisely, hitting n times ␣
will produce a space with the width of n − 1 “quad” spaces. Using Edit „ Pref-
erences „ Space bar in text mode „ Allow multiple spaces, it is also possible to
mimic the behavior of most other text editors: hitting n times ␣ will simply
insert n spaces. Similarly, Space bar in text mode „ No multiple spaces forbids
multiple spaces altogether: pressing ␣ any number of times always inserts a
single space.

Hyphens and dashes

TEXMACS provides three types of hyphens and dashes (namely -, –, and —),
which are entered using the shortcuts - , - - , and - - - . The shortest ones,
called hyphens, are used for hyphenation and in order to join words (e.g. high-
school teacher, Marie Skłodowska-Curie, etc.). So-called en dashes (–) are typ-
ically used for ranges (see pages 256–65536), relations, and connections (the
Stone–Weierstrass theorem). The longest em dashes (—) mostly serve as sub-
stitutes for parentheses or colons (Archimedes—the great scientist—is also
known for letting his bath overflow). TEXMACS finally provides a non-breaking
hyphen after which line breaks are forbidden; you may enter this character
using - ⇥ .

Quotes

When you press the " key, an appropriate opening or closing quote will be
inserted. The quote character is chosen according to the current language and
the surrounding text. If the default quoting style is not appropriate for some
reason, then you can change it in Edit „ Preferences „ Keyboard „ Automatic quotes.
You can also insert specific quotes using the keyboard shortcuts in Table 3.3.

In most languages, opening quotes are preceded but not followed by a space,
whereas closing quotes are followed but not preceded by one. The French
use a thin space after opening guillemets « and before closing ones ». The
spacing may need to be adjusted for nested quotations, such as “Archimedes
exclaimed ‘Eureka!’ ”. In order to detach the single nested closing quote from
the surrounding double closing quote, we manually inserted a small space
using \ ; ↩ .
3.1 TYPING ORDINARY TEXT 45

Font ‘ ’ ‘ ‘ ’ ’ ‘ ⇥ ’ ⇥ " ⇥
TEXMACS Computer Modern ‘ ’   ` ' "
TEX Gyre Termes (Times) ‘ ’ “ ” ` ' "
TEX Gyre Pagella (Palatino) ‘ ’ “ ” ` ' "
DejaVu ‘ ’ “ ” ` ' "
Table 3.4. Rendering of simple quotes, double quotes, backquotes, apostrophes, and quo-
tation marks in various fonts.

The single quotes ‘ ’ and the double closing quotes ” are easily confused with
the backquote `, the ambidextrous apostrophe ' and the ambidextrous quota-
tion mark ". Older fonts may even display some of these symbols in the same
way, whereas modern UNICODE fonts tend to propose different glyphs (see
Table 3.4). “Genuine” single and double quotes are used for quotations in ordi-
nary text; they can for instance be entered using the natural shortcuts ‘ , ’ ,
‘ ‘ , and ’ ’ , as explained above. The quotation mark ", the apostrophe ', and
the backquote ` are important for programmers, who tend to use notations
like "Hello world" or 'Hello world' for representing textual string data;
you may enter them using ‘ ⇥ , ’ ⇥ , and " ⇥ . Notice that the keyboard short-
cuts are “reversed” inside computer programs (e.g. " produces the quotation
mark ", whereas " ⇥ produces ”).

Line breaking
Ordinary text is built up from paragraphs, each of which contain one or more
sentences. Most paragraphs do not fit on a single line, so TEXMACS automati-
cally breaks them into several lines. Sometimes, you may wish to control more
precisely how this is done. There are several circumstances in which line breaks
should be avoided:
• After initials of names: do not break after “A.” in “A. Einstein”.
• After very short words: I personally tend to avoid breaks after single-
letter words such as the article “a”.
• Before references such as the number “3” in “Chapter 3”.
• Inside mathematical text, it is often considered bad taste to start a line
with a mathematical formula.
TEXMACS provides a special “non-breaking space” character that can be used
instead of an ordinary space in order to prevent line breaks at a specific posi-
tion. This character is entered using ␣ ⇥ and rendered on the screen using a
barely visible steel-blue hyphen. You may also prevent all line breaks inside
a selection of text by turning it into a “group” using Format „ Break „ Group „
Horizontal or ⌘= .

Conversely, you may insist on having a line break at a certain point


using Format „ Line break. Notice that it is generally better to forbid breaks
at places that are inappropriate for sure rather than to force them at places
46 READY, STEADY, GO!

that look nice at a time t. Indeed, as soon as you make further modifications
inside your text, change the document style, or export it to another format,
the nice looking break often becomes your worst possible choice.

Hyphenation

Long words may be hyphenated during the line breaking process. The hyphen-
ation rules are determined by the language in which you wrote your text (as
selected using Document „ Language or Insert „ Language).

Again, it is sometimes desirable to have more control over the hyphenation


process. Now the above mechanism of “grouping” does not only forbid line
breaks: it also prevents any words from being hyphenated. It is typically a good
idea to turn off hyphenation inside names of persons (try hyphenating your
own name).

For a given word, TEXMACS also allows you to explicitly specify its hyphen-
ation: select the word and use Format „ Hyphenate as. You will be prompted
for a hyphenation of the word. Just enter short dashes at the places where
hyphenations should be allowed.

3.2 Foreign languages

In the past, typing foreign text on a computer was often a complex task, espe-
cially for languages with other alphabets or scripts, such as Russian or Chinese.
The UNICODE standard was designed to simplify this task and provide a “uni-
versal” computer alphabet for all known languages in the world. Nowadays,
most operating systems comply with this standard and provide built-in mech-
anisms for entering text in UNICODE format, while supporting a large number
of languages and keyboard models.

TEXMACS is also compatible with a large part of UNICODE (notable exceptions


are Arab and Hebrew which are written from right to left), even though another
encoding is used internally. For the increasingly rare cases in which it is impos-
sible or difficult to enter certain characters using the built-in facilities of the
operating system, TEXMACS provides a few additional mechanisms of its own,
that we will describe below.

Note that you can set the text language for the whole document with Docu-
ment „ Language. It is also possible to select another language for a single word
or fragment of text using Insert „ Language. TEXMACS uses language informa-
tion for a variety of purposes, such as hyphenation, spell checking, available
keyboard shortcuts, punctuation and spacing rules, etc. It is also possible to
specify an alternative language for the graphical user interface in Edit „ Prefer-
ences „ General „ Language.
3.3 STARTING A NEW DOCUMENT 47

Shortcut Example Shortcut Example


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

Table 3.5. Typing accented characters.

3.2.1 Latin languages


Among the languages with Latin alphabets, the English language is particularly
simple in the sense that its letters do not carry any accents. For other “Latin”
languages, you may enter accented letters using the ⌘ prefix. For example,
“é” is obtained by typing ⌘' e , and “à” by typing ⌘` a . See Table 3.5 for the
complete list of available accents, with the corresponding keyboard shortcuts
and examples. Note that these shortcuts are available regardless of the cur-
rent language setting.
In Table 3.1 we already showed how to enter several other special letters and
symbols using the prefix ⇧F5 . Further keyboard shortcuts are available for
specific languages only: see Table 3.6. Some of these shortcuts override general
shortcuts from Table 3.1. Using the “variant” mechanism (see section 2.3.2), it
is possible to recover the overridden behavior. For example, inside Hungarian
text, you can still obtain “ø” through the shortcut ⇧F5 o ⇥ .

3.3 Starting a new document


In TEXMACS, the first thing that you usually do when starting a new document
is to choose an appropriate document style. This can be done using Document „
Style or directly via the focus bar.

Hungarian Spanish Polish


⇧F5 o ő ! ⇥ ¡ ⇧F5 a ą ⇧F5 o ó
⇧F5 O Ő ? ⇥ ¿ ⇧F5 A Ą ⇧F5 O Ó
⇧F5 u ű ! ` ¡ ⇧F5 c ć ⇧F5 s ś
⇧F5 U Ű ? ` ¿ ⇧F5 C Ć ⇧F5 S Ś
⇧F5 e ę ⇧F5 x ź
⇧F5 E Ę ⇧F5 X Ź
⇧F5 l ł ⇧F5 z ż
⇧F5 L Ł ⇧F5 Z Ż
⇧F5 n ń ⇧F5 z ⇥ ź
⇧F5 N Ń ⇧F5 Z ⇥ Ź
Table 3.6. Language-specific text shorthands.
48 READY, STEADY, GO!

TEXMACS includes a few general purpose styles such as article, beamer, book,
Education „ exam and letter, as well as a selection of more specialized styles.
For example, in the menus Article and Book, you will find additional styles for
writing articles and books, implementing specific layouts that are required by
certain journals or publishers.

Assuming that you selected a document style such as “article” or “book”, the
next logical actions are to enter a title, the authors, an abstract, etc. Of course,
the precise kind of information you provide depends on the style: in the case
of an exam, you may wish to add the subject, the level, or the name of a class-
room; the title page of a laptop presentation typically becomes more attractive
if you add some artwork.

3.3.1 Entering the title

Let us detail how to enter title information in the case of an article. Such infor-
mation should be regarded as a block of data. The specific order and way in
which the data are presented is determined by the document style, although
TEXMACS provides a few options for customization.

You may use Insert „ Title „ Insert title in order to create a block with title infor-
mation. For a newly created document, you may also use the Title button on
the focus bar. The main data field of the title block is the title itself. Extra data
fields can be inserted from the Focus menu or the icon on the focus toolbar.
For instance, Focus „ Author allows you to insert one or more authors. You
may also specify the creation date of your document using Focus „ Date (arbi-
trary dates) or Focus „ Today (the current date). Miscellaneous fields with a
customized layout can be added using Focus „ Miscellaneous. For notes with
people to be thanked or grant information, you should rather use Focus „ Note.

Many document styles do not only display the title at the top of the first page:
often this information also shows up in the headers of individual pages. If
a title is very long, then this may cause the headers to run off the pages. In
such cases, you may specify an alternative running title using Focus „ Running
title. The same remark applies to the authors: if your paper has many authors,
then you should specify an abbreviated running author for page headers using
Focus „ Running author.

For each author that you enter using Focus „ Author, you provide additional
data via the items below Focus „ Author (alternatively you may use the icon
next to Author on the focus bar). Nowadays it is customary to provide an affil-
iation for the author (Focus „ Author „ Affiliation) as well as an email address
(Focus „ Author „ Email). Optionally, you may also wish to point to a homepage
(Focus „ Author „ Homepage).

Miscellaneous data fields and further notes can be inserted in a similar way as
for titles.
3.3 STARTING A NEW DOCUMENT 49

Optimale Pareto-efficiëntie in genotssamenlevingen [1]

JAN KLAASSEN
Afdeling wiskunde
Katholieke Universiteit Tilburg

Email: [email protected]

ADA P. NOOT-MIES PIET SNOT


Afdeling econometrie Afdeling wiskunde
Universiteit van Amsterdam Katholieke Universiteit Tilburg

Email: [email protected] Email: [email protected]

Optimale Pareto-efficiëntie in genotssamenlevingen [2]

JAN KLAASSENa, PIET SNOTb ADA P. NOOT-MIES


Afdeling wiskunde Afdeling econometrie
Katholieke Universiteit Tilburg Universiteit van Amsterdam
a. Email: [email protected] Email: [email protected]
b. Email: [email protected]

Optimale Pareto-efficiëntie in genotssamenlevingen [3]

JAN KLAASSENab, ADA P. NOOT-MIEScd, PIET SNOTae


a. Afdeling wiskunde
Katholieke Universiteit Tilburg
c. Afdeling econometrie
Universiteit van Amsterdam
b. Email: [email protected]
d. Email: [email protected]
e. Email: [email protected]

Figure 3.1. Three ways to cluster title information: [1] none; [2] by affiliation; [3] maximal.

Notice that data fields need not be unique. You may for example specify more
than one affiliation or email address for an author, or attach several miscella-
neous data fields to the title.
50 READY, STEADY, GO!

Whenever several authors share the same affiliation, publishers may require
you to save space by factoring out such common information. TEXMACS can do
this automatically for you; the desired amount of “clustering” can be specified
using the following options in the menu on the focus bar:

No clustering. Do not factor out any data.


Cluster by affiliation. Group authors by their affiliations.
Maximal clustering. Factor out as much common data as possible.

The effect of these options is illustrated in Figure 3.1.

3.3.2 Entering the abstract

The abstract of an article can be entered using Insert „ Title „ Abstract. This
action really inserts abstract blocks which are similar to the title blocks from
the previous section: besides the abstract itself, you may also insert several
metadata such as keywords and subject classifiers.

More precisely, with the current focus on the abstract, a list of keywords can
be entered using Focus „ Keywords: you start typing the first keyword and then
insert additional keywords using Focus „ Insert argument after or ⌥→ . Each topic
(mathematics, physics, computer science, etc.) admits its own specific subject
classification system. For example, mathematicians often use the A.M.S. sub-
ject classification (Focus „ A.M.S. subject class), whereas computer scientists
tend to prefer the A.C.M. computing class (Focus „ A.C.M. computing class).
In TEXMACS, we aim at supporting the most frequent classification schemes,
and new schemes can easily be added on request.

We notice that certain metadata can also be entered using Document „ Meta-
data. This alternative mechanism attaches the metadata even more directly to
the document. Currently, you may specify a title, an author, and a subject in
this way, while TEXMACS attempts to automatically determine as many fields
as possible. This kind of metadata is for instance used when exporting a doc-
ument as a PDF file.

3.4 Subdividing your document into sections

Long documents are usually subdivided into chapters and/or sections (laptop
and slide presentations rather consist of a sequence of “screens” or slides). As
a structured text editor (see section 1.3), TEXMACS provides special markup for
sections. We recommend to use this markup and to refrain from manually
typesetting section titles using, say, a large underlined font.
3.5 QUOTATIONS AND PROMINENT STATEMENTS 51

New sections can be inserted using Insert „ Section or ⌥1 . There are different
levels of sections. At the top level, books are first subdivided into parts and
chapters. Articles and chapters of books are next subdivided into sections, sub-
sections and subsubsections. Smaller portions of text can finally be put into
paragraphs and subparagraphs. The level of a section can be changed a poste-
riori using the variant system. For instance, you may use ⌃⇥ in order to change
a section into subsection or a subsubsection into a paragraph.

Sections are numbered by default. You may toggle the numbering of indi-
vidual sections using ⌃# or the icon on the focus toolbar. Paragraphs and
subparagraphs form an exception: in most of the standard document styles
they are not numbered , but this default behavior can be overridden via Focus „
Preferences „ Paragraph display numbers.

TEXMACS also provides an appendix tag for appendices at the end of a paper or
book. Appendices are numbered A, B, C, ... instead of 1, 2, 3, ... In a similar
vein, books may include a prologue (Insert „ Chapter „ Prologue) or epilogue
(Insert „ Chapter „ Epilogue).

There are a few special types of unnumbered sections (or chapters) for which
the content can be generated automatically: tables of contents, bibliographies,
indexes, glossaries, lists of figures, etc. The mechanisms for automatic content
generation will be explained in section 6.4.

The subdivision of your document into sections provides a skeleton that is


useful for several purposes. We already mentioned the generation of tables
of contents. We also recall that the focus bar displays the current section title,
whenever the focus is on the entire document. By clicking on this title on the
focus bar, TEXMACS opens a menu that allows you to easily jump to any of the
other sections. When exporting a document to PDF, a suitable table of contents
is also automatically included.

3.5 Quotations and prominent statements

There are many occasions on which a fragment of text needs to catch the eye.
Mathematicians like to state their theorems prominently, whereas literary writ-
ings may use a special layout for quotations or poetry. High school teachers
emphasize the most crucial parts of their courses inside frames. Being a struc-
tured editor, TEXMACS encourages you to use special markup in each of these
situations. This in particular guarantees a uniform layout.

The markup described in this section is mainly intended for text fragments
of medium length. In LATEX, such markup elements are called environments.
People with HTML [41] or XML [3] backgrounds prefer the terminology block
markup. In section 3.7 below, we focus on inline markup for shorter pieces of
52 READY, STEADY, GO!

text, such as emphasized definitions of words or monospaced function names


inside computer programs.

3.5.1 Theorems

The backbone of mathematical discourse consists of theorems, proofs, and


other auxiliary propositions and lemmas. Numerous documents in other areas
are structured likewise, along hypotheses, principles, remarks, warnings, etc.
In TEXMACS, such structures are called enunciations, and you may insert them
using Insert „ Enunciation.

The most important “theorem-like” enunciations are emphasized, whereas the


more casual “remark-like” enunciations are not. TEXMACS also includes several
“exercise-like” enunciations for educational purposes, which may use a slightly
different layout. Here follows an example of each of these three main types
of enunciations:

THEOREM 3.1. On a Turing machine with sufficiently many tapes, two n-digit num-
bers can be multiplied in time O(n log n).

Note 3.2. The history of multiplication algorithms is a fascinating one, which


goes back to ancient Babylon. The above theorem from [23] corresponds to the
best currently known algorithm on a sequential computer.

Exercise 3.1. Show that the Euclidean division of a 2 n-digit integer by an n-digit one can also
be computed in time O(n log n).

It is nice to give credits in the very statement of a theorem. From within an


enunciation, this can be done using Focus „ Due to or the Due to button on the
focus bar.

By default, enunciations are numbered. Assuming that your cursor is inside an


enunciation, you may remove its number using the toggle Focus „ Numbered or
the icon on the focus toolbar.

Americans use the convention that theorems, lemmas, propositions, remarks,


etc. all share the same counter. This explains why the above Note is num-
bered 3.2, even though it is the first Note in this chapter. Some people prefer
the “European numbering style”, where each kind of enunciation carries its
own individual counter. You may select this alternative numbering style using
Focus „ Preferences „ European numbering style.

In books, TEXMACS prefixes the numbers of enunciations by the chapter number.


For long articles or books with long chapters, you may prefer to use the sec-
tion number as the prefix. This can be done using Focus „ Preferences „ Prefix
by section number.
3.5 QUOTATIONS AND PROMINENT STATEMENTS 53

The Focus „ Preferences menu of an enunciation contains a few other inter-


esting items that you may wish to try in order to customize the rendering.

3.5.2 Quotations and poetry

Three environments for quotations and poetry have been adapted from LATEX
to TEXMACS. The first one, quote (Insert „ Prominent „ Quote), should be used for
one or more short, one-line, quotations.

Eureka!  Archimedes
E = m c 2  Einstein

For longer quotations of more than one paragraph, you should rather use quo-
tation (Insert „ Prominent „ Quotation).
For poetry, you may use the verse tag (Insert „ Prominent „ Verse). The layout
is similar to quotations, but differs when it comes to line breaking. This is best
seen when making the paragraph artificially narrow:

Het was in eenen tsinxen


daghe
Dat beede bosch ende haghe
Met groenen loveren waren
bevaen.
Nobel, die coninc, hadde ghe-
daen
Sijn hof crayeren over al
Dat hi waende, hadde hijs
gheval,
Houden ten wel groeten love.
Doe quamen tes sconinx hove
Alle die diere, groet ende
cleene,
Sonder vos Reynaert alleene.
Hi hadde te hove so vele mes-
daen
..
.
Van den vos Reynaerde

3.5.3 Other prominent text

The Insert „ Prominent menu also contains various items to single out portions
of text in a visually oriented way. First of all, you may change the alignment
of a block of text using Insert „ Prominent „ Left aligned, Insert „ Prominent „ Cen-
54 READY, STEADY, GO!

tered and Insert „ Prominent „ Right aligned:

Left aligned
Centered
Right aligned
TEXMACS next provides a series of tags that allow you to surround a block of text
by vertical padding, horizontal lines, or a frame. These are illustrated below:

Use Insert „ Prominent „ Padded to insert vertical padding around


text.
You may also put horizontal lines around it using Insert „ Promi-
nent „ Lines around. If you only want a line above or below, then
you should use Insert „ Prominent „ Overlined or Insert „ Promi-
nent „ Underlined.

Really important statements can be framed using Insert „ Promi-


nent „ Framed.

These tags are often used in conjunction with other ones. For instance, we used
quotations for each of the above examples in order to make clear where they
start and end.
The markup for padding, overlines, underlines, and frames comes with sev-
eral style options. The precise amount of padding can be changed via Focus „
Above and Focus „ Below or directly on the focus toolbar. The default amount
of padding for all similar padded structures in your document can be speci-
fied using Focus „ Preferences „ Padding above and Focus „ Preferences „ Padding
below. For overlined and underlined structures, you may also change the
amount of space that separates the text from the lines. Framed boxes allow you
to specify a similar horizontal separation space, as well as a background color.
Ornaments (Insert „ Prominent „ Ornament) are a more general kind of frames
with even more bells and whistles. They are most convenient for laptop pre-
sentations, where you may use them for obtaining various graphical effects:

THEOREM 3.3. This is a theorem to remember.

3.6 Item lists


TEXMACS implements three main types of lists, depending on whether the items
are numbered or not and whether they contain a brief description.
Using Insert „ Itemize you may start a list with unnumbered items. You may
optionally select a specific item tag like • (bullets), − (dashes), or → (arrows),
to be put in front if the items in the list. Lists may be nested inside other lists,
3.6 ITEM LISTS 55

as follows:

• First item.

• Now comes the sublist:

∘ A subitem.

∘ Another one.

• A final item.

The rendering of the default item tag depends on the level of nesting: the • item
tag for the outermost level, the ∘ item tag at the second level, and so on.

Numbered lists can be inserted using Insert „ Enumerate. Again, you may
optionally choose a specific numbering style. Here is an example of an enu-
meration that was started using Insert „ Enumerate „ Roman:

I. A first item.

II. A second one.

III. And a last one.

The default numbering style again depends on the nesting level: at the outer-
most level, most styles use ordinary numbers. At the second level, it is common
to use lowercase letters, and so on.

Descriptive lists are started using Insert „ Description and they allow you to
describe a series of concepts:

Gnu. A hairy but gentle beast.

Gnat. Only lives in a zoo.

Yet once more, TEXMACS proposes several presentation styles, some of which
are only appropriate if you know beforehand that the keys Gnu, Gnat, etc. are
sufficiently short.

Assuming that you are inside an item list, pressing ↩ automatically starts a
new item. If you need items that are several paragraphs long, then you can
use ⇧↩ in order to start a new paragraph. TEXMACS also allows you to turn
an unnumbered item list into a numbered one and vice versa, using the toggle
Focus „ Numbered or the icon on the focus toolbar. The default layout of lists
is rather spaced out. You may select a more compact rendering style using
Focus „ Preferences „ Compact Lists. The low-level style parameters that control
the spacing of icons can also be customized via the style preferences menu
Focus „ Preferences.
56 READY, STEADY, GO!

Menu Tag Example Purpose


Strong strong this is important Indicate an important region of text
Emphasize em the real thing Emphasize a region of text
Definition dfn A gnu is a horny beast Definition of some concept
Sample samp the ae ligature æ A sequence of literal characters
Name name the LINUX system The name of a particular thing
Person person NIELS, il touche ! The name of a person
Cite cite* Melville's Moby Dick A bibliographic citation
Abbreviation abbr I work at the C.N.R.S. An abbreviation
Acronym acronym the HTML format An acronym
Verbatim verbatim the program said hello Verbatim text like program output
Keyboard kbd Please type return Text to be entered on a keyboard
Code code* cout << 1+1; yields 2 Code of a computer program
Variable var cp srcfile destfile Variables in a computer program
Deleted deleted Remove the tipo
// Mark text that has been deleted
Fill out fill-out My name is Sylvie
............. Text to be filled out
Marked marked Remind feeding the cat A crucial passage

Table 3.7. Common content-based tags and how to obtain them via Insert „ Content tag.

3.7 Special textual markup


We have already encountered various block markup elements for prominent
text of one or more paragraphs (see section 3.5). Similar inline markup elements
for shorter pieces of text can be found in the submenu Insert „ Content tag.
For example, using Insert „ Content tag „ Strong, you can mark important words
or concepts. The default rendering of important text uses a bold typeface,
but certain document styles may opt for an alternative presentation. For this
reason, you should not use the strong tag as a substitute for “bold rendering”,
but only for the precise purpose of singling out important fragments of text.
We have listed the most common inline content tags in Table 3.7. Due to name
clashes, some tags do not carry the most intuitive names: the block tag defini-
tion is one of the standard TEXMACS enunciations (see section 3.5.1), the tag cite
for citations based on bibliographic databases (see section 6.5), and code for
multiple lines of code.
In addition to the above inline content markup, TEXMACS also provides several
kinds of presentation markup. First of all, tags for several standard font sizes
can be found in Insert „ Size tag. These sizes are relative to the size of the main
document font. For instance, assuming that the main document is composed
using a 10 point font, “small” text will use an 8 point font; if the base font size is
12 point, then “small” text rather corresponds to a 10 point font. See Table 3.8
for the available size tags. Notice that you may use ⌃⇥ and ⌃⇧⇥ to cycle among
the various font sizes.
3.8 FONTS 57

Size tag Example Size tag Example


really-tiny Really tiny large Large
tiny Tiny very-large Very large
very-small Very small
small Small
huge Huge
normal-size Normal really-huge Really huge
Table 3.8. Common size tags available through Insert „ Size tag.

Other presentation markup can be found in Insert „ Presentation tag: you may
use Underline, Overline, and Strike through for underlined, overlined, and
--crossed-out
-------------------------------------------- text, respectively. (Although underlining is a common way to
emphasize text in handwritten documents, we notice that this practice is con-
sidered bad taste for printed material.) Subscripts and superscripts as in 2 nd
can be obtained using Subscript and Superscript or the keyboard shortcuts _ ⇥
and ^ ⇥ . Using Pastel, Greyed, and Light, you may create translucent text with
various degrees of transparency. This feature is typically used for laptop pre-
sentations in order to anticipate upcoming content. The graphical effect is best
noticed when using colored text on background patterns.

Pastel red, green, and blue text


Greyed red, green, and blue text
Light red, green, and blue text
Normal red, green, and blue text

3.8 Fonts
As we have discussed at length by now (see sections 1.3 and 3.7), traditional
typesetters tend to use special fonts only for specific, well-identified purposes.
Users are recommended to use the appropriate markup for these purposes,
rather than changing the font explicitly. Nevertheless, you may sometimes
wish to select a particular font yourself, or search for a font with certain char-
acteristics (e.g. a bold handwritten font).

3.8.1 Font management


Before you select a nominal font, beware of the fact that high quality fonts
are really collections of fonts. It is quite common that a font comes with bold
and italic variants. Rich font collections may implement even more variants:
sans serif, monospaced, SMALL CAPITALS, etc. In addition, modern UNICODE
fonts do not only provide glyphs for English text, but also for accented char-
acters and other scripts (Greek, Cyrillic, Chinese, etc.). Similarly, scientific doc-
uments with mathematical formulas may require a UNICODE font with a large
set of mathematical symbols [64, 2].
58 READY, STEADY, GO!

In comparison with other non-structured text editors, this idea of font collections
is particularly important in TEXMACS. Indeed, assume that you have selected
one of your favorite fonts. Which font is TEXMACS supposed to use when you
start a mathematical formula, when a monospaced variant is needed for type-
setting a computer program, or when part of your document is written in an
exotic language? There are only a very limited number of fonts that allow you
to do all this. Examples include the Computer Modern [37] and Stix fonts [54],
as well as the TEX Gyre fonts Bonum, Pagella, Schola, Termes, and DejaVu [32].
The above discussion actually raises three main questions. First of all, how
to find those font collections that support a certain number of features (e.g.
all Cyrillic fonts with bold and italic variants)? Secondly, what to do if a cer-
tain feature is not available for the user's favorite font (e.g. typeset a computer
program using a font with no monospaced variant)? Finally, how to specify
separate fonts for specific tasks (one font for normal text, another one for bold
section titles, and yet another one for mathematical formulas)?
TEXMACS partially addresses these problems by maintaining a detailed font
database. This database contains more information about fonts than the fonts
themselves. For instance, TEXMACS is aware which fonts are sans serif, hand-
written, outlined, monospaced, etc. The database also contains more subtle
technical information about the general shape of the font (its boldness, aspect
ratio, slant, ascent, descent, etc.). In the case when a font with certain required
properties does not exist, this allows TEXMACS to search for the best available
proxy. The same mechanism applies when a particular character is missing
in a font.
The downside to the above approach is that part of the information in the data-
base needs to be entered manually. Although the database contains entries for
most of the standard fonts available under GNU/LINUX, MACOS, and WIN-
DOWS, it may not recognize any further fonts that you may have purchased or
installed on your system.
Another thing to keep in mind when using less common fonts is that TEXMACS
comes with only a limited number of preinstalled fonts, such as the Stix fonts,
the TeX Gyre fonts, and several fonts prefixed by “TeXmacs”. Documents
that only use these fonts will be rendered in the same way on different sys-
tems (assuming the versions of TEXMACS are identical). Any other fonts may be
replaced by closest available proxies according to the font database.

3.8.2 Selecting a font

In TEXMACS, the global document font can be specified using Document „ Font.
It is also possible to locally use another font using Format „ Font. Both Doc-
ument „ Font and Format „ Font open the TEXMACS font browser, which looks
like the window in Figure 3.2. The standard way to indicate fonts is via their
Family, Style and Size (in points). In addition, TEXMACS provides several filters
that allow you to search for fonts that meet one or more criteria.
3.8 FONTS 59

Figure 3.2. The TEXMACS font selector.

In the example, we first selected the “Baskerville Regular” font. Using the Cate-
gory pop-up choice list on the right, we next searched for a font with a “Retro”
look and feel that combines as well as possible with the Baskerville font. The
header of the Sample text indicates that “Essays1743 Medium” is the best match
that we could find on our system. The standard sample text shows the ren-
dering of various characters in this font (other sample texts can be selected
instead from the choice list that indicates Standard). The Family frame lists all
“Retro” fonts that were found on our system. Since we did not select any of
these font families yet, the Style frame does not contain any corresponding
styles.
The easiest way to select a font is by clicking on a suitable family and then
press Ok. If you rather select your font by picking a style or by using a filter (as
in our example), then the semantics of font selection is slightly more subtle. For
instance, when clicking on Ok in Figure 3.2, TEXMACS will insert a tag inside the
document that asks for a “Retro” font. Since the surrounding text was typeset
using the “Baskerville Regular” font, any text that you will enter next will be
typeset using the “Essays1743 Medium” font, as indicated by the font selector;
so far so good. However, whenever you copy and paste the newly entered
text somewhere else, the appropriate “Retro” font for the surrounding text is
not necessarily “Essays1743 Medium”: TEXMACS might use another, more rel-
evant font instead.
60 READY, STEADY, GO!

Although the font selector is easy to use, it is more limited when it comes to
specifying a more precise fallback strategy in the case of missing fonts or char-
acters. For example, it does not allow you to specify one particular font for text
and another one for mathematics. TEXMACS provides a mechanism for building
composite of this type, which is beyond the scope of this book, and currently
only intended for expert users (if you are curious, then you may try Edit „ Pref-
erences „ Other „ Advanced font customization before opening the font selector).
Another way to force a particular font for, say, mathematics is to adapt the
math macro so as to use this font.
That said, we notice that TEXMACS is good at emulating mathematical sym-
bols for fonts that do not natively support them. For example, in case of the
Essays1743 font, the arrow ----› is obtained by juxtaposing two minus signs - and
the closing guillemet ›; we refer to [27] for more details.

3.8.3 Font characteristics


As explained above, fonts have three main characteristics:

Family. Fonts are grouped together into families with a similar design.

Shape. Inside the same font family, individual fonts have different shapes,
such as bold, italic, small capitals, etc.

Size. The font size in points.

The actual font files on your hard disk usually correspond to the font family
and the font shape; the font itself can automatically be scaled to any size.
The TEXMACS font database keeps track of several extra characteristics of fonts.
The font selector allows you to filter on the following criteria:

Weight. The font weight corresponds to the “thickness” of the font:


Thin L i g ht Medium Bold B l a c k
Slant. The font slant determines the angle of the font:
Normal Italic Oblique

Stretch. This property determines the horizontal width for a fixed vertical
height:
Condensed Unextended Wide
Case. This property determines how lowercase letters are capitalized:
Mixed SMALL CAPITALS

Serif. This feature corresponds to decorations at the end of strokes that


remind of letters carved into stone:
Serif Sans Serif
3.9 PARAGRAPH LAYOUT 61

Spacing. This feature corresponds to the horizontal spacing between char-


acters:
Proportional Monospaced

Device. This property can be used to imitate specific “writing devices”:

Print Typewriter Digital Pen Art pen Chalk Marker

Category. Various other font features:


Ancient Attached Calligraphic Comic
Distorted Gothic
Decorative Handwritten
Initials Medieval Miscellaneous Outline
Retro Scifi Title

Each of the above properties really constitutes a hint on the kind of font that
should be used. If no suitable font can be found on your particular system, then
setting these properties may have no effect.
Let us finally recall that the left footer of the TEXMACS window indicates some
of the most significant properties of the font being used at the current cursor
position. For instance, for a generic newly created document, it displays “text
roman 10”, which means that you are working in text mode using Knuth's 10
point Computer Modern “Roman” font [37].

3.9 Paragraph layout


Most of the time, the layout of paragraphs is determined automatically, as
a function of the document style and structured markup inside your text. You
may sometimes want to adjust this default layout. This can either be done
globally, using Document „ Paragraph, or for one or more specific paragraphs,
using Format „ Paragraph. We recall from section 3.5 that specific rendering
effects can also be obtained using the block markup elements in Insert „ Promi-
nent.

The alignment of paragraphs can be changed in the Format „ Paragraph „ Basic „


Alignment choice list. The four possible alignment styles are Left, Centered,
Right and Justified. The default style is Justified, meaning that full lines are
stretched as much as needed in order to align their right-hand sides.
There are two classical ways to make the beginnings of successive paragraphs
easy to spot for the reader (see Figure 3.3): by indenting the first line of each
paragraph or by inserting additional vertical whitespace between consecutive
paragraphs. The extra indentation to be used for first lines of paragraphs can
be specified in Format „ Paragraph „ Basic „ First indentation. The amount of
whitespace between successive paragraphs can be changed in Format „ Para-
graph „ Basic „ Interparagraph space.
62 READY, STEADY, GO!

The quick brown fox The quick brown fox jumps


jumps over the lazy dog. The over the lazy dog. The quick
quick brown fox jumps over brown fox jumps over the lazy
the lazy dog. dog.
The quick brown fox again
The quick brown fox again
jumps over the lazy dog. The
jumps over the lazy dog. The
quick brown fox again jumps
quick brown fox again jumps
over the lazy dog.
over the lazy dog.
The quick brown fox is get-
ting tired, jumping over the The quick brown fox is getting
lazy dog. tired, jumping over the lazy
dog.
Figure 3.3. Two common paragraph styles.

At this point it is useful to say a few words about lengths in TEXMACS. Most
of the fields in the Format „ Paragraph dialogue window expect length values.
For instance, in order to indent every first line of a paragraph by a quarter of
an inch, you should enter 0.25 in as the value for Format „ Paragraph „ Basic „
First indentation. A TEXMACS length consists of a number (e.g. 0.25) followed
by a unit (e.g. in). Apart from the standard units mm, cm, and in, TEXMACS
also provides several units of interest for typographers, such as pt (one point;
approximately 1/72 inch), fn (the current font size; e.g. 10 pt), or tab (a special
unit for indentations; by default, 1 tab equals 1.5 fn and the article style uses
a first indentation of 1 tab); see Table 3.9 for an overview.
The dialogue window Format „ Paragraph allows you to specify a few other
layout properties of paragraphs. The margins can be changed using Left margin
and Right margin. For instance, inside quotations (see section 3.5.2), both the
left and right margins are increased by 2 tab. The spacing between individual
lines is controlled via Interline space. By default, TEXMACS uses a small inter-
line space of 0.2 fn. A zero interline space makes ordinary text less readable,
but can be acceptable for computer programs, while stuffing as much code

Unit Purpose Unit Purpose


cm Centimeter fn Font size (quad space)
mm Millimeter tab Tab space
in Inch spc Space in current font
pt Typographic point sep Separation space
dd Didot point ex Height of x character
pc Pica (12 pt) ln Fraction bar width
cc Cicero (12 dd) par Paragraph width
pag Page height
Table 3.9. Available length units in TEXMACS.
3.9 PARAGRAPH LAYOUT 63

The quick brown fox The quick brown fox The quick brown fox
jumps over the lazy jumps over the lazy
dog. The quick brown dog. The quick brown jumps over the lazy
fox jumps over the fox jumps over the
lazy dog. The quick dog. The quick brown
lazy dog. The quick
brown fox jumps
brown fox jumps fox jumps over the
over the lazy dog.
The quick brown fox over the lazy dog.
The quick brown fox lazy dog. The quick
jumps over the lazy
dog. jumps over the lazy brown fox jumps over
dog.
the lazy dog.
Figure 3.4. Illustration of three different interline spaces: 0 fn, 0.2 fn, and 1 fn.

as possible on the screen. An interline space of 1 fn can be useful for drafts


in which readers are likely to make extensive annotations between the lines.
These three different settings are illustrated in Figure 3.4.
TEXMACS finally allows you to typeset text in more than one column, while
specifying the horizontal space between separate columns (using Number of
columns and Column separation). The Format „ Paragraph „ Advanced tab con-
tains yet more expert settings for the layout of paragraphs.
If your aim is not so much to force a precise layout, but rather to obtain certain
graphical effects, then you may prefer to use the markup from Insert „ Promi-
nent rather than the dialogue window Format „ Paragraph. Most of these tags
were already discussed in section 3.5. You may use Insert „ Prominent „ Indent
for adding a fixed amount of indentation to the left margin (this is often needed
for computer programs). TEXMACS also provides the jump-in tag (Insert „ Promi-
nent „ Indent) for typesetting text using a negative first indentation, with the
effect of making paragraphs “jump in”. A compact layout (Insert „ Prominent „
Compact) reduces the amount of interparagraph space; see Table 3.5.

The quick brown fox The quick brown fox The quick brown fox
jumps over the lazy jumps over the lazy dog.
Jumps over the lazy
dog. The quick brown fox
dog.
jumps over the lazy dog.
The quick brown fox
The quick fox The quick brown fox
jumps over the lazy
jumps over the lazy dog.
Jumps over dog. The quick
The quick brown fox
dogs. brown fox jumps
jumps over the lazy dog.
over the lazy dog.
The quick brown fox
jumps over the lazy
dog.
Figure 3.5. Effect of the markup elements indent, jump-in, and compact.
64 READY, STEADY, GO!

3.10 Page layout

The default page layout is determined by the document style. You can cus-
tomize it using the dialogue window that is opened via Document „ Page. For
a newly created document, you may also change some of the settings using the
icon (or possibly , , , , or ) on the focus toolbar (see section 2.7).
In order to tweak the layout of a specific page, you should rather use Format „
Page.

The main characteristics of a page are its size (most of the standard page
sizes—such as A4, A5, Letter, Legal, etc.—are supported by TEXMACS) and its
orientation (portrait or landscape). These properties can be specified via Doc-
ument „ Page „ Format „ Page type and Orientation.

Another major issue is how to display pages on your screen. It is crucial to


understand that TEXMACS may render your document differently on screen and
on paper3.1. TEXMACS supports four major rendering modes in Document „ Page „
Format „ Page rendering:

• The paper rendering reflects the actual way your document will be
printed. Page breaks are made explicit by showing the pages separately,
one below another.

• The papyrus rendering mode treats your document as if it were printed


on a big roll of papyrus with the specified “page” width, but whose
vertical height is as large as needed.

• The screen setting can be used if you do not intend to print your doc-
ument. The page width and height are automatically adjusted to the
size of your window. This is most useful when browsing web pages or
using TEXMACS as an interface for some computer algebra system.

• The beamer mode is reserved for laptop presentations; see chapter 9.

The page breaking algorithm takes some time on large documents, which may
hamper the reactivity of the editor while typing. For this reason, we recom-
mend that you edit such documents in “papyrus” mode and only switch to
“paper” mode when your document is almost finished (e.g. in order to inspect
the page breaks).

3.1. For TEXMACS to be “truly wysiwyg”, you need to select the paper rendering mode and Docu-
ment „ Page „ Margins „ Same screen margins as on paper. However, since screens and paper are
different media, editing your document as if it were already printed is not always convenient. For
instance, page breaks may heavily change while you are typing, and thereby cause unpleasant
jumping around of the cursor. Sentences with page breaks may also become hard to read.
3.10 PAGE LAYOUT 65

Figure 3.6. Schematic representation of the typical layout of a book: the left margins are
larger than the right margins on the (even) left-hand pages, whereas they are smaller on
the (odd) right-hand pages.

The second most important decision about page layout concerns the margins;
these can be specified in the tab Document „ Page „ Margins. Remember that the
lines of your text should not be made too long, thereby keeping them easy to
read. On standard paper of A4 or Letter size, this can be achieved by using suf-
ficiently large margins or a larger font. Another option is to use a two column
layout. It is also interesting to know that printed books tend to use different
margins for odd and even pages: see Figure 3.6. Since margins on actual paper
can be quite large, you finally may wish to use different margins when editing
documents on your screen. In Document „ Page „ Margins, you are therefore
allowed to separately specify paper margins and screen margins (or force the
same settings for both using Same screen margins as on paper).
The remaining global settings for page layout are intended for more expert
users. In particular, it is recommended to not specify page headers and footers
through Document „ Page „ Headers, except when you selected the generic
document style. The reason is that title blocks and section titles often override
these settings, since the main title, the authors and titles of sections are typi-
cally used inside page headers.
On the other hand, it is safe to customize the headers and footers of a particular
page using Format „ Page „ This page header and This page footer. You may also
change the number of a particular page (and all the subsequent ones) using
Format „ Page „ This page number. You may finally change the way page num-
bers are rendered using Format „ Page „ Page number rendering.
Chapter 4
Mathematics
You enter math mode by starting a new formula or by placing the cursor inside
an existing formula. In math mode, the menus, the icon toolbars, and the key-
board behavior are adapted so as to facilitate the insertion of mathematical
symbols and markup. For instance, typing - > inserts the arrow →.
Recent versions of TEXMACS also include optional “semantic editing” facili-
ties that will briefly be described at the end of this chapter (see [26, 29] for
more details). When used appropriately, these allow you to write documents
in which all formulas are at least correct from a syntactical point of view.
A “syntax corrector” is included to assist you with this task. Syntactic correct-
ness is for instance important when using formulas as inputs for a computer
algebra system. Syntactically correct documents are also less likely to contain
“typos”. Further functionalities, such as semantic search and replace, should
be developed in the future.

4.1 Incorporating mathematical formulas


TEXMACS provides three main ways to insert mathematical formulas into the
main text:
Inline formulas. Short formulas—such as a 2 +b 2 =c 2—are usually embedded
directly into the main text flow. Such inline formulas can be inserted using $ or
Insert „ Mathematics „ Inline formula.
The typesetter attempts to squeeze inline formulas as much as possible, so that
they do not disrupt the general presentation. For example, the presentation
1
lim n→∞ log n/ n = 0 is preferred over lim log n/ n = 0, and x = 2 over x = .
1
n→∞ 2
Nevertheless, you can force the more voluminous renderings using Format „
Display style „ on.

Displayed formulas. Big or important formulas are usually displayed on sep-


arate lines:
x n + y n = z n.

Such displayed formulas can be inserted using ⌥$ or Insert „ Mathematics „ Dis-


played formula and use a less compressed layout than inline formulas. You may
turn an inline formula into a displayed one and vice versa using ⌃⇥ . Displayed
formulas can also be numbered using the toggle ⌃# or Focus „ Numbered.
Equation arrays. For the presentation of multiple equations, it is best to align
them as in the following example:
x+0 = x

66
4.2 MATHEMATICAL SYMBOLS 67

x + (−x) = 0
x+y = y+x
(x + y) + z = x + (y + z).
A similar layout is often required for step by step computations
(e sin x + sin e x)′ = (e sin x)′ + (sin e x)′
= (sin x)′ e sin x + (e x)′ sin e x
= e sin x cos x + e x sin e x,
in which case several left-hand members are simply left empty.
In order to create so-called equation arrays of this type, you may use ⌥& or
Insert „ Mathematics „ Several equations. The typesetter uses a table with three
columns for the rendering, where the first column is aligned to the right, the
third one to the left, and the middle column is centered. New rows are cre-
ated by pressing ↩ . In fact, since equation arrays are special forms of tables,
all table editing rules apply (see chapter 5). In a sense, they are also somewhat
superfluous: you may obtain the same layout by creating an appropriate ta-
ble inside a displayed formula. Nevertheless, equation arrays are so common
in mathematical documents that it is nice to have special markup for them.

4.2 Mathematical symbols


Following the basic design principles of the user interface (see section 2.1),
TEXMACS allows you to enter most mathematical symbols in at least four ways:
using the menus, the icon toolbars, appropriate keyboard shortcuts, or LATEX
commands.
For example, the binary relation “⩽” can both be found in the Insert „ Symbol „
Binary relation menu and in the toolbar menu under the icon . When hov-
ering the mouse pointer for a while over the ⩽ in either of these menus, the
corresponding keyboard shortcut < = will appear in a help balloon. Users who
are familiar with LATEX, may also enter the symbol using \ l e q s l a n t ↩ .
The keyboard shortcuts for mathematical symbols were designed according to
a small number of simple rules, which make them easy to remember. Before we
go into more details, it should also be noticed that symbols carry a precise syn-
tactical semantics in TEXMACS. In particular, TEXMACS carefully distinguishes
between so-called homoglyphs, which are distinct symbols that look the same.
For more information, see sections 4.9 and 4.11 below.
For example, the vertical bar | can be used as a separator for defining sets
R > = {x ∈ R | x > 0}, but also as the binary relation “divides” (e.g. 11 | 1001), or
for restricting the domain of a function: f |E. Such homoglyphs have different
binding forces and often come with a different spacing. The most annoying
ambiguity is between invisible multiplication xy and function application sin x,
which are respectively entered using the shortcuts * and ␣ .
As a general rule, we also note that TEXMACS takes care of the spacing inside
mathematical formulas. For instance, you enter a + b by typing a + b , not
68 MATHEMATICS

𝛼 a ⇥ 𝛽 b ⇥ 𝛾 g ⇥ 𝛿 d ⇥ 𝜀 e ⇥ 𝜖 e ⇥ ⇥ ⇥
𝜁 z ⇥ 𝜂 h ⇥ 𝜃 j ⇥ 𝜗 j ⇥ ⇥ ⇥ 𝜄 i ⇥ 𝜅 k ⇥
𝜘 k ⇥ ⇥ 𝜆 l ⇥ 𝜇 m ⇥ 𝜈 n ⇥ 𝜉 x ⇥ 𝜊 o ⇥
𝜋 p ⇥ 𝜛 p ⇥ ⇥ ⇥ 𝜌 r ⇥ 𝜚 r ⇥ ⇥ 𝜎 s ⇥ 𝜍 s ⇥ ⇥
𝜏 t ⇥ 𝜐 u ⇥ 𝜑 f ⇥ 𝜙 f ⇥ ⇥ 𝜓 y ⇥ 𝜒 q ⇥
𝜔 w ⇥

Α A ⇥ Β B ⇥ Γ G ⇥ Δ D ⇥ Ε E ⇥ Ζ Z ⇥
Η H ⇥ Θ J ⇥ Ι I ⇥ Κ K ⇥ Λ L ⇥ Μ M ⇥
Ν N ⇥ Ξ X ⇥ Ο O ⇥ Π P ⇥ Ρ R ⇥ Σ S ⇥
Τ T ⇥ Υ U ⇥ Φ F ⇥ Ψ Y ⇥ Χ Q ⇥ Ω W ⇥

Table 4.1. Keyboard shortcuts for Greek characters.

a ␣ + ␣ b . The space bar is reserved for function application: typing s i n ␣ x


produces sin x.

4.2.1 Letter-like symbols


Mathematicians like to use Greek characters as well as letters in several special
fonts for particular purposes. For instance, the set of natural numbers is typi-
cally denoted by ℕ and a maximal ideal by 𝔪.
Greek characters can be obtained using the Tab key ⇥ , as variants of the usual
Roman letters. For instance, you may enter 𝛽 and Λ using b ⇥ and L ⇥ . Table 4.1
shows keyboard shortcuts for the complete Greek alphabet. Notice that the
Greek letters 𝜀, 𝜃, 𝜅, 𝜋, 𝜌, 𝜎, and 𝜑 admit alternative renderings 𝜖, 𝜗, 𝜘, 𝜛,
𝜚, 𝜍, and 𝜙.
TEXMACS reserves the function keys F5 , F6 , F7 , and F8 for entering characters
in special mathematical fonts:
F5 . This is the keyboard prefix for upright mathematical symbols. For
example, F5 S produces S instead of S, whereas F5 l ⇥ produces λ
instead of 𝜆.
F6 . This keyboard prefix is used for producing bold letters such as 𝒗 ( F6 v )
or 𝑺 ( F6 S ). You may combine it with the other prefixes F5 , F7 , and F8 .
For example, F6 F5 v yields 𝐯 and F6 F7 X yields 𝓧.
⇧F6 . You may use this prefix for “blackboard bold” fonts. The classical sets ℂ,
ℕ, ℚ, ℝ, and ℤ can for example be obtained using the shortcuts ⇧F6 C ,
⇧F6 N , ⇧F6 Q , ⇧F6 R , and ⇧F6 Z . An even easier way to obtain these
symbols is using C C , N N , Q Q , R R , and Z Z , i.e. by typing twice the
same uppercase letter.
F7 . This is the keyboard prefix for calligraphic symbols such as 𝒜 ( F7 A )
and 𝒫 ( F7 P ). Notice that not all fonts provide calligraphic variants 𝒶,
𝒷, 𝒸, . . . for lowercase letters. Whenever such variants are missing for
a given font, then TEXMACS will use a system-dependent substitute font
instead (see section 3.8.1).
4.2 MATHEMATICAL SYMBOLS 69

d d ⇥ ⇥ ∂ d ⇥ ⇥ ⇥ e e ⇥ ⇥ i i ⇥ ⇥
γ g ⇥ ⇥ λ l ⇥ ⇥ π p ⇥ ⇥ Γ G ⇥ ⇥ ⇥
ℏ h ⇥ ⇥ ı i ⇥ ⇥ ⇥ j j ⇥ ⇥ ℓ l ⇥ ⇥ ⇥
D D ⇥ ⇥ ∇ V ⇥ ⇥ Δ D ⇥ ⇥ ⇥ ⇥ ∞ @ @
ℜ R E ℑ I M ∁ C ⇥ ⇥ ⇥ ϝ G ⇥ ⇥ ⇥ ⇥
∀ A ⇥ ⇥ ∃ E ⇥ ⇥ ∃∃ E ⇥ ⇥ ⇥ ℘ P ⇥ ⇥
ℵ A ⇥ ⇥ ⇥ ℶ B ⇥ ⇥ ⇥ ℷ G ⇥ ⇥ ℸ D ⇥ ⇥ ⇥
Ε
϶ e ⇥ ⇥ ⇥ ⇥
ω w ⇥ ⇥ E ⇥ ⇥ ⇥ ⇥ ℧ W ⇥ ⇥

Table 4.2. Keyboard shortcuts for several letter-like symbols.

F8 . This keyboard prefix corresponds to the “Fraktur” font. For example,


the shortcuts F8 m and F8 J produce 𝔪 and ℑ.
In fact, we note that TEXMACS does not consider mathematical letter-like symbols
like 𝒗, ℕ, 𝒜, and 𝔪 as being typeset in a separate font. Instead, such sym-
bols are interpreted as special characters in an extended (UNICODE) alphabet.
In particular, the font selector (see section 3.8.2) does not contain any entry
for—say—the “blackboard bold” font.
There exist a few more letter-like symbols that cannot be obtained through the
systematic mechanisms from above. First of all, the important mathematical
constants i, e, and π are entered using i ⇥ ⇥ , e ⇥ ⇥ , and p ⇥ ⇥ . Notice that
TEXMACS uses an upright rendering for these constants, which allows you to
distinguish them from the letters i, e, and 𝜋. The d and λ from differential- and
lambda-calculus are entered similarly, using d ⇥ ⇥ and l ⇥ ⇥ . Table 4.2 shows
the list of keyboard shortcuts for these and other letter-like mathematical sym-
bols.

4.2.2 Other symbols


There are a few simple rules that allow you to enter most non-letter-like math-
ematical symbols using “natural” key-combinations. The most important rule
is juxtaposition: - > yields →, - - > yields ⟶, and > = yields ⩾. Similarly,
| ⇥ - yields ⊢, | - > yields ↦, and - > < - yields ⇄. The other rules are all
based on the use of a special key:
⇥ . This is the main key for obtaining variants (see section 2.3.2). Some sym-
bols have many variants. For example, < yields <, < ⇥ yields ∈, < ⇥ ⇥
yields ⊂, < ⇥ ⇥ ⇥ yields ≺, < ⇥ ⇥ ⇥ ⇥ yields ⊏, < ⇥ ⇥ ⇥ ⇥ ⇥ yields ⟨⟩, and
< ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ returns to <. You may “cycle back” among the variants
using ⇧⇥ , so that < ⇥ ⇥ ⇧⇥ is equivalent to < ⇥ . For symbols with many
variants, the last variants are obtained most efficiently by cycling back.
For example, quick shortcuts for ⟨⟩ and ⊏ are < ⇧⇥ and < ⇧⇥ ⇧⇥ .
The variant mechanism is particularly powerful when used in conjunc-
tion with juxtaposition. For example, < = , < = ⇥ , < = ⇥ ⇥ , and < = ⇥ ⇥ ⇥
respectively yield ⩽, ≤, ≦, and ⇐. Notice that the juxtapositions are
horizontal for the first three shortcuts, but vertical for the last one. Sim-
ilarly, the shortcuts < = = , < ⇥ ⇥ = , and < < < = produce ⟸, ⊆, and ≤≤≤.
70 MATHEMATICS

@ . This key is used for putting symbols into circles or boxes. For example,
@ + yields ⊕ and @ x yields ⊗. Similarly, @ ⇥ + yields ⊞.

/ . Slashes are used for negations. For example, = / yields ≠ and < = /
yields ⩽. Notice that < = ⇥ ⇥ / yields ≦
/ , whereas < = ⇥ ⇥ / ⇥ yields ≨.
! . After entering an arrow, this key forces scripts to be placed above or
below the
x
arrow. For example, - - > ^ x yields ⟶x , but - - > ! ^ x
yields ⟶.

s i n . Special operators such as “sin” are simply obtained by typing s i n .


More precisely, any sequence of two or more unaccented Latin letters
is regarded as an operator by TEXMACS. In order to enter the formula
x y (x times y), you have to explicitly insert a multiplication using * .
Indeed, typing x y yields xy, whereas x * y produces the desired
result. We also recall that TEXMACS makes an explicit distinction between
multiplication and function application. This means that you should
type L ␣ x in order to produce L x (L applied to x), and s i n ␣ s i n ␣ x
for getting sin sin x.

Apart from these general rules, there are a few other shortcuts and facts that
are worth knowing:

* . By default, this key is used for “invisible” multiplications, as in xy =x ⋅y.


The “visible” multiplication symbols ×, ∗, ⋅, and ∧ (wedge product) are
obtained as variants, using * ⇥ , * ⇥ ⇥ , etc.
Notice that the presence of an invisible multiplication is indicated by
a small space. TEXMACS provides a few other invisible operators, such
as invisible function application (sin x), invisible addition (5 3/4), etc.;
see section 4.11. You may use Document „ Informative flags „ Detailed in
order to display additional visual hints that will not appear in print,
but that allow you to distinguish between different types of invisible
operators while editing.

␣ . The space symbol is reserved for function application, as in exp x. By


default, TEXMACS tries to avoid the insertion of any spurious space.
Typing a ␣ + ␣ b is therefore equivalent to typing a + b . If you want
to force TEXMACS to insert all spaces you type, then you should select
Edit „ Preferences „ Space bar in math mode „ Allow spurious spaces.

Inserting a space of a specified length is also possible using Format „


Whitespace „ Horizontal space. From a semantic point of view, TEXMACS
ignores all whitespace of this kind. Large spaces that should be con-
sidered as function applications or commas can be entered as variants
of spaces and commas. For instance, the space in the function applica-
tion 𝜑 x can be entered using ␣ ⇥ . Notice that this space is larger than
the standard function application space in 𝜑x.
4.2 MATHEMATICAL SYMBOLS 71

⊕ @ + ⊖ @ - ⊗ @ * ⊘ @ / ⇥
⊙ @ . ⊚ @ @ ⇥ ~ @ * ⇥ ⊙ @ |

− −
⊞ @ ⇥ + ⊟ @ ⇥ - ⊠ @ ⇥ * − @ ⇥ /

− − −

⊡ @ ⇥ . ⧇ @ ⇥ @ −
∗ @ ⇥ * ⇥ − @ ⇥ |




− −
± + - ∓ - + × * ⇥ ÷ / ⇥ ⇥
∗ * ⇥ ⇥ ⋆ * ⇥ ⇥ ⇥ ⇥ ⇥ ∘ @ • @ ⇥ ⇥
∩ & ⇥ ∪ % ⇥ ⊎ % ⇥ + ⋅ * ⇥ ⇥ ⇥
⊓ & ⇥ ⇥ ⊔ % ⇥ ⇥ ∨ % ∧ &
⋎ % ⇥ ⇥ ⇥ ⇥ ⋏ & ⇥ ⇥ ⇥ ⇥ ⊻ % - ⌅ - &
⋉ | ⇥ * ⋊ * ⇥ ⇥ | ⋋ T ⇥ ⇥ ⇥ ⇥ ⋌ T ⇥ ⇥ ⇥ ⇥ ⇥

Table 4.3. Binary operators (see also Insert „ Symbol „ Binary operator).

. . The default dot stands for the decimal dot, as in 3.14159. The dot symbol
has several variants: the “point” operator from λ-calculus ( . ⇥ ) as in λx.
x 2, the “dummy” dot ⋅ ( . ⇥ ⇥ ) as in g = f (x, ⋅), and the invisible dummy
dot ( . ⇥ ⇥ ⇥ ).
Various kinds of ellipses . . ., ⋅ ⋅ ⋅, . . . , ⋅⋅⋅, ⋅ ⋅ ⋅ , and ⋅ ⋅ ⋅ can be obtained using
the shortcuts . . , . . ⇥ , etc. The “lower” ellipses should be used in
expressions such as x 1, . . . , x n and K[[x 1; . . . ; x n]], whereas the centered
ellipses should be preferred in x 1 + ⋅ ⋅ ⋅ + x n and x 1 ⋅ ⋅ ⋅ x n. Notice that
TEXMACS provides the additional shortcuts , , , + + , etc. for entering
“, . . . , ”, “+⋅ ⋅ ⋅ + ”, etc.
, . The comma most commonly serves as a separator, as in f (x, y, z) and
x 1,...,xn. Variants are the “decimal comma” (like in 3,14159), the invisible
comma (as in the matrix (M ij)), and various “wide invisible commas”,
as in the list of formulas
a1 = b1 a2 = b1 + b2 a3 = b 1 + b 2 + b 3.

& , % . The logical connectors ∧ and ∨ are obtained using & and % . The con-
junction ∧ has many variants (namely ∩, ⊓, , ⋏, &, ', and &), and so
does the conjunction ∨ (namely ∪, ⊔, ⨿, ⋎, ., /, ‰, and %). The literal
symbols & and % are obtained most efficiently through F5 & and F5 % .
Alternative shortcuts for ∧ and ∨ are / \ and \ / , with approximately
the same variants as above.
# . This key is used for the “number” prefix #, with variants ♯ and ♮. The
“flat” symbol ♭ can be obtained using b ⇥ ⇥ .

4.2.3 Keyboard shortcuts for common symbols


For the reader's convenience, we have included Tables 4.3–4.9 with keyboard
shortcuts for common symbols. The shortcuts are easily remembered when
applying the rules from the previous section. We also note that some of the
keyboard shortcuts may change from one version of TEXMACS to another, e.g.
due to the appearance of a new symbol.
72 MATHEMATICS

∼ ~ ≃ ~ - ≈ ~ ~ ≅ ~ =
≁ ~ / ≄ ~ - / ≉ ~ ~ / ≇ ~ = /
≍ = ⇥ ≡ = ⇥ ⇥ ≅ ~ = ∼
− = ⇥ ⇥ ⇥ ⇥

≭ = ⇥ / ≢ = ⇥ ⇥ / ≇ ~ = / ∼
/
− = ⇥ ⇥ ⇥ ⇥ /

≏ ~ - ⇥ ⇥ ≎ ~ ~ ⇥ ≗ @ = ≖ = @
∽ ~ ⇥ ⋍ ~ - ⇥ ∼ F6 ~ ≈ F6 ~ ~
≠ = / ∝ @ @ ⇥ ⇥ ≊ ~ ~ = ≜ @ = ⇥

Table 4.4. Equalities, similarities, and their negations (see also Insert „ Symbol „ Binary
relation).

< < ⩽ < = ≤ < = ⇥ ≦ < = ⇥ ⇥


> > ⩾ > = ≥ > = ⇥ ≧ > = ⇥ ⇥
≪ < < ≤≤ < < = ⋘ < < < ≤≤≤ < < < =
≫ > > ≥≥ > > = ⋙ > > > ≥≥≥ > > > =
≺ < ⇥ ⇥ ⇥ ≼ < ⇥ ⇥ ⇥ = ⪯ < ⇥ ⇥ ⇥ = ⇥ ≾ < ⇥ ⇥ ⇥ ~
≻ > ⇥ ⇥ ⇥ ≽ > ⇥ ⇥ ⇥ = ⪰ > ⇥ ⇥ ⇥ = ⇥ ≿ > ⇥ ⇥ ⇥ ~
≺≺ < < ⇥ ⪯⪯ < < ⇥ = ≺≺≺ < < < ⇥ ⪯⪯⪯ < < < ⇥ =
≻≻ > > ⇥ ⪰⪰ > > ⇥ = ≻≻≻ > > > ⇥ ⪰⪰⪰ > > > ⇥ =
⊂ < ⇥ ⇥ ⊆ < ⇥ ⇥ = ⊂ < ⇥ ⇥ = ⇥ ∈ < ⇥
=
⊃ > ⇥ ⇥ ⊇ > ⇥ ⇥ = ⊃ > ⇥ ⇥ = ⇥ ∋ > ⇥
=
⊏ < ⇥ ⇥ ⇥ ⇥ ⊑ < ⇥ ⇥ ⇥ ⇥ = ⋐ < < ⇥ ⇥ ⊂+ < ⇥ ⇥ +
⊐ > ⇥ ⇥ ⇥ ⇥ ⊒ > ⇥ ⇥ ⇥ ⇥ = ⋑ > > ⇥ ⇥ ⊃
+ > ⇥ ⇥ +
⊲ < | ⇥ { < | ⇥ = ⊴ < | ⇥ = ⇥ ƒ < | ⇥ ⇥
⊳ | ⇥ > | | ⇥ > = ⊵ | ⇥ > = ⇥ „ | ⇥ > ⇥
≲ < ~ ⪅ < ~ ~ ≾ < ⇥ ⇥ ⇥ ~ ≺ < ⇥ ⇥ ⇥ ~ ~

≳ > ⇥ ~ ⪆ > ⇥ ~ ~ ≳ > ⇥ ~ ⪆ > ⇥ ~ ~

Table 4.5. Comparison relations (see also Insert „ Symbol „ Binary relation).

∉ < ⇥ / ∌ > ⇥ /
≮ < / /
⩽ < = / ≰ < = ⇥ / ⪇ < = ⇥ / ⇥
≯ > / /
⩾ > = / ≱ > = ⇥ / ⪈ > = ⇥ / ⇥
≨ < = ⇥ ⇥ / ⇥ < < = ⇥ ⇥ / ⇥ ⇥ ⋦ < ~ / ⇥ ⪉ < ~ ~ / ⇥
=
− −

≩ > = ⇥ ⇥ / ⇥ > > = ⇥ ⇥ / ⇥ ⇥ ⋧ > ~ / ⇥ ⪊ > ~ ~ / ⇥


=
⊊ < ⇥ ⇥ = / ⇥ ⊂ < ⇥ ⇥ = ⇥ / ⇥ ⊆
/ < ⇥ ⇥ = / ⇥ ⇥ ⊂
/ < ⇥ ⇥ = ⇥ / ⇥ ⇥
=
/ =
⊋ > ⇥ ⇥ = / ⇥ ⊃ > ⇥ ⇥ = ⇥ / ⇥ ⊇
/ > ⇥ ⇥ = / ⇥ ⇥ ⊃
/ > ⇥ ⇥ = ⇥ / ⇥ ⇥
=
/ =
⊀ < ⇥ ⇥ ⇥ / ⋠ < ⇥ ⇥ ⇥ = / /
⪯ < ⇥ ⇥ ⇥ = ⇥ / ≺ < ⇥ ⇥ ⇥ = ⇥ ⇥ / ⇥
=
/
⊁ > ⇥ ⇥ ⇥ / ⋡ > ⇥ ⇥ ⇥ = / /
⪰ > ⇥ ⇥ ⇥ = ⇥ / ≻ > ⇥ ⇥ ⇥ = ⇥ ⇥ / ⇥
=
/
⋨ < ⇥ ⇥ ⇥ ~ / ⇥ ≺ < ⇥ ⇥ ⇥ ~ ~ / ⇥ ⊏
/ < ⇥ ⇥ ⇥ ⇥ / ⋢ < ⇥ ⇥ ⇥ ⇥ = /
/

⋩ > ⇥ ⇥ ⇥ ~ / ⇥ ≻ > ⇥ ⇥ ⇥ ~ ~ / ⇥ ⊐
/ > ⇥ ⇥ ⇥ ⇥ / ⋣ > ⇥ ⇥ ⇥ ⇥ = /
/

Table 4.6. Negations of comparison relations (see also Insert „ Symbol „ Negation).
4.2 MATHEMATICAL SYMBOLS 73

← < - ⇐ < = ⇥ ⇥ ⇥ ↼ / - ⇥ ↽ / - ⇥ ⇥
→ - > ⇒ = > ⇁ - / ⇥ ⇀ - / ⇥ ⇥
↔ < - > ⇔ < = > ⇋ < - - > ⇥ ⇥ ⇥ ⇌ - > < - ⇥
⇇ < - < - ↢ < - < ↩ < - | ⇥ ↞ < < -
⇉ - > - > ↣ > - > ↪ | - > ⇥ ↠ - > >
⇆ < - - > ⇥ ⇥ ⇄ - > < - ↦ | - >
↫ < - @ ↬ @ - > ↝ ~ > ↭ < ~ >
↑ < - ⇥ ↕ < - > ⇥ ⇑ = > ⇥ ⇥ ⇈ < - < - ⇥
↓ < - ⇥ ⇥ ⇕ < = > ⇥ ⇓ = > ⇥ ⇊ < - < - ⇥ ⇥
↿ / - ⇥ ⇥ ⇥ ⇥ ↾ / - ⇥ ⇥ ⇥ ↖ < - ⇥ ⇥ ⇥ ↗ - > ⇥ ⇥ ⇥ ⇥
⇃ / - ⇥ ⇥ ⇥ ⇥ ⇥ ⇂ / - ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ↙ < - ⇥ ⇥ ⇥ ⇥ ↘ - > ⇥ ⇥ ⇥

Table 4.7. Arrows (see also Insert „ Symbol „ Arrow).

⟵ < - - ⟸ < = = ⟻ < - - | ←→


↩ < - - | ⇥
⟶ - - > ⟹ = = > ⟼ | - - > ←→
↪ | - - > ⇥
⟷ < - - > ⟺ < = = > ←→
→← - - ⇐⇒
⇒⇐ = =


⟼⟶
⟶⟼

< - - ⇥ < - - ⇥ ⇥ < = = ⇥ < = = ⇥ ⇥


←→

←→

< - - | ⇥ ⇥ < - - | ⇥ ⇥ ⇥ ⇥ < - - | ⇥ ⇥ ⇥ < - - | ⇥ ⇥ ⇥ ⇥ ⇥


Table 4.8. Long arrows (see also Insert „ Symbol „ Arrow).

¬ ! ⇥ ∅ @ / / @ ⇥ ⇥ ⇥ ⇥ 2 @ ⇥ ⇥ ⇥ ⇥ ⇥
∘ @ □ @ ⇥ • @ ⇥ ⇥ ■ @ ⇥ ⇥ ⇥
⊤ T ⇥ ⇥ ⊥ T ⇥ ⇥ ⇥ ⊢ | ⇥ - ⊣ - | ⇥
⊩ | | ⇥ - ⊪ | | | ⇥ - ⊨ | ⇥ =
♭ b ⇥ ⇥ ♯ # ⇥ ♮ # ⇥ ⇥
♦ < > ⇥ ♥ < > ⇥ ⇥ ♠ < > ⇥ ⇥ ⇥ ♣ < > ⇥ ⇥ ⇥ ⇥
... . . ⋅⋅⋅ . . ⇥ ... . . ⇥ ⇥
⋅⋅⋅ . . ⇥ ⇥ ⇥ ⋅⋅
⋅ . . ⇥ ⇥ ⇥ ⇥ ⋅⋅
⋅ . . ⇥ ⇥ ⇥ ⇥ ⇥

Table 4.9. Miscellaneous symbols (see also Insert „ Symbol „ Miscellaneous).

4.2.4 When a symbol is hard to find

For certain symbols like ✠, it may not be clear how to obtain it using the system-
atic mechanisms described in this section. Since the symbol vaguely reminds
one of addition, you may take your chances and try all variants of +. If you
are unlucky, or if the symbol is so exotic (e.g. ♫) that it reminds you of nothing
at all, then you have several fall-back options:

TEXMACS menus. You may try to look it up in the submenus of Insert „


Symbol and especially in Insert „ Symbol „ Miscellaneous.
74 MATHEMATICS

System tools. Most operating systems integrate tools for visualizing UNI-
CODE characters and copy and paste them to other applications. For
example, MACOS integrates “Character Viewer” for this purpose.
LATEX names. If you know the LATEX name of the symbol, then you may
enter it using that name. For example, ♫ corresponds to the LATEX com-
mand \twonotes, so you may obtain this symbol via \ t w o n o t e s ↩ .
Internal TEXMACS names. Most mathematical symbols are internally
known under the same name as under LATEX. Symbols can directly be
entered using their TEXMACS name via the keyboard shortcut ⌃q . Hence
⌃q t w o n o t e s ↩ also produces ♫.

UNICODE numbers. You may also look up the UNICODE number of your
symbol inside UNICODE tables that you can find on the web. The
hexadecimal UNICODE number prefixed by # can also be used as an
internal TEXMACS name for the symbol. For example, the symbol ♫ cor-
responds to the UNICODE character 266B, so you may enter it by typing
⌃q # 2 6 6 B ↩ .

4.3 Two-dimensional mathematical markup


Subscripts and superscripts. Subscripts and superscripts are created using
the special keys _ and ^ . For example, you can produce an by typing a _ n
x
and a a via a ^ a ^ x . Notice that you have to explicitly move the cursor out of
the script whenever needed, usually by pushing → once. In other words, an +b n
is obtained through a _ n → + b _ n , whereas a _ n + p yields an+p.
Subformulas may simultaneously carry a subscript and a superscript. For
instance, an2 is obtained using a _ n → ^ 2 . The order in which a subscript and
a superscript are entered does not affect the rendering, but is important for
the semantics: if we entered the above formula an2 using a ^ 2 → _ n , then it
would mean (a 2)n instead of (an)2.
TEXMACS also allows you to put subscripts and superscripts at the left-hand side
of an expression, using the shortcuts ⌥l _ and ⌥l ^ . For example, you may
enter the formula 𝜋x by typing ⌥l ^ p ⇥ → x . A formula may be surrounded
by as many as four subscripts and superscripts, as in ∗∗He ∗∗.
In some cases, subscripts and superscripts are put below or above a given
expression, rather than to its right. This is typically so for big and limit-like
operators in displayed equations:
n
1 π2
lim = .
n→∞
k=0
k 2 6

It is also possible to explicitly typeset a script above or below another expres-


sion using the shortcuts ⌥a and ⌥b :

f ∘n = f ∘ .n×
..∘ f x = statlim x n.
n→∞
4.3 TWO-DIMENSIONAL MATHEMATICAL MARKUP 75

Shortcut Purpose Inline Displayed


a a
⌥f Ordinary fractions b+c b+c
a a
⌥f ⇥ Inline fractions b+c b+c
a a
⌥f ⇥ ⇥ Displayed fractions
b+c b+c
⌥f ⇥ ⇥ ⇥ Slashed fractions 1/
2
1/
2
1 1
⌥f ⇥ ⇥ ⇥ ⇥ Continued fractions
1 1
1+ 1+
1 1
1+ 1+
1+ ⋅⋅⋅ 1+ ⋅⋅⋅
Table 4.10. Various blends of fractions.

Primes. Single and double primes can be entered using the keys ' and " .
Primes behave much in the same way as superscripts, but it is slightly more
efficient to insert or remove them (compare entering a′ + b and a 2 + b using
a ' + b versus a ^ 2 → + b ). Using ` , you may also insert a “left backprime”,
as in ‵a.
There are various alternative types of primes, which can be obtained as vari-
ants: the primes in a‵, a ∗, a†, a ‡, and a 6 are entered using the shortcuts ' ⇥ ,
' ⇥ ⇥ , etc. You may for example write V ∗ for the dual of V and f † for the log-
arithmic derivative f ′/ f of a function f . Backprimes and double primes also
have several variants. For instance, you may enter V ∗∗ and 6a using V " ⇥ ⇥
and ` ⇧⇥ a .

Fractions. TEXMACS uses ⌥ as the principal modifier key for the insertion
of mathematical markup. You may for example insert a fraction using ⌥f
(or Insert „ Fraction). There are several kinds of fractions, which are listed in
Table 4.10. Alternatively, fractions may use a one-dimensional layout as in
a/b, 15 : 5, and 15 ÷ 3. The symbols /, :, and ÷ are obtained through / , / ⇥ ,
and / ⇥ ⇥ .

Square roots and n-th roots. You may enter a square root using ⌥s (or Insert
square root) and an n-th root using ⌥s ⇥ (or Insert „ N-th root). Hence, ⌥s x
yields √x and ⌥s ⇥ ← ← 3 yields 3√x .
The degree n of an n-th root can also be added a posteriori using ⌥→ . For example,
assume that your cursor is at the indicated position in x|. Then typing ⌥→
leads you to the state |√x . Conversely, pressing ⌫ in the latter situation will
remove the degree and bring you back to the original state.
Notice that the sqrt tag for square roots and n-th roots is an example of a tag
with a variable number of arguments (either one or two in this case). The
above keyboard shortcuts ⌥→ and ⌫ can be used more generally in such sit-
uations for the insertion and removal of arguments: see section 10.5.
76 MATHEMATICS

Ordinary text. Ordinary text can be inserted into a formula using ⌥$ or Insert „
Text. This is what we did for the text “ is sufficiently large” below:

L = {x | x is sufficiently large}.

Negations. Some of the TEXMACS relation symbols do not admit any negated
versions. You may manually negate a symbol or a formula using ⌥n or Insert „
Negation:

a ℛ b ⟺ ¬(a ℛ b).

4.4 Big operators


Big operators—such as integration ∫ and n-ary summation ∑—are entered
using the keyboard prefix ⇧F5 or from the Insert „ Symbol „ Big operator menu.
Table 4.11 lists the available big operators together with the corresponding
keyboard shortcuts. The rendering of big operators is quite different for inline
and displayed formulas: compare ∑ ∞ k=1 1/k and ∫0 f (x) dx with
2 1


1 1
f (x) dx.
k=1
k2 0

The big integral signs has two variants, depending on where you want to place
subscripts and superscripts in display mode. By default, the scripts are placed
to the right:
∞ dx
.
0 1 + x2

The alternative rendering “with limits”



dx
.
1 + x2
0

can be obtained using the ! postfix, by typing ⇧F5 I ! . Some people also prefer
integrals to be rendered using an upright font. This gives rise to two further
variants. For instance, you may obtain the triple integral in

f (x, y, z) dx ∧ dy ∧ dz
V

using the shortcut ⇧F5 I I I ⇥ ⇥ ⇥ . We recall that it is good practice to enter the
d's of the differentials using d ⇥ ⇥ , so as to distinguish them from the letter d
in a + b + c + d. Similarly, the exterior product was entered using * & .
4.5 LARGE DELIMITERS 77

Shortcut Result Shortcut Result Shortcut Result


⇧F5 I ⇧F5 I I ⇧F5 I I I

⇧F5 O ⇧F5 O O

⇧F5 A ⇧F5 P ⇧F5 S

⇧F5 @ + ⇧F5 @ * ⇧F5 @ .

⇧F5 U ⇧F5 N ⇧F5 U +

⇧F5 U ⇥ ⇧F5 N ⇥ ⇧F5 U ⇥ ⇥


j h

h
⇧F5 V ⇧F5 V ⇥ ⇧F5 V ⇥ ⇥
k
⇧F5 W ⇧F5 W ⇥ ⇧F5 W ⇥ ⇥

⇧F5 B ⇧F5 B ⇥ "


Table 4.11. Big mathematical operators.

4.5 Large delimiters

Brackets inside mathematical formulas should always match. As soon as you


open a bracket “(”, TEXMACS therefore automatically inserts the corresponding
closing bracket “)”. Occasionally, it may occur that you do not want the closing
bracket, or that you want to replace it by another kind of bracket. This can be
done as follows:
• If your cursor is just before the closing bracket inside (a, b|), then
pressing ] will turn the expression into (a,b]|. More generally, this mech-
anism can be used to turn any closing bracket into one of any other
form.
• If your cursor is just behind the closing bracket inside ba |, then pressing ⌫
will remove the closing bracket, yielding ba|. Similarly, in order to remove
an opening bracket, put the cursor just in front of it and press ⌦ . Notice
that pressing ⌫ or ⌦ in the example f (|) will remove both brackets.
Notice that the automatic insertion of matching closing brackets can be dis-
abled using Edit „ Preferences „ Keyboard „ Automatic brackets „ Disabled. It
should also be noticed that the closing curly bracket was not really removed
in the above formula ba|: TEXMACS rather replaced it with an “invisible” closing
bracket (see section 4.11), thereby ensuring that all brackets remain matching.
Selection of the preference Automatic brackets „ Disabled has a similar effect
of replacing visible closing brackets by invisible ones.
For some delimiters, such as |, the opening and closing versions coincide. For
instance, entering a vertical bar | will produce an absolute value. The vertical
bar is often used as a separator as well. You may insert a small bar-separator |
78 MATHEMATICS

using | ⇥ or F5 | . Large bar-separators are entered using ⌥m | or | ⇥ ⇥; they


are used for producing the vertical bars in formulas like
a p a
.
b+c q+r b+c

We notice that such large separators do not exist in (LA)TEX. There may be
as many middle delimiters between a left and a right delimiter as needed
and they are all scaled to the same appropriate size. Notice that not all ver-
tical bars are delimiters. For example, the binary relation “divides” is entered
using | ⇥ ⇥ ⇥ ⇥ or F5 | ⇥ ⇥ ; we will see more examples in section 4.11.
In TEXMACS, large delimiters may either be “left delimiters”, “right delimiters”
or “middle delimiters”. By default, (, [, {, and ⟨ are left delimiters, whereas ), ],
}, and ⟩ are right delimiters. But their status can be changed using the ⌥l ,
⌥r , and ⌥m prefixes. For example, ⌥l ) produces ), considered as a large left
delimiter, together with the corresponding “closing bracket” (. Open French-
style intervals ]a, b[ can therefore be entered using ⌥l ] .
By default, the sizes of the brackets are adjusted to the expression between the
brackets. Small delimiters, created using the ⌥ -prefix, keep their sizes inde-
pendently of the enclosed expression. Thus, the brackets in the left-hand and
right-hand expressions below were entered respectively using ( and ⌥( :

ex ex
f ee + 1 f ( e e + 1 ).

You may also use ⌃* in order to toggle between large and small delimiters.
Sometimes you may want large delimiters of a particular size, instead of the
self-adjusting ones. This can be achieved in two main ways. The best strategy
is usually to tweak the size of the expression between the brackets using
the Format „ Adjust menu. For example, if you think that the brackets in the
formula
x
f
y
(( ))
are slightly too large, then you may reduce the size of the fraction using Format „
Adjust „ Reduce, which yields
x
f .
y
TEXMACS also allows you to directly increase or decrease the size of the brackets
themselves using the keyboard shortcuts ⌘↑ and ⌘↓ . In order to reset to the
initial size, you may use ⌘⌫ .
We finally notice that it is possible to insert a pair of invisible brackets
using ⌥l . . This is for instance useful in computational contexts, when for-
mulas should have a precise, not merely visual semantics. Alternatively, you
may use ⌘= to confine a selected formula inside a “horizontal group”. This
additionally prevents the formula from being hyphenated.
4.6 WIDE ACCENTS AND EXTENSIBLE ARROWS 79

Shortcut Example Wide example Shortcut Example Wide example


⌥~ x̃ x+y ⌥B x̄ x+y
⌥^ x̂˘ x+y ⌥C x̌ x+y
⌥A x x+y ⌥U x̆ x+y
⌥V ~x AB ⌥o < >

⌥o < ⌥o >

Table 4.12. Keyboard shortcuts for wide mathematical accents.

4.6 Wide accents and extensible arrows


Mathematical accents are created using the modifier key ⌥ or the prefix ⌥o
(as in Over). For example, 𝜑ˆ is entered by typing ⌥^ f ⇥ , and using
⌥o > A B C D . Many of these accents stretch with the formulas below them, as
in 𝜑 + 𝜓. The list of all such wide accents is given in Table 4.12. Other accents
never stretch with the formulas below them: see Table 4.13.
The same accents may be inserted below the expressions using the ⌥u prefix
(Under). Hence x + y is entered using ⌥u B x + y and is obtained by
typing ⌥u < > A B C D .

Shortcut Example Shortcut Result


⌥. ẋ ⌥' x́
⌥" ẍ ⌥` x̀
⌥" ⇥ ẋ˙˙ ⌥@ x̊
⌥" ⇥ ⇥ x
˙˙˙˙

Table 4.13. Keyboard shortcuts for non-stretchable accents.

So-called overbraces and underbraces are entered in a similar way as wide


accents. They have the additional property that superscripts and sub-
scripts are placed above and below them. In Table 4.14, we have listed the
available overbraces. The expression below can therefore be obtained by
typing ⌥o { a + b + c → ^ S ⇥ :
Σ

a + b + c.

Shortcut Example Shortcut Example


⌥o { x+y+z ⌥o } x+y+z
⌥o ( x+y+z ⌥o ) x+y+z
⌥o [ x+y+z ⌥o ] x+y+z

Table 4.14. Wide overbraces.


80 MATHEMATICS

a+b+c a+b+c a+b+c a+b+c a+b+c









→←




→←






→←




→←

← →
→ →

→→

→→


→→

→→
→ ←


←←

←←


←←

←←
← ↔


↔↔


↔↔



↔↔

↔ ↦


↦↦

↦↦


↦↦

↦↦

a+b+c a+b+c a+b+c a+b+c







⇒⇐




⇒⇐






⇒⇐




⇒⇐

⇐ ⇒
⇒ ⇒

⇒⇒

⇒⇒


⇒⇒

⇒⇒
⇒ ⇐


⇐⇐

⇐⇐


⇐⇐

⇐⇐
⇐ ⇔


⇔⇔


⇔⇔



⇔⇔


Table 4.15. Available extensible arrows.

Besides delimiters and accents, some of the arrows are also extensible in
TEXMACS. This is typically needed whenever they come with a superscript
above them (or a subscript below them). For instance, the following formula
was entered by typing E - > ^ f @ * g → F :
f ⊗g
E→


→→


→→ F.


Here - > ^ was used as a keyboard shortcut for creating an extensible arrow
with a superscript above it. Whenever you need a non-extensible arrow with
an ordinary superscript (in the upper-right corner), the trick is to “break” the
keyboard shortcut; e.g. E - > ← → ^ + → F yields

E →+ F.
Table 4.15 lists the available extensible arrows in TEXMACS.

4.7 Matrices and mathematical tables


New 1 × 1 matrices can be entered using Insert „ Table „ Matrix, ⌘t N m (Table
New Matrix), ( ⌘t N T (Table New Table), or \ m a t r i x ↩ . Matrices are
special kinds of tables, which means that the full range of table editing facil-
ities is available (see chapter 5). For now, it suffices to know that new rows
and columns can be inserted using the shortcuts ↩ , ⌥→ , ⌥← , ⌥↑ , and ⌥↓ . For
instance, the matrix
a b (( ))
c d

can be entered using ⌘t N m a ⌥→ b ↩ c → d. Empty rows and columns can be


removed simply by pressing ⌫ .
There are a few other kinds of table-like structures that are useful in mathe-
matics, starting with the following variants of matrices: determinants ( ⌘t N d
or | ⌘t N T ), matrices with angular brackets ( ⌘t N M or [ ⌘t N T ), and ordinary
centered tables ( ⌘t N T ), which correspond to matrices with no brackets at all:

(( ac db )) a b
c d
[[ ac db ]] a b
c d
.

Note that you may cycle among the first three variants using ⌃⇥ . Secondly,
you may create so-called “choice lists” using ⌘t N c or { ⌘t N T , as in

if x ⩽ 0
f (x) =
{{ 0
{{ e 1
− 2
x otherwise.
4.8 COMMUTATIVE DIAGRAMS 81

Finally, TEXMACS provides the stack tag for tables in which the spacing is
reduced to the strict minimum ( ⌘t N s ). This is useful when tables are used
in subscripts or superscripts:
S= 𝜑(x i, y j).
1⩽i⩽n
1⩽ j⩽m

4.8 Commutative diagrams


The most appropriate way to create commutative diagrams depends on the
required level of complexity. The simplest kind of diagrams can be constructed
as centered tables:
𝜄A
A⨿B ←


←← A
(4.1)

𝜄B ↘ 𝛼.
B ⟶ X
𝛽

Here we recommend the use of long horizontal and vertical arrows. The small
scripts 𝜄B and 𝛼 beside the long vertical arrows were created using the markup
elements left-script and right-script.
Centered tables may quickly become problematic when you need diagonal or
curved arrows. The most general approach to commutative diagrams is to con-
sider them as pictures. For general information about how to draw technical
pictures, we refer to chapter 8. In this section, we will describe those features
that are useful for creating the same commutative diagram (4.1) as above.
Inside a mathematical formula, we start with the creation of an empty commu-
tative diagram using Insert „ Image „ Commutative diagram. This inserts a small
grid of the following type:

In order to ensure a uniform design, the main nodes A ⨿ B, A, B, and X should


be placed at points on the grid, using the default alignment (namely: horizon-
tally centered and vertically aligned at the baseline):

A⨿B A

B X
82 MATHEMATICS

At the next stage, we want to add the arrows. TEXMACS provides a special
mode for adding arrows surrounded by text: Insert „ Arrow with text. Further-
more, when moving the mouse around the four formulas, you will observe
that there are eight special positions around each formula that “attract” the
pointer. These special points should be used as the starting and end points
of your arrows:

A⨿B x A
x
x x

x
B X

For the diagonal arrow, a dashed line style would actually have been more
appropriate. Such alternative line styles can be selected using Focus „ Line
dashes. At the next stage, you should select Insert „ Mathematics and edit the
formulas next to the arrows. You may use ⌃⇥ to put the text at the other side
of an arrow.

𝜄A
A⨿B A
𝜄B 𝛼

B X
𝛽

In order to finalize the commutative diagram, it now suffices to remove the


grid and “crop” the diagram using Insert „ Grid „ Default and Insert „ Geometry „
Crop „ Crop:
𝜄A
A⨿B A
𝜄B 𝛼
. (4.2)

B X
𝛽

If the diagram needs further editing, then you may restore the grid using Insert „
Grid „ Notebook.

A few further remarks are in order. First of all, TEXMACS does not automatically
adjust the endpoints of the arrows if you edit one of the formulas A, B, X, or A⨿
B. On the other hand, the position of the formula next to the arrow is auto-
matically updated when modifying the endpoints. In documents with several
commutative diagrams, we also recommend to consistently opt for either one
of the two styles exemplified in (4.1) and (4.2).
4.9 SEMANTICS OF MATHEMATICAL FORMULAS 83

4.9 Semantics of mathematical formulas


Recent versions of TEXMACS can help you to write documents in which all for-
mulas are at least correct from a syntactical point of view. For example, in the
formula a + b, the computer will understand that + is an operator that applies
to the arguments a and b. It will also flag a + as being incorrect. In fact, the
“semantics” that we aim at does not go any further: TEXMACS is unaware of the
mathematical nature of addition.
Semantic editing does require additional efforts from the user, or at least a
little adaptation. For instance, it is the user's job to enter multiplications using
the shortcut * and function applications using ␣ . These operations cannot be
distinguished from their appearance, since they are both printed as invisible
whitespace. However, the semantics of these operations is clearly very dif-
ferent.
Although semantically correct documents are usually not very different from
informal presentation-oriented documents as far as typesetting is concerned,
the additional user effort may pay off for several reasons:
• Adequate semantics is a prerequisite when using formulas as input for
a computer algebra system.
• Syntactically correct documents are less likely to contain “typos” or
more intricate mathematical errors.
• For certain editing operations, such as cut and paste, one may directly
select subformulas that are meaningful from the syntactical point of
view.
• It reduces the risk of using non-standard notations that will be difficult
to understand for potential readers of your work.
Furthermore, other semantic facilities might be integrated in the feature, such
as semantic search and replace, or semantic search on the web.
In order to activate the semantic editing facilities, you must toggle Edit „ Pref-
erences „ Mathematics „ Semantic editing. In the semantic editing mode, several
of the structured editing features of TEXMACS apply to the syntactic structure of
the formula, rather than the visual structure of the document. For instance, the
semantic focus is usually a subformula of the current focus. Similarly, only syn-
tactically meaningful subformulas can be selected when making a selection.
The semantic focus is useful for several reasons. First of all, it is displayed in
green if the formula is syntactically correct and in red if you made an error.
This allows to quickly notice any typos while entering a formula. Secondly, if
you have any doubt on the precedence of a mathematical operator or relation,
then the semantic focus tells you the default interpretation: by putting your
cursor right next to your operator, the subexpression to which the operator
applies will be highlighted. In the case of an addition, or a more general asso-
ciative operator, all summands are highlighted.
84 MATHEMATICS

4.10 Common errors and syntax corrections


By default, the semantic editing mode “understands” most classical mathe-
matical notations. This is achieved through the use of a carefully designed
grammar for mainstream mathematics. Obviously, the use of a fixed grammar
may cause the following problems:

• Mathematical formulas frequently contain ad hoc notations. For instance,


the formulas might contain some text or meaningful whitespace.
Another example of an ad hoc notation is the sign sequence ++−+−+.
In such cases, the user should explicitly annotate the appropriate parts
of the formula in order to make them semantically meaningful; see sec-
tion 4.12.

• The TEXMACS grammar used for the interpretation of mathematical for-


mulas may be incomplete or inadequate for certain situations. It is pos-
sible to customize or extend the grammar using the standard TEXMACS
macro mechanism (see section 4.12). Notations for specific areas may
be grouped together in dedicated style packages.

Besides these intrinsically hard-to-avoid problems, the following common mis-


takes are a further source of trouble for associating semantics to mathematical
formulas:

• Since TEXMACS is a wysiwyg editor, some of the structure of the doc-


ument is invisible to the user. For example, the presence of a mathemat-
ical formula x + y is indicated through the use of an italic slant and
special spacing. However, in the formula f (x) it is easy to type the
closing bracket outside the formula, with no visual difference.

• Various mathematical notations are visually ambiguous. For example,


a (b + c) would usually be understood as a ⋅ (b + c), whereas f (x + y)
typically corresponds to a function application. In the semantic editing
mode, the user is expected to resolve this ambiguity by hand by entering
multiplications using * and spaces using ␣ . The multiply/apply ambi-
guity is one of the main sources of syntax errors, since many users do
not pay attention to invisible differences. Similarly, the ∧ glyph could
be the “logical and” or the “wedge product”. This “homoglyph” issue
will be addressed in more detail in section 4.11 below.

• It could be that a text was originally written in LATEX or an old version


of TEXMACS. In that case, the document contains no special indication
on matching brackets or the scopes of big operators. For example, in
the formula [x, y[, should we interpret the second bracket as a closing
bracket? This is indeed the standard French notation for an interval
with an open right end. More generally, all problems that we have men-
tioned so far tend to be present simultaneously when trying to associate
semantics to existing documents.
4.10 COMMON ERRORS AND SYNTAX CORRECTIONS 85

After activation of the semantic editing mode, you may check whether a for-
mula is correct by positioning your cursor inside it and looking at the color of
the bounding box of the semantic focus: a green color corresponds to a cor-
rect formula and a red color indicates an error in the formula. Alternatively,
assuming that the focus is on a mathematical formula, you may select Focus „
Preferences „ Highlight incorrect formulas, in which all incorrect formulas are
highlighted inside red boxes.

For the second kind of common errors, TEXMACS includes an automatic syntax
corrector. Assuming that your cursor is inside a formula, you may use Edit „
Correct „ Correct all for the correction of all formulas in your document, or
the correction of the current selection. If the versioning tool is activated (see
section 10.9), then you may use Edit „ Correct „ Correct manually to show the
differences between the original and the corrected versions. You may then use
the versioning tool to go through these differences and select the preferred
versions.

The precise algorithms that are used for the correction may be enabled or dis-
abled from Edit „ Preferences „ Mathematics „ Manual correction:

Remove superfluous invisible operators. This algorithm is used in order


to remove any superfluous function applications or multiplications. For
instance, users who are accustomed to editing ASCII files often type
spaces around binary infixes such as addition. Such “function applica-
tions” will be removed by this algorithm.

Insert missing invisible operators. In LATEX, multiplications and function


applications are never entered explicitly. When importing a LATEX doc-
ument, it is therefore important to detect and insert missing multiplica-
tions and function applications.

Homoglyph substitutions. This algorithm may perform some other useful


substitutions of symbols by visually similar, but semantically distinct
symbols. For instance, whenever appropriate, the backslash symbol \ is
replaced by the binary “set difference” infix (as in X ∖ Y).

From the Edit „ Preferences „ Mathematics „ Automatic correction, you may also
select the correction algorithms that should be applied automatically when-
ever you open a file. These corrections are always carried out when importing
a LATEX file.

After syntax correction, the remaining errors indicate genuine typos at worst,
or non-standard or unsupported notations at best. We also note that “correct”
formulas do not necessarily have the intended meaning. In order to check
whether the operators indeed apply to the intended arguments, you should
keep an eye on the current focus while typing your formulas.
86 MATHEMATICS

4.11 Semantics of mathematical symbols


The mathematical symbols in TEXMACS all come with a certain number of prop-
erties that correspond to their intended meaning. For example, TEXMACS is
aware that “+” is an infix operator, whereas “!” is rather a postfix, and “,”
a separator.
TEXMACS has special symbols e = 2.71828⋅ ⋅ ⋅, π = 3.14159⋅ ⋅ ⋅, and i = −1 for
important mathematical constants. These constants are displayed “upright”
and they can be entered using the shortcuts e ⇥ ⇥ , p ⇥ ⇥ , and i ⇥ ⇥ . Note that
ordinary variables using the same letters are rendered in italics, as e, 𝜋, and i.
However, semantically distinct symbols may display in a similar way. For
instance, the comma separator, as in f (x, y), is different from the decimal
comma, as in 3,14159⋅ ⋅ ⋅. Notice that the two symbols admit different spacing
rules. Semantically distinct symbols that are rendered using the same glyph are
called homoglyphs. Notice that our semantics is purely syntactic: for instance,
the + infix is commonly used for addition, but sometimes also for the concate-
nation of strings. Nevertheless, these two uses do not differ from a syntactical
point of view, since the + symbol remains a binary infix operator with the
same precedence with respect to other operators.
The most confusing homoglyphs are the various invisible symbols supported
by TEXMACS:

• The multiplication, entered by *. Example: a b.

• Function application, entered by ␣. Example: sin x.

• An invisible separator, entered by , ⇥ ⇥. Example: A = (aij).

• An invisible addition, entered by + ⇥ ⇥ ⇥ ⇥. Example: 17 3/8.

• An invisible symbol, entered by . ⇥ ⇥ ⇥ . Examples: the increment oper-


ator + 1, the zeros in a diagonal matrix

(( 𝜆 1
⋅⋅ )),
(( ⋅
𝜆n
))

or the omitted exponent one in x 13 − x 12 + x 1 − 1 (using an invisible expo-


nent for the degree one term allowed us to vertically align all subscripts).

• An invisible bracket (mainly for internal use). A matching pair of invis-


ible brackets is entered using ( ⇥ .

We recommend in particular that you make it a habit to systematically dis-


tinguishing between multiplication and function application: we already men-
tioned the ambiguity a(b + c) versus f (x + y)), which cannot be resolved auto-
matically.
4.12 CUSTOMIZING THE SEMANTICS 87

Shortcut Glyph Example Semantics


* ab Multiplication
␣ sin x Function application
, ⇥ ⇥ aij = aji Invisible separator
+ ⇥ ⇥ ⇥ ⇥ 17 3/8 Invisible addition
. ⇥ ⇥ ⇥ + 1: x ↦ x + 1 Invisible symbol
( ⇥ Φ ≡ ∀x, P(x) Invisible bracket(s)
| | |−x| = |x| Absolute value
| ⇥ | ⟨a|b|c|d⟩ Separating bar
𝒗 + 𝒘 𝒖 − 𝒖¯
| ⇥ ⇥ | 2 2
Extensible middle bar
| ⇥ ⇥ ⇥ ⇥ | {x ∈ ℝ | x > 0} Such that bar
| ⇥ ⇥ ⇥ ⇥ ⇥ | 11 | 1001 Divides relation
, , f (x, y) Comma separator
, ⇥ , 123,456 Decimal comma
. . 123.456 Decimal point
. ⇥ . λx. x 2 Dot connector
* ⇥ ⇥ ⇥ ⋅ 𝒗⋅𝒘 Dot multiplication
. ⇥ ⇥ ⋅ ⋅+1 Dummy wildcard
: : a: b: c Separator
: ⇥ : x : Int Type satisfaction
/ ⇥ : 121 : 11 = 11 Division
: ⇥ ⇥ ⇥ : {x ∈ E : P(x)} Such that colon
\ ⇥ \ \x Backslash
\ ⇥ ⇥ \ ℕ> = ℕ ∖ {0} Set minus
& ∧ 1 = 1 ∧ 2 = 2 Logical and
* & ∧ dx ∧ dy Wedge product
Table 4.16. Homoglyphs supported by TEXMACS.

TEXMACS mainly relies on the standard variant system for entering homoglyphs.
See Table 4.16 for the complete list of supported homoglyphs.

4.12 Customizing the semantics


We have done our best to support most of the traditional mathematical nota-
tions in TEXMACS. Nevertheless, you may sometimes need notations with a
non-standard semantics. Certain areas may also require special notations that
are not supported by default.
TEXMACS provides a very simple syntax primitive that allows you to manu-
ally override the default syntactical semantics of a formula. Assuming that
semantic editing was activated, you may insert a syntax tag using ⌥x x or
Insert „ Semantics „ Other. The first argument contains the formula as it should
be displayed, whereas the second argument contains the formula as it should
be interpreted.
88 MATHEMATICS

For example, if we enter ℛ as the first argument and < as the second one, then
the ℛ will be interpreted as a binary relation, exactly in the same way as <.
Moreover, the spacing around ℛ will be adapted, so as to mimic the spacing
around <. In this particular example, we might have obtained the same result
by using the math-relation tag, which is essentially a syntax tag < as second
argument. Most standard operator types are available from the Insert „ Seman-
tics menu or using the keyboard prefix ⌥x . In particular, you may use ⌥x ␣ to
simply ignore a formula and ⌥x o in order to make the formula behave as an
ordinary symbol (such as the letter “x”).
The syntax primitive is particularly powerful in combination with the TEXMACS
macro language. For instance, consider the formula C = 1/2 π i ∮ f (z) dz. It is
likely that the intended interpretation of 1/2 π i is 1/(2 π i) and not (1/2) π i.
Therefore, if we often use the constant 2 π i, then it is convenient to define a
macro twopii by

hassignjtwopiijhmacrojhsyntaxj2 𝜋 ij(2 𝜋 i)iii

You may group such macros together into style package with your favorite
notations. Future versions of TEXMACS might also provide style packages with
notations dedicated to specific areas.
Let us finally note that there are usually several ways for redefining the seman-
tics of a formula. For example, an alternative way to define the macro twopii is
using

hassignjtwopiijhmacroj2 π iii

where we inserted a pair of invisible brackets around 2 π i. Similarly, in the


formula
loglog x + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ +logloglog x
log x +e +loglog x
e √x +e +logx
,

we may select the whole formula and give it the semantics of an ordinary
symbol, by pressing ⌥x o . However, a nicer solution is to only select the sub-
formula ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ , and give it the semantics of an ordinary symbol. Yet another
example is the sign sequence ++−+−+ mentioned earlier. This sequence can
be interpreted correctly by inserting invisible separators between the different
signs using the , ␣ ␣ shortcut.
Chapter 5
Tables

Tables form one of the most versatile layout primitives of TEXMACS. You can
create ordinary textual tables and specify the properties of individual cells in
a very precise way. More generally, matrices, aligned lists of equations, and
various other kinds of markup are also formatted as tables.

5.1 Different flavors of tables


The main kinds of tables are listed in the Insert „ Table menu and also available
through the keyboard prefix ⌘t N . Here is an example of a “wide block” that
was created using Insert „ Table „ Wide block or ⌘t N W :
Isaac Newton 1642–1726 English physicist and mathematician. With
his book Philosophiæ Naturalis Principia Mathe-
matica (“Mathematical Principles of Natural Phi-
losophy”), he is considered to be the father of
classical mechanics. Newton is also one of the
founders of modern calculus.
Leonhard Euler 1707–1783 Prolific Swiss mathematician and physicist,
who made major discoveries in many branches
of mathematics and physics, such as infinites-
imal calculus, number theory, graph theory,
partial differential equations, fluid mechanics,
astronomy, etc.

The distinctive feature of a “block” is that the borders of cells are visible as
lines. Furthermore, a “wide” table extends over the entire width of a para-
graph and long lines inside individual cells are wrapped when necessary.

Remark 5.1. In other word processors, “wide tables” are usually the default.
TEXMACS provides many kinds of tables that are not wide, in which case text
inside cells is usually not line-wrapped. This is indeed most natural for small
inline tables like matrices inside a formula. However, it is the responsibility of
the user to prevent such tables from getting too large and not fitting on a single
line. Line wrapping can be enabled via Focus „ Cell „ Line wrapping „ Top or by
toggling the icon on the focus bar. In that case, you should also indicate the
desired width of the cell (see section 5.3.2).

89
90 TABLES

Insert „ Table „ Big table creates a “big” paragraph-wide table with a number
and a legend. If you rather wish to fit several numbered tables with accom-
panying legends on a single line, then you may use Insert „ Table „ Small table.
Tables 5.1 and 5.2 show an example of two small juxtaposed tables.

boom tree boom tree


hallo hello hallo hello
wiskunde mathematics wiskunde mathematics
Table 5.1. Plain tabular, ⌘t N t . Table 5.2. Centered block, ⌘t N B .

Inside math mode, a few additional kinds of tables Matrix, Determinant, Choice,
and Stack are available through the Insert „ Table menu (see Figures 5.1–5.4).
The stack tag corresponds to tables that are compressed as much as possible.
This makes them useful inside subscripts, superscripts, or other places where
little space is available.

(( a⋅⋅
11 ⋅ ⋅ ⋅ a1n
⋅⋅ )) ||| a⋅⋅
11 ⋅ ⋅ ⋅ a1n
⋅⋅ |||
(( a⋅
n1

⋅ ⋅ ⋅ ann
)) | a⋅
n1

⋅ ⋅ ⋅ ann |
Figure 5.1. Matrix Figure 5.2. Determinant

if x ⩽ 0
f (x) = {{ 0 𝜎n = 𝜑i, j
{e 1
−x
if x > 0
1⩽i⩽n
i⩽ j⩽2i

Figure 5.3. Choice Figure 5.4. Stack

There are several other table-like environments and new ones may be created
by the user. For instance, using Insert „ Mathematics „ Equations or ⌥& , you
may insert an eqnarray* environment. This allows mathematical users to align
lists of equations that extend over entire lines. An example of such a list of
equations is

[sin ( f (x) g(x))]′ = ( f (x) g(x))′ cos ( f (x) g(x))


= ( f ′(x) g(x) + f (x) g′(x)) cos ( f (x) g(x))

5.2 Basic table editing


When starting a new table, its size is minimal (usually 1 × 1) and its cells are
empty. New rows and columns can be inserted using the keyboard shortcuts
⌥← , ⌥→ , ⌥↑ , and ⌥↓ . For instance, ⌥↓ creates a new row below the current
cursor position, as illustrated in Table 5.3 below. Alternatively, you may start
a new row by hitting the ↩ key. New rows and columns can also be inserted
from the Focus „ Resize menu, or using the icons , , , and on the focus
bar. Finally, it is possible to specify the exact number of rows and columns of
a table using Focus „ Table „ Size „ Set number of rows and Focus „ Table „ Size „
Set number of columns.
5.3 CELL PROPERTIES 91

⌥→ ⌥← ⌥↓ ⌥↑ ↩

a b a b
(( ac db| )) (( ac db | )) (( ac | db )) (((( | )))) (((( a b )))) (((( | ))))
|

(c d) (c d) (c d)
Table 5.3. Inserting new rows and columns using the cursor keys. Starting from the initial
2 × 2 matrix at the left hand side, with the cursor behind the character b, the table indicates
the results after pressing the keys ⌥→ , ⌥← , ⌥↓ , ⌥↑ , and ↩ .

⌫ ⌦

(( ac | db )) (( a|c db )) (( ac |bd ))
(( a| b )) ( a b| ) ( a b )
(( c d )) ( c d ) ( |c d )
Table 5.4. Removing empty rows and columns using the keys ⌫ and ⌦ .

Rows and columns that are entirely empty can be deleted using the keys ⌫
or ⌦ , as indicated in Table 5.4. No matter whether they are empty or not, rows
and columns can be deleted from the Focus „ Resize menu, or using the icons ,
, , and from the focus bar.
Rows, columns, and more general rectangular selections of cells can easily be
cut, copied, and pasted. Selections of cells are indicated using a different color
(magenta) from that of usual selections (which are red). One typical scenario
for copying and pasting a rectangular selection of cells is shown in Figure 5.5.

(( a⋅⋅
11 ⋅ ⋅ ⋅ a1n
⋅⋅ )) select (( a⋅⋅11 ⋅ ⋅ ⋅ a1n|
⋅⋅ )) Copy (( a⋅⋅
11 ⋅ ⋅ ⋅ a1n|
⋅⋅ ))
(( ⋅| ⋅ )) →


→→

→→


→→

(( a⋅11

⋅ ⋅ ⋅ a1n
)) →


→→

→→


→→
(( ⋅ ⋅ ))
mouse click (( a⋅⋅11 ⋅ ⋅ ⋅ a1n
⋅⋅ )) Paste (( a⋅⋅
11 ⋅ ⋅ ⋅ a1n
⋅⋅ ))



→→

→→


→→

→→


→→

→→


→→

(( ⋅| ⋅ )) →


→→

→→


→→

(( |a⋅
11

⋅ ⋅ ⋅ a1n
))
Figure 5.5. One typical scenario of copying and pasting a range of cells. Starting with the
matrix at the left-hand side, we first select the top row using the mouse. We next copy the
selection using Edit „ Copy or ⌘w and reposition the cursor inside the first cell of the third
row. We finally paste the selection using Edit „ Paste or ⌃y .

5.3 Cell properties


5.3.1 Cell operation modes
The individual cells of tables have several properties that can be changed by the
user: horizontal and vertical alignment, background color, width and height,
92 TABLES

border width and padding, etc. One first way to edit these properties is to
open the cell property editor using Format „ Cell. Alternatively, changes can
be made via the entries in the Focus „ Cell menu or the corresponding icons
on the focus bar. Some properties can also be edited using the keyboard.
By default, cell operations are performed on the cell that contains the cursor.
It is also possible to jointly modify the cell properties of all cells in the table, or
of all cells in the row or column that contains the cursor. For this, it suffices to
change the “cell operation mode”, by selecting Entire table, Row or Column in
the menu Focus „ Cell „ Operation mode. Similarly, if a selection of cells is active,
then the properties are modified jointly for all cells in the selection.
Internally, cell properties are associated to rectangular regions of cells. Let us
mention one useful implication of this fact. Assume that the first row of the
following table was colored by selecting the first row and changing the back-
ground color to “pastel yellow” using Focus „ Cell „ Background color:

English house tree beast


French maison arbre bête
Dutch huis boom beest

Then TEXMACS associates this background color to the entire region corre-
sponding to the first row. Now assume that we insert a new column between
house and tree. This will yield

English house tree beast


French maison arbre bête
Dutch huis boom beest

In other words, it is not necessary to specify the background color of the top
cell again in the new column, since this cell is “naturally part of the region”
for which we set the color to pastel yellow. This would not have been the case
if we had separately specified the background color for each of the cells in
the top row of the original table. In that case, the insertion of a new column
between house and tree would have resulted in
English house tree beast
French maison arbre bête
Dutch huis boom beest

5.3.2 Width and height


The widths of columns and heights of rows are computed automatically as
a function of the content of the cells and constraints that can be specified by the
user.
The width of a column is the maximum of the widths of its cells and similarly
for the height of a row. The default width of a cell simply coincides with the
width of its contents (except when you enable line wrapping, in which case
5.3 CELL PROPERTIES 93

Nice Dull Nice Dull


Even nicer Even duller Even nicer Even duller
Really very very nice Extremely dull Really very very nice
Extremely dull

Figure 5.6. Automatic width. Figure 5.7. Exact width of 1 in.

Nice Dull Nice Dull


Even nicer Even duller Even nicer Even duller
Really very very nice Extremely dull Really very very nice
Extremely dull

Figure 5.8. Minimal width of 1in. Figure 5.9. Maximal width of 1 in.

the default width becomes zero). The default width can be overridden using
Focus „ Cell „ Width, Format „ Cell „ Width, or the icon menu on the focus bar.
The user may either specify an exact, minimal, or maximal width for the cell.
When specifying a minimal width, the corresponding column has a guaran-
teed minimal width; the actual width may be larger if one of the cells is even
wider. When specifying a maximal width for all cells, it is guaranteed that
the width of the corresponding column will never exceed the specified value.
However, this also means that any contents that don't fit into this width may
overlap with neighboring cells. The same problem can occur if you specify an
exact width. The possible settings are illustrated in Figures 5.6–5.9.
If your table is too wide or if you manually specified its width, then it may
happen that the available horizontal space is not completely used up by the
columns. This occurs for instance when starting a new wide table using Insert „
Table „ Wide block. By default, the unused space is distributed evenly over all
columns, but this setting can be overridden by specifying stretch factors using
Focus „ Cell „ Width „ Stretch factor or Format „ Cell „ Width „ Stretch. In Figure 5.10,
we have shown an example table in which the unused space has been distrib-
uted evenly among the two columns. In Figure 5.11, we have shown the same
table with a stretch factor of 0 for the first column and 1 for the second one.
The heights of rows are determined following similar principles. In addition,
TEXMACS adjusts the vertical limits of cells in order to ensure a uniform layout
for ordinary text. Indeed, characters like “a”, “e”, and “x” are shorter than “b”,
“d”, and “k”, and not as deep as “p”, “q”, and “g”. If the vertical limits of cells

17 A Fermat prime number


60 Babylonian number base
256 Number of byte values
Figure 5.10. Evenly distribute unused space.

17 A Fermat prime number


60 Babylonian number base
256 Number of byte values
Figure 5.11. Grant all unused space to the last column.
94 TABLES

were not adjusted, then the formula

(( xa xa )) + (( xf xf ))
would rather be displayed as follows:

a x f x (( ))
x a + x f

In other words, TEXMACS adjusts cells such that they vertically extend to the
highest and deepest character in the current font. This feature can be turned
off, or only applied to the top or the bottom, via the menu Focus „ Cell „ Height „
Adjust limits or Format „ Cell „ Text height correction.

5.3.3 Borders and padding


The user may specify the widths of the four borders of each cell using Format „
Cell „ Border. The actual width of a border is taken to be the maximum of the
specified border widths of adjacent cells. For instance, in the table below, all
cells have a top and left border width of 2 ln and a bottom and right border
width of 0 ln
top left top top right
left central right
bottom left bottom bottom right
The actual border width between the “top left” cell and the “top” cell is 2 ln,
which is indeed the maximum of 0 ln (the right border width of the “top left”
cell) and 2 ln (the left border width of the “top” cell). The length unit “ln”
corresponds to the “standard line width” that is appropriate for the current
font. In particular, the width of a fraction bar is 1 ln.
The specification of each of the borders of every individual cell can be tedious.
For this reason, a simplified interface has been made available through Focus „
Cell „ Border and the icon on the focus bar. Using this interface, all four
borders of a cell or selection of cells can be changed simultaneously, which
includes the corresponding changes in the border widths of the neighboring
cells. For example, after positioning the cursor inside the “central” cell of the
above table, and clicking on , we obtain
top left top top right
left central right
bottom left bottom bottom right
Similarly, after selecting the four “central”, “right”, “bottom”, and “bottom
right” cells, and clicking on , we obtain
top left top top right
left central right
bottom left bottom bottom right
5.3 CELL PROPERTIES 95

0 sep 1 sep 1 spc 2 spc


0 sep Test test Test test Test test Test test
1 sep Test test Test test Test test Test test
1 spc Test test Test test Test test Test test
2 spc Test test Test test Test test Test test

Table 5.5. Typical settings for the horizontal and vertical cell padding.

Notice that the borders that are created in this way have a default width of
1 ln. For other border widths, you may use „ Pen width or the more detailed
interface from Format „ Cell.
Besides the borders, it is also possible to customize the amount of padding
between borders of cells and their actual contents. Again, it is possible to sep-
arately specify the amount of padding in all four directions via Format „ Cell „
Padding, Focus „ Cell „ Padding, or the icon . By default, TEXMACS uses a hori-
zontal padding of 1 spc (the default width of a space character for the current
font) and a vertical padding of 1 sep (standard separation space for the current
font). In Table 5.5, we have illustrated the effect of various amounts of hori-
zontal and vertical padding.

5.3.4 Horizontal and vertical alignment


The horizontal and vertical alignment of cells can be specified via Format „ Cell „
Alignment or Focus „ Cell „ Horizontal alignment and Vertical alignment. The
current horizontal alignment is indicated on the focus bar by one of the icons
, , , or . The cell alignment can also be modified via the corresponding
icon menu.
Besides the classic left, center, and right alignments, it is also possible to hor-
izontally align on a decimal dot or comma. This is useful for numerical and
monetary tables. Similarly, besides the classic top, center, and bottom align-
ments, cells can be aligned at their “baselines”. This kind of vertical alignment
is the default and usually indeed most appropriate for ordinary text. Table 5.6
shows the various available types of cell alignment.

left center right decimal dot decimal comma


e πi = −1 0.14285714 0,14285714
top x + y = z H= 1
2 2 2 1
1
x
+y

center H = 1 + 1
1
x2 + y2 = z2 e πi = −1 14.285714 14,285714
x y

baseline e πi = −1 H= 1 x 2 + y 2 = z 2 1428.5714 1428,5714


1
1
x
+y

H= 1
1
bottom
e πi = −1 x 2 + y 2 = z 2 1428.5714 1428,5714
1
x
+y

Table 5.6. Demonstration of the various kinds of cell alignment.


96 TABLES

It is easy to modify the alignment of cells using the keyboard. The shortcut ⌘→
moves the horizontal alignment of a cell further to the right: a cell that was
aligned at the left will be centered, and a cell that was centered will become
right aligned. Similarly, the keystroke ⌘← moves the horizontal alignment fur-
ther to the left, whereas ⌘↑ and ⌘↓ allow you to adjust the vertical alignment.
When applied to a selection of cells, we notice that the selection remains active,
so that multiple changes can be made efficiently. If you need to modify the
horizontal alignment of many columns in multiple tables, then the keyboard
shortcuts ⌘← and ⌘→ are also very efficient in combination with the “column
operation mode” (Focus „ Cell „ Operation mode „ Columns).

5.3.5 Line-wrapping and block content

We already discussed the difference between wide tables and smaller inline
tables such as matrices inside mathematical formulas. Wide tables allow cells
to contain large portions of text. If the contents of a cell do not fit on a single
line, then line-wrapping is activated by default in order to prevent the table
from running out of the page. To this effect, we recall the existence of the
toggle on the focus bar. Notice that line-wrapping only makes sense inside
cells or tables for which a maximal width has been specified (see sections 5.3.2
and 5.4.2); otherwise, the cell will simply become as large as necessary for its
contents to fit on a single line.

Line-wrapping can also be activated or deactivated using Format „ Cell „ Line


wrapping or Focus „ Cell „ Line wrapping. These menus additionally allow you
to specify the way in which line-wrapped cells should be aligned with respect
to neighboring cells. For example, consider the following list of equations, cre-
ated using Insert „ Mathematics „ Several equations:

a+b+c+d+e+ f +g+h+i+ j+k+


l+m+n+o+p+q+r+s+t+u+v+
w+x+y+z = z+y+x+w+v+u+t+s+r+q+p+
o+n+m+l+k+ j+i+h+g+ f +e+
d+c+b+a
= a+z+b+y+c+x+d+w+e+v+ f +
u+g+t+h+s+i+r+ j+q+k+p+
l + o + m + n.

Both the first and the last column of this table are line-wrapped. However, the
first column is aligned at the bottom whereas the last column is aligned at the
top.

By default, cells in which line-wrapping is activated allow for “block content”.


Such cells may for instance contain several paragraphs, theorems, enumera-
tions, or entire computer algebra sessions. In certain situations you may wish
5.4 TABLE PROPERTIES 97

to allow for block content inside cells that are not line-wrapped. Inversely, you
may want to disallow block content in cells where line wrapping is active. This
can be specified via the menus Format „ Cell „ Block content or Focus „ Cell „ Block
content.

5.4 Table properties


The global properties of a table can be edited after opening the “Table proper-
ties” editor via Format „ Table. Alternatively, you may use the submenus under
Focus „ Table or the icon on the focus bar.

5.4.1 Number of rows and columns

We have already discussed the insertion and removal of rows and columns
using the keyboard shortcuts ⌥← , ⌥→ , ⌥↑ , ⌥↓ , or the icons , , , , , ,
, and on the focus bar. It is also possible to specify an exact number of
rows or columns using Focus „ Table „ Size „ Set number of rows and Set number
of columns. Moreover, the Focus „ Table „ Size menu allows you to specify a
minimum or maximum number of rows or columns in a table. This is espe-
cially useful for the design of macros for customized tables (see section 5.7).
For instance, the macro eqnarray* for aligned lists of equations
a1 + ⋅ ⋅ ⋅ + an
𝜇 =
n
a1 + ⋅ ⋅ ⋅ + an2
2
𝜎 =
n

specifies that “tables” of this kind should contain at least and at most three
columns. Newly created lists of equations therefore contain three columns
instead of one, but no new columns can be inserted using ⌥← or ⌥→ . Simi-
larly, the keys ⌫ and ⌦ suppress the table as soon as its cells are empty and
there are only one row and three columns left.

5.4.2 Width and height

The width and the height of a table can be specified using Format „ Table „ Width
and Height or Focus „ Table „ Width and Height, much in the same way as for
cells (see section 5.3.2).
Two settings for the global table size are most common: wide tables on sep-
arate lines usually extend over the entire width of a paragraph, whereas the
sizes of smaller tables such as matrices are typically determined automatically
so as to make the contents of all cells fit. Toggling between these two possibili-
ties is so common that the focus bar contains a special icon for this purpose.
You may also use Focus „ Table „ Width „ Paragraph or specify 1 par as Format „
Table „ Width or Focus „ Table „ Width.
98 TABLES

Today's menu

GNU TEXMACS J Crash course in rapid typing


J The happy mathematician
Joris van der Hoeven J Computing faster than light
http://www.texmacs.org J Thank mom, dad, and all others

Figure 5.12. Example of two miniscreens for a presentation.

Of course, other table sizes can sometimes be useful. For instance, one may use
a fixed table size for mimicking a minipage or a miniscreen, as in Figure 5.12.

5.4.3 Borders and padding


You may specify the width of the left, right, top, and bottom borders of a table
using Format „ Table „ Border or Focus „ Table „ Border. This feature has been
provided for consistency, but is really redundant with the possibility to specify
the borders of selections of cells (see section 5.3.3): it suffices to select all cells.
On the other hand, padding is applied around the table, instead of inside the
cells. You may change the padding at the left, right, top, and bottom of the
table using Format „ Table „ Padding or Focus „ Table „ Padding.

5.4.4 Alignment with respect to the surrounding text


The global alignment properties of a table specify how to align it with respect
to the surrounding text. These properties can be modified using Format „ Table „
Alignment or Focus „ Table „ Horizontal alignment and Vertical alignment. Cus-
tomized alignments are mainly needed for “inline” tables, which are embedded
into a formula or paragraph with other text.
By default, tables are vertically aligned at the axis. The axis is located halfway
between the top and the bottom of the character “x”. Tables that are centered
along the axis roughly descend as much below the bottom of the text as they
exceed the top. When selecting Top, Middle or Bottom for the vertical align-
ment, the top, center, or top of the table will instead be aligned with the baseline
of the surrounding text: see Figure 5.13.

bottom
axis middle
Vertical alignment at the or or or bottom .
axis top middle
top
Figure 5.13. Basic types of vertical table alignment with respect to surrounding text.
5.4 TABLE PROPERTIES 99

bottom
bottom
middle
bottom second row
middle
Baseline alignment at the top or or bottom or second row .
middle
top second row
middle
top second row
top
Figure 5.14. Various kinds of vertical baseline alignment of tables.

It is also possible to align the baseline of a particular row in the table with the
baseline of the surrounding text, by selecting Top baseline, Middle baseline,
Bottom baseline or Specific baseline in Focus „ Table „ Vertical alignment. This
kind of alignment is illustrated in Figure 5.14. When the number of rows of a
table is even, the middle baseline is located exactly at the middle between the
baselines of the two central rows. For the rightmost table in Figure 5.14, we
chose “2” for Focus „ Table „ Vertical alignment „ Specific baseline.
The default horizontal alignment of tables is at the left. Other alignments are
supported for completeness, but rarely needed, since they usually result in
overlapping text: see Figure 5.15.

5.4.5 Breaking up large tables


Unfortunately, TEXMACS is currently not very efficient for editing large tables.
In particular, it is recommended to manually break up tables that do not fit on
a single page. Smaller tables sometimes do not nicely fit on a page either. This
typically happens for long lists of equations such as

x 1 = Φ1(x 1, x 2, . . . , x n−1, x n)
x 2 = Φ2(x 1, x 2, . . . , x n−1, x n)
⋅⋅

x n−1 = Φn−1(x 1, x 2, . . . , x n−1, x n)
x n = Φn(x 1, x 2, . . . , x n−1, x n).

If you want to allow for page breaks inside such tables, then you should use
Format „ Table „ Large tables „ Enable page breaking or Focus „ Table „ Special „
Table breaking. Notice that you should set all interline and interparagraph
spacing to zero (see section 3.9) whenever the cells of such a table admit bor-
ders.

left middle right


Horizontal alignment at the or at the or, even, at the .
left middle right
Figure 5.15. Horizontal table alignment with respect to surrounding text.
100 TABLES

2011 2012
Total
jan–jun jul–dec jan–jun jul–dec
Milk 120.10 116.20 128 126.15 490.45
Beverages 850.65
Cola 85.40 105.30 74.15 95.35 360.20
Apples 65.10 72.85 82.90 83.10 303.95
Fruit Cherries 34.20 55.45 23.85 57.55 171.05 728.40
Bananas 83 47.20 72 51.20 253.40
Total 387.80 397 380.90 413.35 1579.05
Table 5.7. Spending table that illustrates how to use joined cells.

5.5 Joined cells and subtables

It is sometimes useful to merge several cells into a single cell. After making
a selection of cells, this can be done by clicking on the icon or Focus „ Cell „ Join
selected cells. Cells that have been joined together can be dissociated using
or Focus „ Cell „ Dissociate joined cells. Table 5.7 gives a typical example of
a table with a few joined cells. Cell-joining can also be an efficient way to create
certain diagrams: see Figure 5.16. In this example the widths and heights of
all cells were set to 0.25 in.

Remark 5.2. When joining selected cells C 11, . . . , C kl, the top left cell C 11 will
assume the role of the “leader” and contains the content of the joined cell. The
other cells C 12, . . . , C kl remain part of the table, but become invisible to the user
until the joined cell is dissociated.

g8 8
8 10 14
g7 7
g6 6
6
g5 5
6 10
g4 4
4
g3 3
g2 2
2 4 6 8
g1 1
g0 0 1 2 3 4 5 6 7 8
f0 f1 f2 f3 f4 f5 f6 f7 f8

Figure 5.16. Fast relaxed multiplication of formal power series.


5.6 ARTISTIC TABLES 101

Start with a row Start with a row


Next one Next one
End with a row End with a row
Figure 5.17. The left-hand side shows a table with three rows and one column in which
we created two subtables in the first and the last row. The right-hand side shows a table
with three rows and two columns in which we joined the two cells in the middle row.
Notice the differences in the alignment.

Conversely, TEXMACS also allows you to split up a single cell into several ones,
by transforming it into a “subtable”. This can be done using the icon on
the focus bar or Focus „ Insert subtable. Whether it is better to join several cells
together or split up some of the other cells depends on the context. The main
difference between the two techniques is that the alignment properties of cells
in subtables of the outer table are not correlated: see Figure 5.17.

5.6 Artistic tables


Nice graphical effects can be obtained through the suitable use of colors and
fonts inside tables. Let us illustrate this with a few examples. In Table 5.8, we
gave the first row a dark blue background color and a pastel yellow foreground
color. In addition, we used a “sans serif” font for the text, which enhances
the readability. Notice that the usual ways to change the foreground color
(Format „ Color or the icon) and font (Format „ Font) also apply for selec-
tions of cells. On the other hand, this mechanism does not work for content
tags from the Insert menu such as strong or name.

Dutch English French


huisje little house petite maison
boompje little tree petit arbre
beestje little beast petite bête
Table 5.8. Example of table in which the first row uses light colors on a dark background.

Tables can also be given a more artistic look through the use of background
patterns. One example of this technique is shown in Table 5.9. The “wooden
borders” are empty rows and columns whose heights and widths were respec-
tively set to 0.5 em. We also turned off the height correction using Focus „ Cell „
Height „ Ajust limits „ None.

Dot hatches Line hatches Floral Fashion


Light Single Grey floral Leather
Medium Double Symphony Feathers
Dark Triple Regal Textile

Table 5.9. The use of background patterns inside tables.


102 TABLES

forall (K: Field)


power (x: K, n: Int): K == {
if n > 1 then {
p: K == square power (x, n quo 2);
if n rem 2 = 0 then return p;
else return x * p;
}
else if n = 1 then return x;
else if n = 0 then return 1;
else return invert power (x, -n);
}

Table 5.10. Combining the three above background patterns inside a table.

Using a combination of background patterns, you may also create various


kinds of “artwork paper”. For instance, in Table 5.10, we used three different
background patterns: two for the left and right borders, and another one for
the “paper”. Using six additional patterns for the top and bottom borders,
it is possible to design even more elaborate decorations.

5.7 Table macros


Whenever a particular kind of table style is needed at many places in a doc-
ument, it may be worth it to create a “table macro”. For detailed information
about the creation of macros, we refer to chapter 12.
Let us explain the creation of a simple table macro with an example. The first
step is to create a prototype of the table with the style that you are interested
in. Assume for instance that we use the following table for our prototype:

Dutch English French


huisje little house petite maison
boompje little tree petit arbre
beestje little beast petite bête

It may be useful to specify a minimum size as well using Focus „ Table „ Size „
Minimal number of rows and Minimal number of columns. In our example, it is
natural to require at least two rows and two columns.
5.7 TABLE MACROS 103

At the second step, you should place the cursor anywhere inside the table an
click on Tools „ Macros „ Create table macro. A window for editing macros
should pop up with a declaration that should look as follows:

|≔
hmacrojbodyj
htformatj
hcwithj1j-1j1j-1jcell-rborderj1lnij
hcwithj1j-1j1j-1jcell-bborderj1lnij
hcwithj1j1j1j-1jcell-tborderj1lnij
hcwithj1j-1j1j1jcell-lborderj1lnij
hcwithj1j1j1j-1jcell-backgroundjdark blueij
hcwithj1j1j1j-1jfont-familyjssij
hcwithj1j1j1j-1jcolorjpastel yellowij
htwithjtable-min-rowsj2ij
htwithjtable-min-colsj2ij
bodyii

At the default cursor position, enter the name of your macro and click on the
Ok button.

Having created our table macro, we may now use it. Assuming that we called
it “translation-table”, it suffices to type \ followed by this name and hit ↩ .
This will yield

Notice that the table macro only preserves the style of the macro, not its actual
contents. Notice also that the initial table macro application indeed contains
two rows and two columns, as desired.
In certain cases, we might want to surround the actual table with some fixed
content. For instance, a matrix is really a table surrounded by two big paren-
theses. Assume that we want to create a new curly-matrix macro for which the
parentheses are replaced by curly braces. As usual, we first create a prototype
of such a “table”:

{ ac db }.
Next, we carefully select the table together with the braces and click on Tools „
Macros „ Create table macro. As before, we finally enter the name curly-matrix
in the macro editor and click on the Ok button. Notice that the selection step is
essential: if we just place our cursor inside the table, then Tools „ Macros „ Create
table macro creates a macro for the table without the surrounding braces.
Chapter 6
Connected documents

The days are gone that we had to roam through the alleys of libraries, when
brinks of information were hiding themselves inside thick books. Modern doc-
uments need to be connected, within ten-click distance of the entire universe.
TEXMACS provides functionalities for the creation of many types of connec-
tions inside and between documents. In this chapter, we cover hyperlinks,
labels and references, tables of contents, indexes, bibliographies, inclusions
from other documents, etc. In chapter 11, we will explain how TEXMACS can be
connected to external computational software. Other types of “connections”
are under development, such as support for various web services.
Connected documents contain a lot of automatically generated content, ranging
from short references to complete bibliographies. This introduces an inevitable
pitfall: the precise way in which this content has to be generated and kept up to
date may become a complex and potentially time-consuming process. In order
to avoid any slowdown of the usual editing process, some of these updates
are only done on request using Document „ Update „ All or by clicking on the
icon. The Document „ Update menu also contains several entries for specific
kinds of updates, such as regenerating only the table of contents. Note that
you have to be in “paper mode” (Document „ Page „ Format „ Page rendering „
paper) if you want page numbers to be updated correctly.

The preceding discussion explains why the updating process of connected


documents is only semi-automatic. Of course, TEXMACS attempts to automate
things as much as possible: updates that can be performed sufficiently quickly
are done on-the-fly. As computers get faster, and with the implementation
of more efficient algorithms inside the editor, time works in favor of more
and more automation. However, efficiency is not the only reason for keeping
the updating process semi-automatic: some types of automatically generated
content may never reach a “stable state”. For instance, a tag that displays the
current time is bound to change at every update. Similarly, some updates
might involve computations by computer algebra systems, with potentially
different answers at every new execution. To a lesser extent, this phenomenon
may occur when updating tables of contents, bibliographies, etc. Indeed, the
regenerated table of contents might require an extra page, in which case an
additional update is needed to get all page numbers right. It is therefore rec-
ommended to systematically update important documents a few times before
going public.

104
6.1 LABELS AND REFERENCES 105

7 The Pythagoras theorem |

|a 2 + b 2 = c 2 (1)

THEOREM 18.|Pythagoras said “a 2 + b 2 = c 2”.

ℬ(a, r) ± ℬ(b, s) ≔ ℬ(a ± b, r + s) (2)|


ℬ(a, r) × ℬ(b, s) ≔ ℬ(a × b, (|a| + r) × s + r × |b|) (3)
Figure 6.1. Appropriate cursor positions for where to insert labels.

6.1 Labels and references

In order to create references to sections, equations, theorems, etc., you must


proceed in two steps. You first have to create a label at the position to which you
want to refer. For equations, the label should be created inside the equation,
and similarly for theorems and most other tags. The labels for sections, subsec-
tions, etc. should rather be positioned just after the section titles; this prevents
TEXMACS from duplicating the labels in the table of contents. When labeling
multiple equations (that were created using Insert „ Mathematics „ Equations),
you must put the labels just behind the equation numbers (which can be tog-
gled using ⌃# ). The appropriate positions for labels are illustrated in Figure 6.1.

You may create the actual label using Insert „ Link „ Label or the keyboard
shortcut ⌘! . Newly created labels are initially inactive: you are supposed to
enter the name of your label and then hit ↩ in order to activate it. After that,
a small marker should appear to indicate the position of the label. This marker
will not appear in the printed version of your document. When selecting Doc-
ument „ Informative flags „ Detailed, these markers will also indicate the names
of the actual labels, as in the equation
eq:Pythagoras

a 2 + b 2 = c 2. (6.4)

It is the responsibility of the user to avoid the creation of several labels with the
same name. In that case, you will receive an error message, since references to
such labels are ambiguous.

Assuming that you created a label test-name, you can insert a reference to it
using Insert „ Link „ Reference or the keyboard shortcut ⌘? . Again, a newly
created reference will be inactive. After re-entering the name test-name and
hitting the activation key ↩ , the appropriate reference should appear in the
text. For equations such as (6.4), we note that you have to add the surrounding
parentheses yourself. When entering the name of a reference, you may benefit
from the mechanism of “tab-completion”: after typing the first characters of
106 CONNECTED DOCUMENTS

the name, hitting the ⇥ key will automatically complete it. References to non-
existent labels cause TEXMACS to complain with an error message. Inside the
editor, as well as for the PDF and HTML exports, references behave like hyper-
links: when clicking on them, you jump to the corresponding label.

6.2 Hyperlinks and actions

It is possible to create hyperlinks (similar to the ones found on web pages)


using ⌘i > or Insert „ Link „ Hyperlink. The first field of the hyperlink contains
the visible text. The second field specifies the location you wish to point at; this
may be the URL of a web page like http://www.texmacs.org or the name
of a local file. After activation using ↩ , hyperlinks are rendered using a blue-
grey color on the screen and without any special color in printed documents.
The screen color changes to purple-grey as soon as you click on the link. The
coloring schemes can be customized using Focus „ Preferences „ Locus color and
Focus „ Preferences „ Visited color. As is usual for hyperlinks on the web, a link
of the form #label points to a label in the same document and a link of the
form url #label points to a label in the document located at url .
Instead of jumping to a specified location, it is also possible to execute arbi-
trary commands when clicking on a “link”. This is done by creating an “action”
using ⌘i * or Insert „ Link „ Action. The first field again contains the text to be
displayed, whereas the second field now specifies a Guile/Scheme command.
After activation, the Scheme script will be executed each time you click on the
text. For security reasons, such scripts are not always accepted. By default, you
are prompted for acceptance; this default behavior may be changed in Edit „
Preferences „ Other „ Security. Notice that the Guile/Scheme command

(system "shell-command")
evaluates shell-command as a shell command. This provides an easy way to
launch any external application via a simple mouse click.

6.3 Inserting images

You can insert images into the text using Insert „ Image. The entries Insert „
Image „ Draw image and Insert „ Image „ Draw over selection allow you to draw
your own pictures using the graphical editor that comes with TEXMACS (see
chapter 8).
External images can be incorporated using either Insert „ Image „ Link image
or Insert „ Image „ Insert image. The first method only puts a link to the image
inside your document, whereas the second method inserts the image itself.
Links offer the advantages that documents remain smaller in size, that the
same image can be shared between several documents or document fragments,
6.3 INSERTING IMAGES 107

and that images can be updated independently from documents. The main
drawback is that documents become less self-contained: if you send your doc-
ument to a friend or colleague, then you also need to send each of the linked
images. This drawback can be alleviated by keeping all images inside a ded-
icated folder.

By default, external images are displayed at their design sizes and aligned at
their bottom lines. Alternative widths, heights, and alignment offsets can be
specified using the focus menu or toolbar.

• When specifying a new width (using Focus „ Set width), but no height
(or vice versa), the image is resized so as to preserve the aspect ratio. For
example, entering a width of 1 par will make the image extend over the
entire paragraph width and adjust the height proportionally.

You may use w and h as special lengths for the default width and height
of the image. For example, specifying 2 w and 2 h for the width and the
height, the image will be displayed at twice the default size.

• When specifying an alternative offset (using Focus „ Set x-offset and


Focus „ Set y-offset), you may use the w and h lengths for the displayed
width and height (i.e. w and h no longer stand for the default width
and height). For example, using -0.5 h for the y-offset will vertically
center the image.

Figure 6.2 shows the effect of various size and offset settings for a given image.

In addition to the above ways to specify the exact width, height, and offset of
an image, it is also possible to customize these settings efficiently using the key-
board: the shortcuts ⌘← and ⌘→ (resp. ⌘↑ and ⌘↓ ) allow you to decrease and
increase the width (resp. height), whereas ⌘⇟ and ⌘⇞ can be used for adjusting
the vertical offset.

Currently, TEXMACS supports the following image formats:

bmp Windows Bitmap


eps Encapsulated Postscript
fig Figures for the XFIG program
gif Graphic Interchange Format
jpg, jpeg Joint Photographic Experts Group
png Portable Network Graphics
pbm Portable Bitmap
pdf Portable Document Format
ppm Portable Pixmap
ps Postscript
tiff Tagged Image File Format
xpm X11 Pixmap
108 CONNECTED DOCUMENTS

Width 0.5 w 15 mm 1w
Height 1h 0.5 h 0.5 h
X-offset
Y-offset 0.5 h -0.5 h
Figure 6.2. Example of the effect of various size and offset specifications for an image.
Blank fields correspond to the default setting. In particular, the leftmost image corre-
sponds to the default rendering.

The POSTSCRIPT support relies on GHOSTSCRIPT. Binary TEXMACS distributions


include GHOSTSCRIPT, but you may need to install GHOSTSCRIPT yourself if you
compile TEXMACS from the source code.
More image formats such as svg (Scalable Vector Graphics) are supported by
TEXMACS modulo the installation of appropriate converters on your system [10].
On UNIX systems, we recommend the installation of IMAGEMAGICK, which
comes with a large collection of converters [8].

6.4 Content extraction

6.4.1 Tables of contents

In order to generate a table of contents for your document, you should proceed
as follows:

1. Put the cursor at the appropriate place and click on Insert „ Automatic „
Table of contents.

2. Select Document „ Page „ Format „ Page rendering „ paper for the page
mode.

3. Generate the table of contents using Document „ Update „ Table of con-


tents or Document „ Update „ All.

As explained in the introduction of this chapter, the second step is necessary


in order to get the page numbers right. For the final version of a document,
we also recall that it is advisable to update it several times, until a stable state
is reached. Indeed, the page numbers may change as a result of modifications
in the table of contents!
6.4 CONTENT EXTRACTION 109

Index
hindexjsimplei
hsubindexjentryjsubentryi E
hsubsubindexjentryjsubentryjsubsubentryi entry
hindex-complexjjstrongjjhtuplejentryjimportantii important . . . . . . . . . . . 109
range . . . . . . . . . . 109–109
hindex-complexjtheoryjjjhtuplej𝛼-theoryii subentry . . . . . . . . . . . 109
hindex-complexjjjrangejhtuplejentryjrangeii subsubentry . . . . . . . . 109
hindex-complexjjjrangejhtuplejentryjrangeii
S
hindex-linejejhstrongjEii simple .. . .. . .. . .. . .. . 109
hindex-linejsjhvspace*j0.5fnihstrongjSii
T
hindex-linejtjhvspace*j0.5fnihstrongjTii 𝛼-theory . . .. . .. . .. . .. . 109

Figure 6.3. Demonstration of the available types of index entries. The left-hand side shows the
entries in their deactivated state. The right-hand side shows the index generated from these
entries, after activating them and putting them at appropriate places in the main text.

6.4.2 Indexes

For the generation of an index, you first have to put “index entries” in your
document using Insert „ Link „ Index entry. In a second step, you must put your
cursor at the place where you want your index to be generated and click on
Insert „ Automatic „ Index. The index can then be generated in a similar way as
the table of contents (see Figure 6.3 for an example).

In the Insert „ Link „ Index entry menu, you find several types of index entries.
The simplest ones are Main, Sub, and Subsub, which are macros with one, two,
and three arguments respectively. Entries of the form Sub and Subsub may be
used to subordinate index entries with respect to other ones. As usual, you
have to fill out the arguments of the entries, and then hit ↩ in order to activate
them. The locations of index entries are indicated through markers or flags ,
as in the case of labels (see section 6.1).

A Complex index entry takes four arguments. The first one is a key that spec-
ifies how the entry has to be sorted; it must be a “tuple” (created using ⌘i < )
whose first component is the main category, the second a subcategory, etc. The
second argument of a complex index entry is either blank or “strong”, in which
case the page number of your entry will appear in bold. The third argument
is usually blank, but if you create two index entries with the same non-blank
third argument, then this will create a “range” of page numbers. The fourth
argument, which is again a tuple, is the entry itself.

It is also possible to create an index line without a page number using Insert „
Link „ Index entry „ Interject. The first argument of this macro is a key for how
to sort the index line. The second argument contains the actual text. This con-
struct may be useful for creating different sections “A”, “B”, etc. in your index.
110 CONNECTED DOCUMENTS

Glossary
hglossary-linejhstrongjSymbolsii
hglossaryjℵi Symbols
hglossary-explainjℝjThe field of real numbersi ℵ . . . . . . . . . . . . . . . . . . . .. . 110
hglossary-linejhvspace*j0.5fnihstrongjNotationsii ℝ The field of real numbers . .. . 110
hglossary-explainjA ⨿ BjCoproduct of A and Bi
hglossary-dupjA ⨿ Bi Notations
A⨿B Disjoint union of A and B . 110, 110

Figure 6.4. Demonstration of the available types of glossary entries. The left-hand side shows the
entries in their deactivated state. The right-hand side shows the glossary generated from these
entries.

6.4.3 Glossaries

Glossaries are compiled in a similar way as indexes, but the entries are not
sorted (see Figure 6.4 for an example): the items in the glossary are listed in
the same order as the corresponding entries in the text. Glossary entries are
created using Insert „ Link „ Glossary entry, whereas the glossary itself is inserted
using Insert „ Automatic „ Glossary.

A Regular glossary entry just contains some text, and a page number will be
generated for it. An Explained glossary entry contains a second argument,
which explains the notation. A Duplicate entry may be used to create a page
number for the second occurrence of an entry. A glossary line creates an entry
without a page number.

6.4.4 Lists of figures and tables

Using Insert „ Image „ Big figure or Insert „ Image „ Small figure, it is possible to as-
sociate a number and a caption (i.e. some explicative text) to a figure. TEXMACS
allows you to automatically produce the list of all figures of this kind: for each
figure, this list contains its caption and page number. Such a list of figures is
inserted using Insert „ Automatic „ List of figures and generated using Docu-
ment „ Update „ List of figures or Document „ Update „ All.

Sometimes, the caption of a figure may be quite long. In that case, you may
wish to use an alternative shorter caption for the list of figures. This can be
done by using the tag caption-detailed as your caption. The first argument of
this tag should be the long caption, and the second argument the shorter ver-
sion.

The same mechanism applies for numbered tables with captions, as created
using Insert „ Table „ Big table or Insert „ Table „ Small table. Lists of tables are
inserted using Insert „ Automatic „ List of tables and the tag caption-detailed can
again be used for generating alternative short captions in such lists.
6.4 CONTENT EXTRACTION 111

hindexjpower seriesi
hwith-indexjhofjhindexjIsaac Newtonii
hsubindexjrelativityjspeciali
hsubindexjrelativityjgenerali
hwith-indexjhofjhindexjAlbert Einsteinii
hindexjHilbert schemei
hwith-indexjhofjhindexjAlexander Grothendieckii

Index Hall of fame


Hilbert scheme .. . .. . .. . .. . . 111 Albert Einstein . . . . . .. . .. . .. 111
power series . .. . .. . .. . .. . . 111 Alexander Grothendieck .. . .. . .. 111
relativity Isaac Newton . . . . . . .. . .. . .. 111
general . . .. . .. . .. . .. . . 111
special . . . .. . .. . .. . .. . . 111

Figure 6.5. Example of how to create two indexes.

6.4.5 Multiple extractions

In a thick book or a collection of papers, you sometimes may wish to include


a separate table of contents or index for each chapter, together or not with
one for the entire book. Similarly, you may wish to maintain separate indexes
for concepts and people. To this effect, you should first know that each auto-
matically generated section comes with an identifier: by default, TEXMACS uses
toc for the table of contents, bib for the bibliography, idx for the index, gly
for the glossary, lof for the list of figures, and lot for the list of tables. For
selected fragments of text, you may specify alternate identifiers with Insert „
Link „ Alternate, and use this to generate a separate section for each identifier.

Let us show with an example how this works. Assume that we wish to main-
tain two separate indexes idx and hof for general concepts and names of
famous persons. The first index is managed as usual. The second one can be
created as follows: click on Insert „ Link „ Alternate „ Index and specify hof at the
prompt; next insert the index as usual via Insert „ Automatic „ Index. The name
“Hall of fame” can be specified by selecting the new index and doing Focus „
Rename. Index entries for persons are inserted in a similar way: click on Insert „
Link „ Alternate „ Index and specify hof at the prompt; next insert the index
entry as usual via Insert „ Link „ Index entry. An example is shown in Figure 6.5.
The specification of an alternate identifier for each person in the hall of fame
may be somewhat tedious. Of course, nothing prevents you from creating
a macro hof-index for this purpose:

hassignjhof-indexjhmacrojnamejhwith-indexjhofjhindexjnameiiii
112 CONNECTED DOCUMENTS

Similar macros can be created for putting the same entry in several indexes.
See chapter 12 for more information on how to create your own macros.

6.5 Bibliographies

The compilation of a bibliography is similar to the generation of an index (as


described in section 6.4.2), with “citations” in the role of “index entries”. There
is one major difference: the bibliographic information is usually stored in a sep-
arate database. This makes it easy to share such information among different
documents. The “bibliographic database” can either be maintained by hand
inside a file, or with the help of TEXMACS in the form of a genuine database.

TEXMACS essentially uses BIBTEX [43] as the format for storing bibliographic
entries. In particular, users who are familiar with this format may directly use
existing or hand-compiled BIBTEX files as bibliographic databases. There are
also several external tools for managing BIBTEX-based databases, such as BIB-
DESK [57] and ZOTERO [50]. Some of these tools make it easy to retrieve existing
bibliographic entries from the web. Section 6.5.4 contains a crash course on
BIBTEX; more information can be found in [43, 38, 16].

The particular BIBTEX file with your bibliographic database can be specified
when inserting a bibliography into your document. It is also possible to let
TEXMACS do the job of maintaining a global bibliographic database for all your
documents. This requires you to enable the Database tool in the Tools menu.
One advantage is that you may directly perform searches from inside the editor.
Another advantage is that relevant entries are copied as invisible attachments
inside your documents. When collaborating on a document, this makes it pos-
sible to automatically share bibliographic data among colleagues. The built-
in bibliography manager still allows you to import and export bibliographic
data in the form of BIBTEX entries or files.

6.5.1 Importing bibliographic references

A typical BIBTEX file example.bib with three entries is shown below. We will
use it for all our examples in this section. Bibliographic entries for many clas-
sical works can be found on the web in BIBTEX format. More generally, BIBTEX
files can be assembled and edited by hand using TEXMACS or any external ASCII
text editor.

In order to import the example file into the integrated bibliography manager
(assuming that Tools „ Database tool is enabled), you first have to open your
personal bibliography database using Data „ Open bibliography. It next suffices
to click on Data „ Import and select example.bib using the file browser.
6.5 BIBLIOGRAPHIES 113

example.bib
@Article{Ein05,
author = {Einstein, Albert},
title = {Ist die {Tr\"agheit} eines {K\"orpers}
von seinem {Energieinhalt} abh\"angig?},
journal = {Annalen der Physik},
year = {1905},
month = {March},
number = {113},
volume = {323},
pages = {639--641}
}

@Book{New1671,
author = {I. Newton},
title = {De methodis serierum et Fluxionum},
publisher = {Manuscript},
year = {1671}
}

@Article{Tur36,
author = {A. Turing},
title = {On computable numbers, with an application
to the {Entscheidungsproblem}},
journal = {Proc. London Maths. Soc.},
year = {1936},
volume = {2},
number = {42},
pages = {230--265}
}

6.5.2 Inserting citations

Ordinary citations such as [2] are created using Insert „ Link „ Citation „ Vis-
ible. The entries in the database are identified via their keys. In our example
file example.bib, the keys are New1671, Ein05, and Tur36. Using Focus „
Insert argument after or , further citations can be added to form a group.
For instance, the three entries from our example file are [1, 2, 3].

If you forgot part of a key, then you may use tab-completion to cycle through
all possible completions. You may also search for bibliographic entries in your
personal database using Focus „ Search in database or by clicking on the icon
on the focus bar. After entering some keywords separated by spaces in the
Search field of the search window, all entries are listed in which each keyword
appears at least once. By clicking on the key of one of the matching entries, this
key will be chosen for your citation.
114 CONNECTED DOCUMENTS

You sometimes may wish to mention a reference in the bibliography, without


putting any corresponding citation in the main text. In that case, you have to
create an “invisible citation” using Insert „ Link „ Citation „ Invisible.

Finally, Insert „ Link „ Citation „ Detailed allows you to cite a specific portion of
text in a work, such as a section or a theorem. For example, see [3, section 11]
for a proof of the impossibility to solve the Entscheidungsproblem.

Bibliography
[1] Albert Einstein. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik, 323(113):639–641, March 1905.
[2] I. Newton. De methodis serierum et Fluxionum. Manuscript, 1671.
[3] A. Turing. On computable numbers, with an application to the Entschei-
dungsproblem. Proc. London Maths. Soc., 2(42):230–265, 1936.

6.5.3 Compiling the bibliography

You may insert the bibliography using Insert „ Automatic „ Bibliography. If you
enabled Tools „ Database tool, then your personal global database will be used
for the bibliographic data. Otherwise you will be prompted to select a BIBTEX
file using the file browser. With the focus on the bibliography, the file name
can be changed a posteriori using Focus „ Set file name or on the focus toolbar.
An empty file name instructs TEXMACS to search for bibliographic entries in
your personal database.

The BIBTEX style to be used can also be specified on the focus toolbar or using
Focus „ Style, just after insertion of the bibliography. Notice that the Style text
on the focus toolbar is actually a button that opens a popup menu with some of
the supported styles. TEXMACS contains built-in support for the most frequent
BIBTEX styles abbrv, acm, alpha, elsart-num, ieeetr, plain, siam, unsrt.
In order to generate bibliographies using this built-in support, you must prefix
the bibliography style with tm-. For instance, the default style tm-plain cor-
responds to plain. Native BIBTEX styles can also be used, modulo installation
of the bibtex program on your computer.

The bibliography styles determine the rendering of both citations and the
entries in the bibliography itself, as well as the way these entries are sorted.
Below, we have shown the effect of the standard styles for our sample bib-
liography example.bib.

tm-abbrv
The achievements in [2, 1, 3] have changed the world.
[1] A. Einstein. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik, 323(113):639–641, March 1905.
[2] I. Newton. De methodis serierum et Fluxionum. Manuscript, 1671.
6.5 BIBLIOGRAPHIES 115

[3] A. Turing. On computable numbers, with an application to the Entschei-


dungsproblem. Proc. London Maths. Soc., 2(42):230–265, 1936.

tm-acm
The achievements in [2, 1, 3] have changed the world.
[1] EINSTEIN, A. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik 323, 113 (March 1905), 639–641.
[2] NEWTON, I. De methodis serierum et Fluxionum. Manuscript, 1671.
[3] TURING, A. On computable numbers, with an application to the Entschei-
dungsproblem. Proc. London Maths. Soc. 2, 42 (1936), 230–265.

tm-alpha
The achievements in [New71, Ein05, Tur36] have changed the
world.
[Ein05] Albert Einstein. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik, 323(113):639–641, March 1905.
[New71] I. Newton. De methodis serierum et Fluxionum. Manuscript, 1671.
[Tur36] A. Turing. On computable numbers, with an application to the Entschei-
dungsproblem. Proc. London Maths. Soc., 2(42):230–265, 1936.

tm-elsart-num
The achievements in [1, 2, 3] have changed the world.
[1] I. Newton, De methodis serierum et Fluxionum, Manuscript, 1671.
[2] A. Einstein, Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig?, Annalen der Physik 323 (113) (1905) 639–641.
[3] A. Turing, On computable numbers, with an application to the Entschei-
dungsproblem, Proc. London Maths. Soc. 2 (42) (1936) 230–265.

tm-ieeetr
The achievements in [1, 2, 3] have changed the world.
[1] I. Newton, De methodis serierum et Fluxionum. Manuscript, 1671.
[2] A. Einstein, ``Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig?,'' Annalen der Physik, vol. 323, no. 113, pp. 639–641, March 1905.
[3] A. Turing, ``On computable numbers, with an application to the Entschei-
dungsproblem,'' Proc. London Maths. Soc., vol. 2, no. 42, pp. 230–265, 1936.

tm-plain
The achievements in [2, 1, 3] have changed the world.
[1] Albert Einstein. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik, 323(113):639–641, March 1905.
[2] I. Newton. De methodis serierum et Fluxionum. Manuscript, 1671.
116 CONNECTED DOCUMENTS

[3] A. Turing. On computable numbers, with an application to the Entschei-


dungsproblem. Proc. London Maths. Soc., 2(42):230–265, 1936.

tm-siam
The achievements in [2, 1, 3] have changed the world.
[1] A. EINSTEIN, Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?,
Annalen der Physik, 323 (1905), pp. 639–641.
[2] I. NEWTON, De methodis serierum et Fluxionum, Manuscript, 1671.
[3] A. TURING, On computable numbers, with an application to the Entscheidung-
sproblem, Proc. London Maths. Soc., 2 (1936), pp. 230–265.

tm-unsrt
The achievements in [1, 2, 3] have changed the world. Yet, would
they be qualified as excellent +++ according to modern criteria for
research proposals?
[1] I. Newton. De methodis serierum et Fluxionum. Manuscript, 1671.
[2] Albert Einstein. Ist die Trägheit eines Körpers von seinem Energieinhalt
abhängig? Annalen der Physik, 323(113):639–641, March 1905.
[3] A. Turing. On computable numbers, with an application to the Entschei-
dungsproblem. Proc. London Maths. Soc., 2(42):230–265, 1936.

6.5.4 Quick survey of BIBTEX

BIBTEX files are raw text files that can be edited using any text editor. When
editing them using TEXMACS, a few special rules apply that will be discussed
in section 6.5.5 below. But let us first survey the most important facts about
the BIBTEX format. For more details and special features of lesser interest for
ordinary users, we refer to [38, appendix B] and [16, chapter 13].

In fact, BIBTEX is really a program that takes a BIBTEX file and a list of citations
as input and produces the corresponding bibliography as output. Whenever
you edit BIBTEX files by hand, it is important to follow the BIBTEX syntax. Oth-
erwise, errors may occur when running BIBTEX and the resulting bibliography
might be badly formatted. Recall that TEXMACS contains its own replacement
for the BIBTEX program; to use this native replacement, your bibliography style
must be prefixed by tm-; otherwise, TEXMACS will run BIBTEX whenever it needs
to generate a bibliography.

A BIBTEX file consists of a list of BIBTEX entries, which are usually separated
by empty lines. Each entry consists of three main parts: a type specifier, an
identifying key, and a comma-separated list of data fields. The file should not
contain any “duplicate” entries with the same identifying key; indeed, any
references to such entries would be ambiguous. Each data field of an entry
consists of a field type and a value:
6.5 BIBLIOGRAPHIES 117

@Entry_type{key, @Book{Bor28,
field_type_1 = field_value_1, author = {\'E. Borel},
field_type_2 = field_value_2, title = {Le\c{c}ons sur les
... s\'eries divergentes},
field_type_n = field_value_n, publisher = {Gauthier-Villars},
} year = {1928}
}

The field values should be enclosed between curly brackets {val} or quotes
"val". The values themselves are in LATEX format, but a few additional rules
apply that will be discussed below. Notice that entry and field types are not
case-sensitive, contrary to the key and the field values.

BIBTEX supports a fixed set of entry types that are listed below. For each entry
type, there are three kinds of fields: required fields, optional fields and ignored
fields. For instance, the entry type Article requires you to specify the author,
title, journal, and year (otherwise, an error will occur and the resulting bib-
liography will probably be badly formatted). In addition, you may specify the
optional fields volume, number, pages, month, and note. Such optional fields
will also appear in the generated bibliography using an appropriate layout.
All other field types are ignored for the Article entry type, even though they
may contain interesting information such as an abstract, a hyperlink to the
paper, etc. BIBTEX entries that are downloaded from the web generally contain
several ignored fields that may be useful for bookkeeping or other purposes.

6.5.4.1 Entry types

BIBTEX supports the following standard entry types:

Article. An article in a journal or magazine. Required fields: author, title,


journal, year, volume. Optional fields: number, pages, month, note,
key.

Book. A book with an official publisher. Required fields: author or editor,


title, publisher, year. Optional fields: volume/number, series,
address, edition, month, note, key.

Booklet. A work that is printed and bound, but without any explicit pub-
lisher or sponsoring institution. Required field: title. Optional fields:
author, howpublished, address, month, year, note, key.

Conference. The same as Inproceedings.

Inbook. An untitled part of a book, such as a chapter, a section, or a range


of pages. Required fields: author/editor, title, chapter/pages,
publisher, year. Optional fields: volume/number, series, type,
address, edition, month, note, key.
118 CONNECTED DOCUMENTS

Incollection. A part of a book with its own title. Required fields: author,
title , booktitle, publisher , year . Optional fields: editor ,
volume/number, series, type, chapter, pages, address, edition,
month, note, key.

Inproceedings. An article in the proceedings of a conference. Required


fields: author, title, booktitle, year. Optional fields: editor,
volume/number, series, pages, address, month, organization,
publisher, note, key.

Manual. Technical documentation such as a user manual for a pro-


gram. Required field: title. Optional fields: author, organization,
address, edition, month, year, note, key.

Mastersthesis. A Master's thesis. Required fields: author, title, school,


year. Optional fields: type, address, month, note, key.

Misc. To be used when nothing else fits. No required fields. Optional fields:
author, title, howpublished, month, year, note, key.

Phdthesis. A Ph.D. thesis. Required fields: author, title, school, year.


Optional fields: type, address, month, note, key.

Proceedings. The proceedings of a conference. Required fields: title,


year. Optional fields: editor, volume/number, series, address,
month, publisher, organization, note, key.

Techreport. A report published by some institution, usually numbered


within a series. Required fields: author, title, institution, year.
Optional fields: type, number, address, month, note, key.

Unpublished. A document having an author and title, but not formally


published. Required fields: author, title, note. Optional fields: month,
year, key.

Unfortunately, BIBTEX has no special entry type for preprints. You may use
Unpublished, Techreport or Misc for this purpose, with the appropriate
information on how the preprint was published in the optional fields. In the
future, TEXMACS might support a few additional entry types for preprints and
modern kinds of electronic publications.

6.5.4.2 Field types


The required and optional field types for the standard BIBTEX entry types are
listed below:

address. Publisher's address, usually just the city, but possibly the full
address.
6.5 BIBLIOGRAPHIES 119

annote. An annotation for some less common annotated bibliography


styles.

author. The name(s) of the author(s).

booktitle. Title of the book, if only part of it is being cited.

chapter. Number of the chapter.

crossref. BIBTEX key of the cross-referenced entry.

edition. Edition of a book, in long form, such as “First” or “Second”.

editor. The name(s) of the editor(s).

howpublished. How the work was published.

institution. The institution that was involved in the publishing, but not
necessarily the publisher.

journal. The journal or magazine the work was published in.

key. A hidden field which specifies how to sort the entry in a bibliography.
Notice that this field is different from the entry's BIBTEX key that is used
for citations and cross-references.

month. The month of publication or creation.

note. Miscellaneous extra information such as the URL where to download


a preprint.

number. The “(issue) number” of a journal, magazine, or tech-report, if


applicable.

organization. The sponsor of a conference.

pages. Page numbers, separated either by commas or dashes.

publisher. The publisher's name.

school. The university or school where the thesis was written.

series. The series of books the book was published in, such as Astérisque or
Lecture Notes in Computer Science.

title. The title of the work.

type. The field overriding the default type of publication (e.g. “Preprint”
or “Research Note” for Techreport, “Habilitation” for Phdthesis, or
“Section” for Inbook/Incollection).

volume. The volume of a journal or multi-volume book.


120 CONNECTED DOCUMENTS

year. The year of publication or creation.

BIBTEX entries that were downloaded from the web often include other non-
standard fields such as a DOI or publisher-specific information. These fields
are ignored by the traditional BIBTEX styles, but can be useful for other biblio-
graphic software or non-standard styles. In the future, TEXMACS might provide
its own non-standard extensions of this kind.

6.5.4.3 Field values


Field values should be enclosed between curly brackets or quotes, as in
journal = {Annalen der Physik} or
journal = "Memoirs of the AMS"
Numbers do not require any brackets or quotes:
volume = 1234
We recall that field values are specified in LATEX format. In particular, accented
characters are entered as in LATEX:
author = { \'Emile Borel }
BIBTEX also follows a few special rules concerning names and titles.

Names. BIBTEX expects a name or a list of names for the values of author and
editor fields. You must use and as a separator when entering more than one
name:
author = {G. H. Hardy and E. M. Wright}
BIBTEX names consist of four parts: a first name, an optional “von” part, a last
name, and an optional Jr. part. Simple names without von-parts or suffixes can
be entered in two equivalent ways:
author = {Albert Einstein} or
author = {Einstein, Albert}
You are allowed to use abbreviations instead of first names:
author = {C. St. J. A. Nash-Williams} or
author = {Nash-Williams, C. St. J. A.}
BIBTEX recognizes “von” parts via the use of lowercase between an uppercase
first and last names:
author = {John von Neumann}
Unfortunately, the way these “von”-parts are handled by most BIBTEX styles is
far from satisfactory. For instance, in order to correctly sort the author of this
book in a bibliography, you must use
author = {Hoeven, Joris van der}
6.5 BIBLIOGRAPHIES 121

instead of
author = {Joris van der Hoeven}
Special suffixes such as Jr. or IV in “Henry IV” are entered as follows:
author = {Johnson, Jr., John}

Titles. BIBTEX styles may change the case of titles when appropriate. Titles
of books are usually capitalized, unlike those of articles. In BIBTEX, it is rec-
ommended to capitalize titles in the same way as in the original work. For
instance:
title = {Factoring Polynomials with
Rational Coefficients}
Inside an actual bibliography, this title is typically transformed as follows:
[LLL82] A.K. Lenstra, H.W. Lenstra, and L. Lovász. Factoring polynomials with rational
coefficients. Math. Ann., 261:515–534, 1982.

In order to prevent names of people or places to appear in lower case, you may
surround them by curly braces:
title = {An Algorithm for the Machine Calculation
of Complex {Fourier} Series}
Inside a bibliography, such a title might yield
[CT65] J.W. Cooley and J.W. Tukey. An algorithm for the machine calculation of
complex Fourier series. Math. Computat., 19:297–301, 1965.

The same mechanism applies to German nouns, which must always be capi-
talized.

6.5.5 Editing BIBTEX entries with TEXMACS


TEXMACS comes with an integrated editor for BIBTEX entries. This editor is
used by default when opening a BIBTEX file with the .bib extension. It is also
used for managing your personal bibliographic database. After enabling the
database tool using Tools „ Database tool, you may open your personal bib-
liographic database via Data „ Open bibliography. In that case, and as detailed
in section 6.5.6 below, the editor also provides tools for querying and mod-
ifying the database.
Assume that we have opened a BIBTEX file or a bibliographic database. Then
new items can easily be added using Insert „ Database entry. When creating
a new entry, required fields appear in dark blue, alternative fields in dark
green and optional fields in light blue. The special field inside the header of
your entry contains the identifying BIBTEX key that is used for citations. When
editing a field, you may use ↩ to confirm it and jump to the next one (empty
optional fields will automatically be removed when doing this). When the
cursor is inside a bibliographic entry, additional fields may also be inserted
using Focus „ Insert above and Focus „ Insert below.
122 CONNECTED DOCUMENTS

When editing BIBTEX entries in plain text format, we saw in section 6.5.4.3 that
various contortions were necessary for editing names and titles. Formulas also
need to be “encoded” using LATEX pseudo-code. These disadvantages disap-
pear when using the integrated editor, although a few new rules need to be
followed in order to get your entries right:

• When entering names (inside “author” or “editor” fields), use the


name tag for specifying last names (with Insert „ Last name or ⇧F6 ). For
example, “Albert Einstein” should be entered as “Albert EINSTEIN” or
as “A. EINSTEIN”. Special particles such as “von” can be entered using
Insert „ Particle. Title suffixes such as “Jr.” can be entered similarly using
Insert „ Title suffix. Finally, the , key is mapped to the name separator
“and”.

• When entering titles, do not capitalize, except for the first character and
names or concepts that always must be. For example, use “Riemannian
geometry” instead of “Riemannian Geometry” and “Differential Galois
theory” instead of “Differential Galois Theory”.

In addition, when pressing ↩ in an author or editor field for which you


forgot to “tag” the last name(s), TEXMACS automatically attempts to determine
all last names and insert the missing name tags. For instance, “G. H. Hardy
and E. M. Wright” is automatically transformed into “G. H. HARDY and
E. M. WRIGHT”. You can bypass this correction step by pressing ⇧↩
instead of ↩ .
While editing a bibliography, it is useful to keep in mind that external BIBTEX
entries can easily be imported: it suffices to copy them using the mouse and
then paste them into the editor using Edit „ Paste from „ BibTeX. Similarly, you
may copy BIBTEX entries inside the editor using Edit „ Copy to „ BibTeX and then
paste them into other programs.
When using TEXMACS for editing existing BIBTEX files, it is also useful to know
that TEXMACS attempts to minimize the number of changes that are made when
re-exporting or re-importing a file after some modifications. For example, only
modified entries will be altered on disk when saving a modified file. This
default behavior can be overridden via Edit „ Preferences „ Convert „ BibTeX.

6.5.6 Managing your personal bibliographic database


TEXMACS contains an integrated database tool that allows you to maintain a
shared bibliographic database for all your documents. The tool offers various
advantages:

• It is easy to search for specific information in the database and cus-


tomize how matching items should be sorted and displayed.

• When a colleague sends you a file with embedded data, it is possible to


automatically import the data into your personal database.
6.5 BIBLIOGRAPHIES 123

• The database tool maintains the full history of all data, while keeping
track of the persons behind changes. This is useful for the resolution of
conflicts when importing data from a file sent by a colleague.
We recall that the database tool can be enabled using Tools „ Database tool.

6.5.6.1 Searching and rendering of entries in the database


Your personal bibliographic database can be opened using Data „ Open bibliog-
raphy. The database usually contains many entries, so only a limited number
of entries are shown. The precise entries that should be shown and the precise
way in which they should be rendered can be specified on the database toolbar
at the bottom of your window:
• The Search field allows you to search for particular entries. The search
text should be a list of words separated by spaces. A database entry
matches whenever each word occurs in the entry. Occurrences may be
anywhere: in the name, in the title, in the name of the journal, or even
in invisible fields such as the contributor of the database entry.
• The Order fields allows you specify the name of field on which the entries
will be sorted. The little icon or next to this field indicate whether
entries should be sorted in ascending or descending order.
• The Limit field specifies the number of matches that should be displayed.
When using a large number such as 1000, beware that this may slow
down the editor.
• The rightmost item on the database toolbar allows you to specify the
rendering: Detailed is the default rendering used for editing the entries,
Folded only shows the main information about the entries, and Pretty
uses a typical rendering for print. When using a folded or pretty ren-
dering you may switch to a detailed rendering by clicking on the entry;
this will allow you to edit it.

6.5.6.2 Insertion and removal of entries


Visible database entries (depending on your search and display options) can
directly be edited as described in section 6.4.2. New entries can be inserted
using Data „ New entry and then edited in the same way. Note that modified
or newly entered entries remain visible even if they do not correspond to your
search criteria: the search filter is only applied when you explicitly modify one
of the search or rendering options.
Once you have finished typing an entry, it can be inserted into your personal
database using ⌥↩ , , or Data „ Confirm entry. If all fields of an entry have been
filled out, then pressing ↩ in the last field will have the same effect. A selection
of several entries can be simultaneously inserted using the same keystroke,
⌥↩ . Saving the document using File „ Save amounts to confirming all currently
visible entries.
124 CONNECTED DOCUMENTS

Existing entries can be removed using ⌥⌫ , , or Data „ Remove entry. This


either applies to a selection of entries or to the current entry that contains your
cursor. Note that “cutting” one or more entries in the editor will not have the
same effect: this will just make them invisible, but not remove them from the
database.

6.5.6.3 Importing and exporting entries


Entries from an external BIBTEX file or from another database can be imported
into your personal database. Assuming that you opened your personal biblio-
graphic database using Data „ Open bibliography, external files can be imported
using Data „ Import. If you are rather editing an external BIBTEX file or another
database, then you may incorporate entries into your personal bibliographic
database using Data „ Import entries in buffer. It is also possible to import the
entry that contains your cursor using Insert „ Import entry or . More gener-
ally, you can import a selection of entries using Data „ Import selected entries,
Insert „ Import selected entries, or .

Conversely, the bibliographic entries in your personal database can be exported


to a BIBTEX file: assuming that you opened your personal bibliographic data-
base using Data „ Open bibliography, this is done using Data „ Export. In order
to export a selection of entries, you may use Data „ Export selected entries. We
also remind you of the possibility to copy a selection to the clipboard in BIBTEX
format using Edit „ Copy to „ BibTeX.
Note that the precise location where your personal database is stored can be
customized using Data „ Storage. Whenever convenient, this also allows you to
switch between several databases.

6.5.6.4 Versioning
The database keeps track of the full history of all entries. As in the case of
popular versioning tools such as SVN or GIT, the history includes information
about the dates when modifications were made and by whom.
Every entry in the database also keeps a record of all previous versions of the
entry. This is useful in the following scenario: you send an entry to a colleague,
who modifies it, and sends it back. When importing the modified entry, the
datatool automatically recognizes that it is a newer version of an existing entry.
However, if you modified the entry as well in the meantime, then your per-
sonal modification will be preferred.
The above mechanism applies automatically when a colleague sends you file
that contains a bibliography: TEXMACS will attempt to enrich your personal
database with all the bibliographic entries that it can find in the file. If you
do not like this feature and wish to retain more manual control, then you can
disable it in Data „ Preferences. In that case, importations have to be done man-
ually, as described in section 6.5.6.3.
6.6 LARGE DOCUMENTS 125

6.5.7 Local bibliographies


Most of the time, it is a good idea to maintain a global database with up-to-
date bibliographic entries, while possibly sharing this information with your
colleagues. However, for the final version of a paper, it may happen that some
twiddling is necessary that is specific to the paper. In that case, you may want
to change some of the bibliographic entries, without integrating them into your
personal database (or to the database of any of your colleagues). For this partic-
ular situation, TEXMACS makes it possible to use a local bibliographic database
that is attached to your document.
Assuming that your document indeed contains a bibliography, the local data-
base is opened using Document „ Bibliography. By default, this database is
maintained automatically: it contains all bibliographic entries that were needed
for the compilation of your bibliography and that were fetched from your
personal database or a specified BIBTEX file. Now you can edit the local bib-
liography in a similar way as a BIBTEX file. If you save your modifications, then
TEXMACS determines all entries that were changed; these entries will be marked
as “local” and they cease to be maintained automatically. Your local changes
will be taken into account when recompiling the bibliography, but they will
not be imported automatically into your global database when reopening your
document. Of course, it remains possible to manually import entries from
a local bibliography into your global database using Insert „ Import entry or .

6.5.8 Multiple bibliographies


In a thick book or collection of papers, you may want to include a separate bibli-
ography for each chapter or paper, together or not with one for the entire book.
Multiple bibliographies can be generated in a similar way as multiple tables
of contents or multiple indexes (see section 6.4.5): each bibliography is given
its own identifier, the default one being bib. Using Insert „ Link „ Alternate „
Bibliography, you may next specify which bibliography to use when inserting
citations or the bibliography itself.

6.6 Large documents


When writing really large documents such as books or PhD theses, there exist
several good reasons for breaking up your work into smaller parts. First of all,
the editor may become slow on large documents and editing an entire book in
a single window may not be that convenient anyway. Secondly, if your book
is the fruit of a collaboration, then it is important that all coauthors can work
independently and concurrently on different chapters.
The recommended way to prepare a book with TEXMACS is to first create
a master project file that will contain the entire book, say mybook.tm. You
should use Tools „ Project „ Use as master in order to declare this file to be
the master. The master typically consists of title information, automatically
generated content (the table of contents, a bibliography, etc.), and links to the
individual chapters.
126 CONNECTED DOCUMENTS

mybook.tm c1.tm c2.tm

Title
Table of contents
⋅⋅⋅
Include c1.tm
Include c2.tm
⋅⋅

Bibliography

Attached

Figure 6.6. Schematic representation of a book project with a master and individual chap-
ters.

You should also enable paper mode (Document „ Page „ Format „ Page rendering „
paper) in order to get the page numbers right when updating the document.
Notice that the project file is rarely edited itself: this only happens when you
modify the main structure of the book, e.g. by adding a new chapter. The main
book style and other global layout properties should also be specified in the
master file.
Now assume that we have a separate file c2.tm with a chapter that we wish
to include in the book. Then you should first include the chapter at the appro-
priate place in the master file using Insert „ Link „ Include. In the chapter file
itself, you also have to attach the chapter to its master, using Tools „ Project „
Attach master. If all this is done correctly, then the master file and the indi-
vidual chapter files should be accessible through the top-level Project menu.
Tables of contents, bibliographies, etc. can directly be inserted into the master
file in the usual way. See Figure 6.6 for a summary.
Since the actual editing is done in the chapter files, it is most convenient to
select papyrus mode (Document „ Page „ Format „ Page rendering „ papyrus) for
them. For consistency, you may still wish to use the same book style and global
layout properties as for the master file, although this is not mandatory.
Page numbers, chapter numbers, bibliographic citations, and cross references
between different sections are taken care of by TEXMACS in a semi-automatic
way: from time to time, you need to update the master file in order to get all
numbers and further references right. It is recommended that you save the
master file after such updates; this ensures that references remain up to date
after closing the editor and re-opening one of the chapters. For the compu-
tation of page numbers, it is also important to enable the paper mode for the
master file. Whenever you modify the main book structure, some individual
chapters occasionally may need to be updated as well.
Chapter 7
Advanced layout facilities

Typographic style is a complex topic that we cannot hope to cover in a single


section or chapter of this book. One of the bibles on the subject is Bringhurst's
The Elements of Typographic Style [4]. Lawson's Anatomy of a Typeface [40] focusses
more specifically on fonts.

It the first section, we describe a few general principles that may be useful to
keep in mind when working on the layout of your document. In the remainder
of the chapter, we continue with a description of some of the more advanced
layout features inside TEXMACS that can be used to put these principles into prac-
tice.

7.1 General style considerations

Purpose

Whenever you are inclined to use a special style for some portion of text, rule
number one is to ask yourself the question “Why?” The more conscious you
are of the precise purpose of a style element, the more likely you will opt for a
graphical presentation that correctly conveys its intent. Take for instance the
graphical interface elements “menu” and “keyboard shortcut” in this book.
Their purpose is to make it immediately clear for the reader that File „ Open
corresponds to a TEXMACS menu entry and - - > to a series of keystrokes. In
this case, we chose a presentation that mimics physical appearance: the font
for the menus is the same as the menu font inside the editor and the little boxes
around the keystrokes remind of the keys on your keyboard.

Part of these considerations can be aesthetic: alternate fonts are often chosen
for their contrast with the main font. This is why we chose a sans serif font
for the section titles in this book. For the main font, we preferred the more
recreational TEX Gyre Pagella font (a variant of PALATINO) over the more well-
known but sterner Computer Modern Roman and Stix fonts.

Uniformity

Another important rule is to stick to your own design decisions. For example,
if you decide to use an italic font for important text, then you should do so

127
128 ADVANCED LAYOUT FACILITIES

throughout your document: nothing is more confusing for the reader than sud-
denly switching to a bold font for no apparent reason.

By its very design, TEXMACS makes it easy to achieve uniformity: the most
common style elements are directly available through the interface and their
rendering can be customized when needed. The macro system also allows to
add new style elements of your own. Still, even though the interface invites
you to use appropriate markup in a systematic way, you should not forget
to do so!

Minimality

A design principle that is related to the two above ones is “minimality”: do


not use more style elements than needed and only use alternate fonts for well-
identified purposes. Some advertisers love to “impress” people through the
use of an overwhelming number of flashy fonts, but most of the time this is just
a confusing distraction from the main message, even in the case of commercial
adds (successful businesses such as APPLE and GOOGLE tend to favor a mini-
malistic design).

When introducing new style elements using the macro system, it is also recom-
mended to introduce new macros only if you really need them. In a botanical
guide, it would in principle be possible to introduce separate macros for the
names of mosses, flowers, conifers, and cycads. But would this really be a good
idea? Maybe so, if they require four different renderings; otherwise, a single
macro “name” or “plant” should suffice.

Standard conventions

It is good practice to learn common typographic and linguistic conventions.


Standard references on these topics are [4, 31, 5]. Notice that conventions
depend on the language you are writing in. For example, the characters : ;
! ? are preceded by whitespace in French [17], but not in English.

It is recommended to always follow standard conventions unless you have


a good reason to ignore them: bad spelling or typography may lead to mis-
understandings or irritate your reader. Unfortunately, some conventions are
quite arbitrary (the English metric system) or even defy common logical sense:
in this “quote,” the comma is inside the quote (following standard English
conventions7.1), even though it is not part of the quote, strictly speaking. Don't
hesitate to break flawed rules: standards might ultimately follow your lead [46].

7.1. The convention is due to the observation that “comma,” looks a bit nicer than “comma”, typo-
graphically speaking. As a compromise, we suggest to put the “comma”, outside the quote, but to
precede it by negative whitespace.
7.1 GENERAL STYLE CONSIDERATIONS 129

Specialization

General conventions may also need to be overruled in specific circumstances.


For instance, in ordinary literary books, it is best to use a fixed vertical spacing
between lines. In the case that a single line of a paragraph does not fit on a page
(an orphan), one often moves an additional line to the next page. This results
in a shorter page, but having such a shorter page is considered a lesser evil
than a slight increase of the vertical space between all lines on the page (so
as to keep a fixed page height). But now consider the case of a mathemat-
ical book: it is likely to contain many formulas of wildly varying heights. This
makes it unrealistic to require a rigid interline space. In this particular case,
it therefore makes sense to use a slightly stretchable interline space, and strive
for a fixed page height.

Specific contexts may also call for the temporary suspension of general rules.
For example, modern bibliographies often contain hyperlinks that are hard to
break. It is therefore wise to somewhat relax the rules for line breaking inside
bibliographies. A similar remark applies for the output formulas in computer
algebra sessions.

Looking for the right feature

As soon as you identified a style element that should serve a certain purpose,
you have to start thinking about the best way to render this element. If you
are lucky, then TEXMACS already contains a markup element that does precisely
what you want. Otherwise, you should search hard for the appropriate fea-
tures in TEXMACS that allow you to achieve the desired effect in a systematic
and automated manner. This chapter describes several of the finer tricks that
you may find useful.

A similar remark applies to the global layout of your document: if you need
a particular design, then it is a good practice to always search for an existing
TEXMACS style that comes close to what you want. At a second stage, you may
select additional style packages or customize some of the macros. If you decide
to change major parameters such as the page size or margins, then it may be
useful to be aware of proportions that are particularly pleasant to the eye. We
refer to [4, chapters 2 and 8] for more information.

Trade-offs

There is often a trade-off between various design goals. For example, alter-
nate fonts should typically be sufficiently similar to the main font (in order
to “mix” well), but also sufficiently distinctive (in order to avoid confusions).
A similar issue came up in the present book: it is natural to use specific markup
for various purposes: important concepts, menus, keyboard shortcuts, source
code, TEXMACS markup, names of TEXMACS styles or environment variables, etc.
130 ADVANCED LAYOUT FACILITIES

However, one quickly runs out of the available fonts if one insists on having
a different rendering for each of these style elements. When facing these kinds
of dilemmas, it is often impossible to find a completely satisfactory solution,
and one is condemned to opt for the lesser evil. Yet, the general rules that we
described so far may act as a guide.

Automatic versus hand-crafted

Typography is an “art” that has been developed ever since the invention of
printing. Although computer programs have become pretty good typogra-
phers, machines do not always manage to keep up with human competition.

The first reason for this is that the implementation of high quality typesetting
algorithms requires a lot of effort. Besides the fact that only few developers are
willing to make this investment, it is not always clear how to mimic traditional
human skills. Although TEXMACS attempts to keep pace with state-of-the-art
technology, a lot progress can and probably will be made in the future.

Secondly, some of the finer details are a matter of taste and may depend on the
actual content or purpose of a document. The typesetting process in particular
depends on many parameters. Although default values can be implemented
that work reasonably well on the average, you may wish to override these
settings for particular purposes (recall the above discussion about “specializa-
tion”). For this, it is important to understand the typographic challenge that
such a parameter was meant to address.

Personal taste

In the end, your preferred layout of documents remains a highly subjective


matter. The above considerations are meant as a first step to sharpen your taste
and make you more conscious of the reasons why you prefer certain things.
We have already mentioned a few reasons behind our own design choices in
this book. Let us end with one more example.

You may have noticed that we chose to separate distinct paragraphs by vertical
whitespace. In many books, the first lines of paragraphs are rather indented.
Why did we prefer the first option? By its very nature, this book contains
a wide variety of markup elements and figures. This causes a lot of “disorder”
that would be further aggravated by indenting the first lines of paragraphs.

7.2 Line breaking

One of the most delicate tasks of the typesetter is to break paragraphs into
successive lines. The line breaking problem is most difficult for narrow para-
7.2 LINE BREAKING 131

graphs that you can see in newspapers or magazines. Whenever a long word
does not fit on a line, moving it to the next line typically requires the insertion
of a lot of whitespace. If a paragraph is justified, then this leads to annoy-
ingly large spaces between words. Professional typesetters use a combination
of techniques to deal with this problem:

• Through the use of high quality line breaking algorithms.

• By hyphenating certain words.

• Through the manual specification of good or bad break points.

• By adjusting the spacing between individual characters using microty-


pography.

Let us now describe these techniques in more detail.

7.2.1 The first-fit versus the global method

The simplest method to break lines is the so-called “first fit” algorithm. It
processes the lines one by one and simply finds the best possible break for each
line. One important drawback of this algorithm is that a much better break
can sometimes be obtained for a given line by using a non-optimal break on
one of the previous lines.

By default, TEXMACS therefore uses a so-called “global” line breaking algorithm,


that takes into account all possible ways to break a paragraph into succes-
sive lines, and then selects the solution that minimizes ugly breaks among all
these possibilities. One minor disadvantage of this method is that the line-
breaking of a paragraph may radically change while you are typing. In par-
ticular, typing new words at the end of a paragraph may alter the line breaks
at the start. If you find this annoying, then you may wish to opt for the first-
fit algorithm.

The algorithm that TEXMACS uses for line breaking can be specified in Docu-
ment „ Paragraph „ Line breaking: the global method corresponds to professional,
and the first fit strategy to normal.

7.2.2 Hyphenation

As soon as the typesetter is unable to find suitable breaks between words, it


will attempt to hyphenate the words themselves. The permitted hyphenations
strongly differ from one language to another. For this reason, it is important
132 ADVANCED LAYOUT FACILITIES

to always specify the correct language for your documents in Document „ Lan-
guage. If you need to combine text written in more than one language, then
you may locally change the language using Insert „ Language.

It is hard to fully automate hyphenation. Some English words such as “record”


may even admit different hyphenations depending on their meaning: please
re-cord this world rec-ord. In science, it is also common to invent new words
such as “transserial” or “exoplanetary”, for which standard hyphenation pat-
terns might lead to incorrect results. It is always possible to manually override
the way a word should be hyphenated: select the word using the mouse, click
on Format „ Hyphenate as, and, at the prompt, insert “-” characters at those
places where you wish to allow for hyphenations.

Ordinary words are hyphenated using “-”. Inside verbatim text, words may
also be hyphenated after slashes; this is useful for long hyperlinks in the ref-
erences. Long numbers are hyphenated using backslashes, as in the following
example:

Pari] 200!
%1 = 7886578673647905035523632139321850622951359776871732632947425\
3324435944996340334292030428401198462390417721213891963883025764279\
0242637105061926624952829931113462857270763317237396988943922445621\
4516642402540332918641312274282948532775242424075739032403212574055\
7956866022603190417032406235170085879617892222278962370389737472000\
0000000000000000000000000000000000000000000000

7.2.3 Manual line breaking

If, for some reason, you don't like a particular line break, then you may man-
ually override it. This can be done in two ways: by specifying suitable breaks
or by forbidding bad breaks.

Suitable breaks can be forced explicitly using Format „ Break „ Line break. If para-
graphs are justified, then explicit breaks will appear at the right-hand border.
Alternatively, you may insert “new lines” using Format „ Break „ New line. This
causes the typesetter to start a new line without stretching the current line to
its right border: see Figure 7.1.

You may explicitly forbid a break using Format „ Break „ No line break. Such
prohibitions are most frequent around spaces. For this reason, TEXMACS also
provides so-called “non-breaking spaces”, which can be inserted using ␣ ⇥ .
For instance, it is recommended to systematically precede theorem and
equation numbers by non-breaking spaces, as in Theorem 123 and Equa-
tion (1.2.3). Besides non-breaking spaces, it is also possible to insert “non-
breaking hyphens”, using - ⇥ .
7.2 LINE BREAKING 133

TEXMACS also provides a way to forbid line breaking altogether inside a given
region of text: just select the “unbreakable text” and apply Format „ Break „
Group „ Horizontal. This mechanism may in particular serve to disable line
breaking inside subexpressions of mathematical formulas.
One disadvantage of explicit line breaks is that they tend to provoke disaster
whenever you make further changes in a paragraph. Indeed, a perfect explicit
break near the end of a line may suddenly find itself at the start of the next line,
thereby causing it to be filled with whitespace. By contrast, explicit prohibi-
tions at inappropriate places will simply be ignored. Unless you are preparing
the very final version of a document, explicit line breaks should therefore be
avoided.

Here comes a break Here comes a break


inserted using Format „ inserted using Format „
Break „ Line break. Break „ New line.

Figure 7.1. Difference between a “line break” and a “new line”.

7.2.4 Microtypography

The term microtypography designates a range of methods for improving the


readability and appearance of text [59]. The prefix “micro” stems from the
fact that we allow ourselves to alter the spacing and even shapes of individual
characters to reach this goal. One of the chief goals of microtypography is
to improve the justification when paragraphs need to be broken into several
lines.
One microtypographic trick that is used by TEXMACS is called tracking. The
idea is to slightly increase the spacing between individual characters in order
to reduce the amount of whitespace between words. The maximal stretching
factor can be specified via Format „ Paragraph „ Advanced „ Intercharacter
stretching. A value of 0.05 allows for a maximal increase of the width of each
character by 5%; larger values are generally not recommended. Tracking is
not only supported for individual words, but also for subexpressions inside
mathematical formulas, as in the following computer algebra output:

(%i1) expand ((1/2! * a + 1/6! * b + 1/8! * c)^5)


c5 b c4
(%o1) + +
106562062388507443200000 380578794244669440000
ac 4
b c
2 3
abc 3
+ + +
1057163317346304000 3398024948613120000 4719479095296000
a2 c3 b 3 c2 a b 2 c2 a2 b c2
+ + + +
26219328307200 60679016939520000 56184274944000 156067430400
a3 c2 b4 c a b3 c a2 b 2 c
+ + + +
1300561920 2167107747840000 1504935936000 2786918400
134 ADVANCED LAYOUT FACILITIES

a3 b c a4 c b5 a b4 a2 b 3
+ + + + +
11612160 129024 193491763200000 107495424000 149299200
a3 b 2 a4 b a5
+ +
414720 2304 32

Another technique is to stretch individual glyphs. On the one hand, glyph expan-
sion allows for a further reduction of the amount of whitespace between indi-
vidual words by increasing the widths of the glyphs. On the other hand, glyph
contraction may also allow you to fit an extra word on a line via a decrease of the
widths. Traditional typographers even did better by using special extended or
condensed fonts for these purposes; such fonts are more elegant in combina-
tion with the main font than machine generated imitations through mathemat-
ical transformations.

Default line breaking First-fit line breaking Right ragged


Long paragraphs inside Long paragraphs inside Long paragraphs inside
tiny columns are not tiny columns are not so tiny columns are not
so easy to break, espe- easy to break, especially so easy to break, espe-
cially in the presence of in the presence of cially in the presence of
ridiculously long words ridiculously long words ridiculously long words
such as floccinaucini- such as floccinaucini- such as floccinaucini-
hilipilification or the hilipilification or the hilipilification or the
venerable antidisestab- venerable antidisestab- venerable antidisestab-
lishmentarianism. Yet, lishmentarianism. Yet, lishmentarianism. Yet,
anyone who intends anyone who intends to anyone who intends
to start a mathematical start a mathematical to start a mathematical
newspaper will crucially newspaper will crucially newspaper will crucially
need a good solution. need a good solution. need a good solution.

Intercharacter stretch of 0.05 Intercharacter stretch of 0.2 Margin kerning


Long paragraphs inside Long paragraphs inside Long paragraphs inside
tiny columns are not tiny columns are not tiny columns are not
so easy to break, espe- so easy to break, espe- so easy to break, espe-
cially in the presence of cially in the presence of cially in the presence of
ridiculously long words ridiculously long words ridiculously long words
such as floccinaucini- such as floccinaucini- such as floccinaucini-
hilipilification or the hilipilification or the hilipilification or the
venerable antidisestab- venerable antidisestab- venerable antidisestab-
lishmentarianism. Yet, lishmentarianism. Yet, lishmentarianism. Yet,
anyone who intends anyone w ho intends anyone who intends
to start a mathematical to start a mathematical to start a mathematical
newspaper will crucially newspaper will crucially newspaper will crucially
need a good solution. need a good solution. need a good solution.

Figure 7.2. Examples of various line breaking styles.


7.3 PAGE BREAKING 135

The glyph expansion and contraction factors can be controlled using Format „
Paragraph „ Advanced „ Character expansion and Character contraction. Manual
horizontal magnification of fonts is also possible via Format „ Font effects „ Mag-
nify horizontally. It is recommended to use a magnification factor between 0.95
and 1.05 if you wish to simulate glyph expansion. TEXMACS finally imple-
ments the emulation of extended and condensed fonts in a way that preserves
the stroke width: Format „ Font effects „ Extended and Condensed.

Besides the above strategies for avoiding large whitespaces, TEXMACS also sup-
ports protrusion, which is equally known under the names margin kerning or
hanging punctuation. This mechanism aims at aligning the left and right mar-
gins of the text in an optical manner, rather than rigidly fitting all text between
two imaginary lines. Protrusion was first used in the very Gutenberg bible.
You may enable it via Format „ Paragraph „ Advanced „ Use margin kerning.

7.3 Page breaking

After cutting your text into pieces that fit on successive lines, the typesetter
moves on to page breaking and the assembly of the final pages of your docu-
ment. Page breaking is similar to line breaking, with similar bells and whistles
for controlling the process.

Again, TEXMACS implements both a first-fit and a global algorithm for page
breaking, which can be selected via Document „ Page „ Breaking „ Page breaking
algorithm „ sloppy and professional. The global algorithm is used by default,
but there are two main reasons why you may sometimes prefer the lower
quality algorithm. First of all, when preparing the final version of a document,
it is convenient to perform one last pass in order to correct suboptimal page
breaks. The problem with global page breaking is that any corrections on later
pages may cause earlier pages to be broken differently. Consequently, mul-
tiple passes may be necessary before all breaks will be to your satisfaction.

We also note that the global page breaking algorithm is more complex and
therefore more time consuming. The algorithm may become particularly slow
in the case of long documents that use a multiple column layout. When editing
such documents in “paper mode”, this causes the editor to become less respon-
sive. With single column layouts, a similar slowdown only occurs for very
long documents.

There are a few global style variables that influence precisely how page
breaking is done. In Document „ Page „ Breaking „ Allowed page height reduction
and Allowed page height extension, you may specify the amounts of space by
which the default page height may be reduced or extended if no suitable break
can be found. “Vertical space stretchability” specifies a multiplier for stretch-
able spaces. We recall that several vertical spaces are stretchable, in the sense
136 ADVANCED LAYOUT FACILITIES

that they may be increased if a page isn't full enough, or decreased when it
is too full. For example, the whitespace around section titles, displayed for-
mulas, and theorems is very elastic. The interparagraph and interline spaces
are also stretchable, but to a lesser extent. When specifying a multiplier dif-
ferent from one for the Vertical space stretchability, you may further increase
or decrease the elasticity of stretchable spaces.

As in the case of line breaking, you may force or forbid page breaks at specific
points in the document. Such directives are indicated through markers. You
may also specify whether you wish the directive to take effect before or after
the line where the marker occurs. For instance, when doing Format „ Break „
Page break after „ New page, a marker is inserted in the text and a new page
is started right after the line with the marker. Similarly, Format „ Break „ Page
break before „ New double page starts a new page just before the line with the
marker, and inserts one extra page if necessary in order to make sure that the
new page appears at the right-hand side. This feature is useful when starting
a new chapter in a book.

We recall that it is usually better to forbid bad page breaks rather than explic-
itly enforcing good ones. In order to prevent one specific bad break, you may
use Format „ Break „ Page break before „ No page break or Page break after „ No
page break. You may also forbid any page breaks to occur in a specified region
of text using Format „ Break „ Group „ Vertical.

7.4 Multiple text flows

Simple documents contain a single text flow that is formatted into lines and
pages by the typesetter. More complex documents often include footnotes,
marginal notes, and floating figures or tables, that are interleaved with the
main text in non-linear ways. In particular, each note and each floating object
comes with its own text flow that is typeset independently, before being com-
bined with the main text.

Note that footnotes and floating objects are mainly useful for documents that
are intended to be readable on paper. In order to see where your notes will
appear in the printed document, you must select a page rendering mode that
shows the individual pages (using Document „ Page „ Page rendering „ paper; see
section 3.10).

In Figure 7.3, we have shown an example of two pages in a book that contain
two footnotes, a marginal note, a floating figure, as well as a floating table.
Each of these objects is “anchored” in the main text flow. In the case of a foot-
note, the anchor is displayed in the form of a numeric superscript or a symbol
such as †, ‡, etc. The anchors of marginal notes and floating objects are invis-
ible on paper and indicated through “informative flags” on the screen. The
7.4 MULTIPLE TEXT FLOWS 137

Header Header

Main text flow continued

Floating figure Marginal


note

Main text flow

Footnote 1

Footnote 2 Floating table

Figure 7.3. Two pages with notes and floats in a book.

anchors indicate on which page and at which position the notes or floating
objects should be displayed.

The amount of whitespace between the main text flow and headers, footnotes,
floating objects, etc. is controlled by style parameters. For instance, if the cursor
is inside a marginal note, then the Focus „ Preferences menu (or, equivalently,
the menu on the focus toolbar) allows you to specify its width and the dis-
tance between the main text and the note.

7.4.1 Footnotes and marginal notes

Footnotes are started using Insert „ Note „ Footnote. They are numbered and you
may jump between the main text and the footnote by clicking on their numbers
or on the icon. The style preferences in the Focus „ Preferences menu allow
you to control the length of the separating footnote bar (Page fnote barlen), the
amount of whitespace that separates footnotes from the main text (Page fnote
sep), as well as the space between successive footnotes (Footnote sep). Notice
that page breaking inside footnotes has not been implemented yet, whence
footnotes are assumed to fit on a single page.
138 ADVANCED LAYOUT FACILITIES

Warning. Basic footnotes only work inside the


ordinary flow of text. If you want to put a foot-
note inside a table or other special markup, First cell7.2 Second cell
then you should use Insert „ Link „ Text for note Third cell Last cell7.3
and Reference to note. These menu items allow 7.2. Text for the first footnote.
you to place the footnote and the corresponding
7.3. Text for the second footnote.
reference to the footnote anywhere in the text,
I am the as shown in the example on the right.
living
example of Marginal notes are inserted using Insert „ Note „ Marginal note. They are similar
a marginal to footnotes, except that they appear more prominently in the margins beside
note.
the main text, although their width is very limited. By default, when editing a
document, TEXMACS reduces its margins on the screen with respect to the paper
version. This is convenient if you want to make full use of your screen, but
a nuisance in the presence of marginal notes. If you are using this feature, then
it is recommended to set Same screen margins as on paper in Document „ Page „
Margins. The style parameters of marginal notes specify their width (Focus „
Preferences „ Marginal note width) and the separation space with respect to the
annotated text (Marginal note sep).

The precise position of a marginal note can be controlled via the focus menu
or toolbar. Its vertical alignment with respect to the anchor can be either Top,
Center, or Bottom. Concerning the horizontal alignment, one may force place-
ments in the Left or Right margin, or make this decision depend on the parity
of the page number. If the left and right margins are different on left and
right pages (as in Figure 7.3), then TEXMACS places marginal notes in the largest
margin by default.

7.4.2 Floating figures and tables

Large objects such as figures and tables are often “indivisible” in the sense
that they cannot be cut into several pieces by the page breaker. This causes
a problem whenever the natural end of a page occurs in the middle of such
a figure or table: the object does not fit on the page, but moving it to the next
page will leave an unacceptably large amount of whitespace. One remedy is
to manually move all large objects in a document to places that lead to appro-
priate page breaks. However, any subsequent modifications in the document
may ruin this effort. A better solution is to let the typesetter take care of the
problem by tagging the figure or table to be a floating object.

You may insert a floating figure, table, or algorithm using Insert „ Note „ Floating
figure, Floating table, resp. Insert „ Note „ Floating algorithm. More generally,
you may use Insert „ Note „ Floating object in order to create a floating object
with arbitrary content. Existing figures, tables, and algorithms can also be
turned into floating objects a posteriori by clicking on the icon or Focus „
Make floating.
7.5 FINISHING TOUCHES 139

Whenever you allow an object to float, the page breaker may freely move it to
the top or bottom of the page, and even to the next page. Nevertheless, floating
objects always appear in the same order as their anchors in the main text flow.
The precise positions to which floating is allowed can be specified using Focus „
Allowed positions or . The style parameter that controls the amount of white-
space between floating objects and the main text can be changed using Focus „
Preferences „ Page float sep.
When you are editing a floating object, you may jump to the corresponding
anchor by clicking on the icon or Focus „ Go to anchor. Conversely, if your
cursor is just after the anchor, then clicking on one of these buttons will posi-
tion your cursor at the start of the floating object. Note that page breaking
inside floating objects has not been implemented yet. This means that floating
objects should always fit on a single page.

7.4.3 Multiple columns


Publishers often use multiple column styles as an elegant way to reduce the
paper footprint of publications. TEXMACS allows you to specify the number of
columns both for an entire document or for a selected region of text, respec-
tively using Document „ Paragraph „ Number of columns and Format „ Paragraph „
Number of columns. Two column layouts are the default for several standard
document styles such as acmconf and ifac. The separation space between
columns can be specified using Document „ Paragraph „ Column separation.
The typesetter attempts to balance the heights of adjacent columns as much as
possible. For long columns from the top to the bottom of a page, this is done
much in the same way as ordinary page breaking. The effect of height bal-
ancing is most visible on the last page or when varying the number of columns
on the same page.
In multiple column formats, footnotes appear at the bottom of the column
(instead of at the bottom of the page). Similarly, the typesetter prefers to move
floating objects to the top or to the bottom of the same column.
On certain occasions, you may wish to select a different number of columns for
the footnote or for the floating object. TEXMACS only knows how to do that for
single column footnotes and floating objects, by selecting the anchor, opening
Format „ Paragraph, and setting Number of columns „ 1. Wide footnotes and
floats that are created in this manner always appear at the top or at the bottom
of the page.

7.5 Finishing touches


During the preparation of the final version of a document, you may wish to
address some of the more minor typesetting details. We already explained
quite extensively how to control the line and page breaking mechanisms. It
is also possible to adjust the horizontal and vertical spacing, or to tweak the
extents of some formulas.
140 ADVANCED LAYOUT FACILITIES

Most finishing touches are of a very visual nature; they typically correct a few
remaining problems that keep hurting your eye. As such, the adjustments may
crucially depend on particular line or page breaks, or the font that you use.
This also means that any further change in the document has the potential of
wrecking your work. For instance, assume that you inserted negative spaces
into a formula so as to make it fit on a line. If a subsequent change in the para-
graph results in removing a word from this same line, then it could become
“underfull” instead of “overfull”, and your negative spaces will do more harm
than good.
For this reason, it is recommended to perform the final fine-tuning only at the
very, very end. It is also worth it to invest a little thinking in how to make
the adjustments. For example, if some specific page break does not suit you,
then you have two options: preventing this break, or forcing a break at a more
appropriate place. The second option may cause disaster if you insert new
material on the previous pages: the forced break might very well migrate to the
top of a page. Preventing ugly page breaks is the more robust solution: a bad
break is likely to remain bad even after modifications earlier in the document.
Another example concerns fine-tuning the position of a subscript in a formula
such as Γa. Indeed, this formula looks better if the a is moved slightly to the
left, yielding Γa. If you use an absolute length such as 1 mm for this kind of
repositioning, then the formula will not look as good whenever you switch
to a different font size, or copy and paste it inside another subscript or super-
Γa
script: Γa + e Γa + e e . This problem can be avoided by using a length unit that
Γa
is proportional to the font size, such as em: Γa + e Γa + e e .
Due to evolutions inside TEXMACS, we notice that this kind of fine-tuning may
occasionally lead to incorrect results when re-opening an adjusted document
with a newer version of the editor. For example, the current version of TEXMACS
produces Γa on our original example formula and Γa when applying exactly
the same adjustments as above. This is one side-effect of the maturing process
of the typesetter, which has recently been educated to automatically move sub-
scripts of Γ somewhat to the left. The precise correction depends on the font
and can still be overridden via manual fine-tuning.

7.5.1 Horizontal spacing


In the Format „ Whitespace menu, you may find the available types of white-
space. For example, a horizontal whitespace of one centimeter can be inserted
via Format „ Whitespace „ Horizontal space „ Stretchable, by entering 1 cm at the
prompt. The length unit cm corresponds to a fixed space, but TEXMACS also
provides so-called stretchable length units. For instance, the horizontal width
of a space character between two words is 1 spc. The actual width of such
a space is determined during line breaking: it may be somewhat reduced if
we need to fit a lot of words on a line, or somewhat increased in order to fill a
relatively empty line. General stretchable spaces therefore consist of a default,
a minimal, and a maximal amount of space.
7.5 FINISHING TOUCHES 141

Keystroke Space Keystroke Space


␣ 1 spc \ ! ↩ -0.2 spc
␣ ␣ 1 em \ , ↩ 0.2 spc
␣ ␣ ␣ 2 em \ : ↩ 0.4 spc
␣ ␣ ␣ ␣ 3 em \ ; ↩ 0.6 spc
Table 7.1. Keystrokes for common horizontal spaces.

For minor adjustments of spacing inside text or formulas, it is recommended


to use one of the following length units:
spc. The width of the space character in the current font.
fn. The current font's design size with a flexibility of half that amount.
em. The (fixed) width of the “M” character in the current font, also called
“quad space”.
The advantage of these units is that they tend to be proportional to the font
size, so your adjustments remain correct if you change this size. See Table 3.9
for more available length units.
You may use the keystrokes from Table 7.1 in order to quickly insert small hor-
izontal spaces. The amount of space can be changed a posteriori using Focus „
Set length or the Length field on the focus toolbar. Even more efficiently, you
may keep the ⌘ modifier key pressed, and then adjust using the arrow keys.
We note that negative horizontal spaces are also supported; one typical appli-
cation is to adjust the position of the subscript in Γa, and turn this formula
into Γa.
It is sometimes useful to specify a vertical depth and height for a whitespace
using Format „ Whitespace „ Rigid box. For example, the space “ ” is 1 cm
wide, -3 mm deep, and 5 mm high. The Format „ Whitespace „ Horizontal space
menu also contains entries Tab and Custom tab for “horizontal tabs”. These
can be used if you need more than one type of alignment on the same line: for
a line with one tab, the text before and after the tab are respectively left- and
right-aligned. With two tabs, the three portions of text around the tabs are
left-aligned, centered, and right-aligned. You may also insert a tab using the
keyboard shortcut ⌘⇥ . Custom tabs allow you to specify the minimal amount
of space that will always be inserted, even when the tab occurs in a line full
with text.

7.5.2 Vertical spacing


Vertical spaces can be inserted using Format „ Whitespace „ Vertical space before
or Vertical space after. The markup that corresponds to such a vertical space is
indicated through an “informative flag”; the space itself occurs either before
or after the current paragraph. In particular, for paragraphs with more than
one line, there may be several lines between the place where you make your
“vertical space request” and the actual space.
142 ADVANCED LAYOUT FACILITIES

Whereas abcd descends below the line, Whereas abcd descends below the line,
ex
the iterated exponential e e is rather ex
the iterated exponential e e is rather
high. high.
Figure 7.4. Vertical spacing with and without shoving-in.

The vertical spaces really act as padding: assume that you specified a “ver-
tical space after” of 1 cm for some paragraph and a “vertical space before” of
5 mm for the next paragraph. Then the resulting space between these two para-
graphs will be the maximum 1 cm of both values. This is very useful for the
design of environments that are surrounded by vertical padding, such as the-
orem: the mechanism ensures that the same amount of space that separates
the theorem from other text is also used for the separation between two con-
secutive theorems. When using “hard spaces” instead of padding, the space
between two consecutive theorems would become twice too large (you may
have encountered this annoying behavior in LATEX).
Adding padding around environments is so common that TEXMACS actually
provides a special padded tag for this, which can be inserted using Insert „
Prominent „ Padded. The Focus „ Preferences „ Padding above and Padding below
menus allow you to specify the default amount of padding. We recommend
to base padded environments of your own design on the padded tag when-
ever possible.
If you want to insert vertical space between two specific lines (instead of para-
graphs), then you may use Format „ Whitespace „ Rigid box, as described in the
previous section. In this particular case, you should take 1 cm for the width of
your space; the height and the depth will determine the amount of whitespace
with respect to the previous and the next line.
The default vertical spacing between lines can be set via Document „ Paragraph „
Interline space. You may also specify an additional space between successive
paragraphs using Document „ Paragraph „ Interparagraph space. An alternative
way to indicate the start of a new paragraph is to indent its first line; in that
case you may take zero for the interparagraph space and control the precise
amount of indentation using Document „ Paragraph „ First indentation.
The most common length unit for vertical spacing is fn. Occasionally, the
length unit fns may also be of use: the minimal and default values of 1 fns are
both 0 fn, but its maximal value is 1 fn. This allows for the insertion of extra
vertical whitespace on underfull pages only. Several TEXMACS styles in which
paragraphs are indented use 0.5 fns as the default value for the interpara-
graph space. The interline space can be increased similarly, using Document „
Paragraph „ Advanced „ Extra interline space. The default amount of extra inter-
line space is 0.025 fns, which corresponds to the additional stretchability of
one line for every forty lines.
Inline mathematical formulas frequently extend beyond the vertical limits of
the line. TEXMACS implements a special “shoving-in” mechanism that avoids
unnecessarily large spaces between successive lines: see Figure 7.4. To avoid
7.5 FINISHING TOUCHES 143

visual collisions, shoving-in is used only when the horizontal


x
distance between
descending and ascending formulas (i.e. abcd and e in the example from
ee

Figure 7.4) is sufficient. This minimal horizontal distance is a style parameter


that can be modified via Document „ Paragraph „ Advanced „ Horizontal col-
lapse distance. The actual vertical space between formulas always exceeds the
minimal line separation space: Document „ Paragraph „ Advanced „ Minimal line
separation.

7.5.3 Adjusting the position and extents


The insertion of whitespace is a very common technique for adjusting the
layout of text and formulas. Another useful approach is to explicitly move
or resize certain parts. For instance, consider the formula
x f
(( 20 20 )) + ((( 30 30 ))).
y g

The fact that the character f is higher than x causes TEXMACS to use larger
brackets for the right-hand matrix. In order to obtain the better-looking
x f
(( 20 20 )) + (( 30 30 )),
y g

it suffices to select the character f and “smash” it using Format „ Adjust „ Smash.
The smashed f is displayed as before, but the typesetter is told to believe that
its vertical extents are the same as for the character x. It is also possible to
reduce the vertical extents by an explicit amount of space using Format „ Adjust „
Reduce. Inversely, you may “inflate” the character x using Format „ Adjust „
Inflate, and thereby pretend that it has the same vertical extents as the largest
character in the font, e.g. f .
Further types of adjustments that you may find in the Format „ Adjust menu are
the following:
Move. Explicitly move a subformula by both a horizontal and a vertical
amount of space. This can both be used for fine-tuning and for graph-
ical effects such as bubbling.
Shift. This is a variant of Move with this difference that the extents of the
object are not altered by the shift. In other words, shifting does not alter
the typesetting of any surrounding text; it just displays the shifted object
at another place.
Resize. Explicitly modify the extents of a piece of text (i.e. its left, right,
bottom, and top limits), without changing its rendering. The above
mechanisms of smashing, inflation, and reduction are all special cases
of resizing.
Extend. Similar to Resize except that we specify increments with respect to
the default extents.
144 ADVANCED LAYOUT FACILITIES

Clip. Similar to Resize with the difference that the piece of text is “clipped”
to remain inside the specified bounding box. For instance, when clip-
ping the text “clipped” vertically to the extents of the character “x”, we
obtain clipped.
When specifying the length arguments for the above constructs, you may use
the length units w and h for the width and height of the original content. You
may also use l, r, b, and t for the left, right, bottom, and top limits.

7.5.4 Phantoms
Phantoms are yet another typesetting technique that is occasionally useful.
A piece of text can be turned into a phantom by selecting it and applying
Format „ Special „ Phantom. The phantom text is treated similarly to the original
text, except that it is rendered using invisible ink. Let us give two examples
of how to apply this feature.
Tensors are objects that may contain subscripts and superscripts, but for which
the subscripts and superscripts need to be aligned in a precise manner:
j il
Ai k ⋅ Bj .

This effect can be obtained by inserting a phantom superscript i above the sub-
script i of A, followed by a phantom subscript j below the superscript j, and so
on.
Another example is a book on polynomial elimination, which typically con-
tains many explicit polynomials in a finite number of variables, such as

x 1 x 26 x 3 + 5 x 15 x 33 − 7 x 2 x 37 − 2016 x 38.
The subtle typographic problem here is that the subscripts of x 1 and x 26 are
not aligned, due to the fact that x 1 has no superscript (no need to move the
subscript further downwards). One possible remedy is to use “phantom 1”
superscripts whenever a variable occurs without any exponent:

x 1 x 26 x 3 + 5 x 15 x 33 − 7 x 2 x 37 − 2016 x 38.
Of course, it would be even better if TEXMACS implemented a special style para-
meter that allows similar subscripts and superscripts to be placed automatically
at the same level.

7.6 Miscellaneous typesetting utilities


7.6.1 Linear transformations
Several kinds of linear transformations can be applied to selected pieces of
text using the items in Format „ Transform: rotations (Rotate), horizontal and
vertical resizing (Dilate), slanting (Skew), and general 2 × 2 matrix transforma-
tions. The corresponding parameters (angle, magnification factors, slant, and
matrix coefficients) can be entered using the fields on the focus toolbar. Notice
7.6 MISCELLANEOUS TYPESETTING UTILITIES 145

Identity Rotate(10) Rotate(45) Rotate(90) Rotate(200)

Hi there!
!
re
he
e!
Hi ther

it
Hi there!

H
Hi t
re! he

Dilate(1.2, 0.9) Dilate(0.6, 2) Dilate(1.5, 1.5) Dilate(0.333, 0.333) Dilate(2, 0.4)

Hi there! Hithere! Hi there! Hi there! Hi there!

Hi there!
Skew(-0.333) Skew(0.25) Skew(0.333) Skew(1) Skew(1.5)
Hi there! Hi there! Hi there! Hi there!
( 1.2 0.2 )
Linear 0.2 1.2 ( 1.5 0.8 )
Linear 0.6 1.2 ( -1.5 0.4 )
Linear -0.5 1.4 ( 0.3
Linear 1.2 -0.4
1
) ( 1.4
Linear -0.3 0.8
1.6
)

re! !ere h
the
Hi ther Hi
e!
t iH

Hi ther
e r e ht iH e!
!
Figure 7.5. Applying several linear transformations to the text “Hi there!”.

that linear transformations can be applied to any kind of content, both text and
graphics. In sections 7.7 and 7.8 below, we will discuss several transformations
and effects that are applied more specifically to text or graphics. Figure 7.5
demonstrates various common linear transformations.

7.6.2 Device dependent rendering


Informative flags indicate the positions of labels or typesetting directives while
editing, but they are removed when printing the document on paper. This
is one example of when it is useful to differentiate between rendering on the
screen and on paper. More generally, the Format „ Specific menu can be used
to make some portion of text visible only under specific circumstances. The
following filters are available:
Screen. Only show the content on the screen and not when printed.
Printer. Only show the content when printing it on paper, but not on the
screen.
LaTeX. Only show the content when exporting to LATEX [38].
Html. Only show the content when exporting to HTML [41].
TeXmacs. Show the content except when exporting to another format.
Image. When exporting this content to another format, export it as an
image.
146 ADVANCED LAYOUT FACILITIES

Odd pages. Only show the content on odd-numbered pages, corresponding


to the right-hand side pages in a book.
Even pages. Only show the content on even-numbered pages, corre-
sponding to the left-hand side pages in a book.

7.6.3 Repeating a pattern


In tables of contents, one often uses horizontal dots to connect the section titles
and the corresponding page numbers. This is done by repeatedly inserting the
same pattern (a dot) over the full width of a given portion of text (in this case
a “horizontal tab” between a section title and its page number). Similarly, by
repeating a slash “/”, you may obtain the effect of stricken
////////out text.
You may create your own repetitions of text using Format „ Special „ Repeat
object. The second argument of the repeat tag contains the pattern that you
wish to repeat. The first argument corresponds to the text on top of which the
repetition is applied. For instance, hrepeatjthe answerj.i yields ...................
the answer. For
obtaining the effect of horizontal dots in a table of contents, you should use
Format „ Whitespace „ Tab as the first argument.

7.6.4 Line breaking of transformed text


Line breaking is naturally compatible with changes in the current font and text
color: if you put a large blue italic citation in the the middle of some paragraph,
then TEXMACS may line break it just the same as ordinary text.
Although and boxing are similar to changing the font or text color in
many ways, these transformations can only be applied to contiguous portions
of text. In other words, the usual line breaking algorithm will not work for
blurred or boxed texts.
In order to extend line breaking to such cases, TEXMACS provides Format „ Spe-
cial „ Decorate atoms. The first argument of the datoms primitive should be a
unary macro for transforming the lines of a broken paragraph. The second
argument contains the text to which the transformation should be applied. For
the above types of transformations, this allows us to obtain
This is a sample text that should clarify things, even
, as well the
more important thoughts that might be worth being emphasized
very loudly .
In this example, we notice that the boxed text is somewhat too wide: the mech-
anism only works optimally if transformed lines of text are exactly as wide as
the untransformed ones.

7.7 Font effects


So far, we have described numerous tricks to increase your control over the
typesetting process. TEXMACS also provides several graphical effects for giving
your documents a more artistic twist.
7.7 FONT EFFECTS 147

Original Cobaye Cobaye Cobaye Cobaye Cobaye


Embold Coobbaayyee C
C o b a ye C o b a y e C o b a y e C C
Cooobbbaaayyyeee
Strength 1.25 1.5 2 3 5
Blackboard embold Cobaye Cobaye Cobaye Cobaye Cobaye
Strength 2 2.5 3 4 5
Slanted Cobaye Cobaye Cobaye Cobaye Cobaye
Slope -0.25 0.1 0.2 0.25 0.4
Magnify horizontally Cobaye Cobaye Cobaye Cobaye Cobaye
Factor 0.75 0.9 1.1 1.2 1.5
Magnify vertically Cobaye Cobaye Cobaye Cobaye Cobaye
Factor 0.75 0.9 1.1 1.2 1.5
Condensed Cobaye Cobaye Cobaye Cobaye Cobaye
Factor 0.8 0.85 0.9 0.95 0.98
Extended Cobaye Cobaye Cobaye Cobaye Cobaye
Factor 1.02 1.05 1.1 1.15 1.2

Figure 7.6. Basic font effects for various values of their corresponding parameters.

A first family of graphical effects, available in Format „ Font effects, operates


on the font glyphs. The purpose of many of these effects is to mimic common
font styles such as bold, slanted, extended, condensed, etc. It is important to
note that these imitations are rather poor substitutes for their hand-designed
counterparts. There are many reasons for this. For instance, in most font fam-
ilies, italic characters such as a, f , and g are completely different from their
slanted counterparts a , f , and g ; even other characters such as b and l differ in
many ways from b and l (e.g. the lower corner of the “b” and its aspect ratio,
the serifs of the “l”, etc.). Other shortcomings of machine imitations are more
subtle and typically concern the stroke widths and internal proportions.
Despite the above limitations, there are often no good alternatives to machine
imitations. If you need a font style that simply does not exist for a given font
family, then your only remaining option is to find a similar font that does
provide the required style. The desired quality of a particular font may also
depend on the purpose: a poor counterfit may be acceptable for the occasional
use in a laptop presentation, but becomes more problematic when you sys-
tematically need it inside a reference manual.
TEXMACS automatically tries to find a suitable font when you change the font
style, but the artificial font effects from Format „ Font effects give you addi-
tional control. In the case of an emboldened font, you may for instance specify
the emboldening factor on the focus toolbar. This gives rise to a whole range
of weights such as “semibold”, “bold”, “black”, “heavy”, “ultra-black”, etc.
Figure 7.6 shows imitations of various common font effects for different values
of their parameters.
TEXMACS proposes two different mechanisms to produce extended and con-
densed fonts. The first one proceeds by horizontal magnification, but has the
drawback that the pen width of vertical strokes changes. The second mecha-
148 ADVANCED LAYOUT FACILITIES

Factor 0.75 0.9 0.95 0.98 1.02 1.05 1.1 1.25


I Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
II Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
I/II Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
Figure 7.7. Various techniques for emulating condensed and extended fonts.

nisms uses a sophisticated algorithm in order to preserve the pen width. How-
ever, this results in a lower “ink density” for wider fonts. For high quality
emulations of condensed and extended fonts, a good compromise might be
to use a combination of both mechanisms; see Figure 7.7 for a comparison.
Besides emulations of common font styles, TEXMACS also implements a few
more artistic font effects: see Figure 7.8. These effects involve random, so-called
Perlin noise. The Degraded effect conserves the general shape of glyphs, but
randomly removes little regions of pixels. The size of these regions is con-
trolled using the “frequency” parameter, whereas the amount of degradation
depends on the “threshold” parameter. You may use Distorted in order to ran-
domly distort glyphs at their boundaries. Such distortions work “both ways”
in the sense that ink may leak to the outside or be moved further inside. If
you don't want to permit leaks to the outside, then you may use the Gnawed
effect instead.
It is worth pointing out that the control parameters of all font effects are envi-
ronment variables. As such, you may both modify them locally, using the
fields on the focus toolbar, or globally, via Focus „ Preferences „ Style para-
meters. For example, assuming that your cursor is inside a degraded tag, you
may change the default degradation threshold from 0.667 into 0.6 using Focus „
Preferences „ Degraded threshold „ Other.
We also note that many of the above font effect rely on low-level bitmap oper-
ations on the font glyphs. This means in particular that the transformed fonts
are no longer vectorial “Type 1” fonts, but only “Type 3” bitmap fonts. Some
publishers prohibit PDF files that include such fonts. This drawback might
vanish in future versions of TEXMACS with the development of vectorial coun-
terparts for all font effects. Font emboldening, slanting, and magnification are
already vectorial.

Original Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye


Degraded Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
Threshold, Frequency 0.5, 1 0.6, 1 0.667, 1 0.75, 1 0.667, 0.5 0.667, 2
Distorted Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
Strength, Frequency 0.25, 1 0.5, 1 0.75, 1 1, 1 0.5, 0.5 2, 2
Gnawed Cobaye Cobaye Cobaye Cobaye Cobaye Cobaye
Strength, Frequency 0.3, 1 0.6, 1 0.9, 1 1.2, 1 0.6, 0.5 2, 2

Figure 7.8. Artistic font effects.


7.8 GRAPHICAL EFFECTS 149

Gaussian Oval Rectangular Motion


Blur
Outline
Thicken
Erode

Figure 7.9. Basic graphical effects using different pen styles.

7.8 Graphical effects


A variety of graphical bitmap effects are available in the menu Format „ Graph-
ical effects. They all operate on rectangular regions of text by first transforming
them into bitmap pictures and then applying the graphical effect. For large
pieces of texts, these transformations may take some time, so it is recommended
to apply the effect after you are done editing the text.
Several graphical effects like “distortion” are also available as font effects. There
are a few differences though. First of all, we recall that font effects operate
on individual glyphs. TEXMACS in particular remembers the transform of every
glyph. In the word “distorted”, this implies that the two letters “t” are dis-
torted in exactly the same way. In the graphical counterpart “ ”, mul-
tiple occurrences of the same character are distorted differently. The fact that
TEXMACS remembers transformed glyphs has the additional benefit of speed:
the transformed font essentially operates at the same speed as the native one.
Another important difference between font effects and their graphical coun-
terparts is that the first may also adjust the metric properties of the glyphs.
Consider the following e m b o l d e n e d characters. The analoguous graphical
effect of “thickening” with a “motion pen” again produces text,
but with a reduced spacing.
As in the case of font effects, each of the graphical effects comes with a certain
number of control parameters that can be modified in the focus toolbar. Four
basic effects are , , , and . The precise action of these
effects is determined by the pen that you use. Currently, four types of pens
are supported in Focus „ Effect pen: Gaussian, Oval, Rectangular, and Motion.
This menu is also available on the icon toolbar, under the icon that shows the
current pen: , , , or . For each of the pen styles, you may specify the
width, the height, and an angle. In Figures 7.9 and 7.10, you may see the results
obtained with various pens.

Increasing thickness
Increasing aspect ratio
Increasing angles
Figure 7.10. Various pen widths, heights, and angles for Gaussian thickening.
150 ADVANCED LAYOUT FACILITIES

Figure 7.11. Applying an engraving effect to a formula.

The next group of effects is built on top of the above more basic effects through
superposition, intersections, and recoloring. The effect adds a Gaus-
sian drop shadow to the text in a color that can be specified by the user. The
effect is a variant in which the roles of the shadow and the main
text are interchanged. Alternative ways to “raise” or “emboss” text are
and . The opposite effects are and .
Engravings require the colors and pen parameters to be chosen with care, as
in Figure 7.11, where we put a golden formula on a granite background, using
“pastel yellow” for the shadow color.
The random effects , and are similar to the corresponding
font effects. One advantage of the graphical variants is that they can be applied
to text as well as pictures: see Figure 7.12.

Untransformed Shadow Blur

Degrade Distort Gnaw

Figure 7.12. Applying graphical effects to pictures.


Chapter 8
Drawing pictures
8.1 Introduction
One of the simplest ways to insert pictures into TEXMACS documents is to save
your picture in a separate file and then use Insert „ Image „ Link image or Insert
image. Most of the standard file formats for images are supported, which
allows you to insert both photographs and pictures that were drawn using
externals tools such as GIMP, INKSCAPE, or DIA [35, 58, 39]; see section 6.3.
TEXMACS also includes a tool for creating your own drawings directly from
within the editor. Whether this tool should be preferred over external software
depends on the circumstances. Programs dedicated to image manipulation
typically contain sophisticated features for obtaining specific graphical effects.
However, these features are often designed for professional artists, so the
learning curve may be steep for a casual user. If you only need to draw fairly
simple objects such as lines, curves, text, arrows, etc., then elaborate special-
purpose software may be overkill.
Using the TEXMACS picture editor also offers several advantages. First of all,
its integrated nature makes it easy to insert rich text, mathematics, and hyper-
links inside your pictures. Mathematical formulas are often problematic for
externals tools. Secondly, native images often look nicer, because they use the
same fonts and default line width as the surrounding text. Unless you really
need specific graphical constructs that are not provided by TEXMACS, native
pictures should therefore be preferred if quality is an issue. Finally, as long as
you only need basic graphical elements, the integrated picture editor should
be reasonably complete and user-friendly.

8.2 Starting new pictures


New pictures can be started using Insert „ Image „ Draw image and they are
edited in graphics mode. By default, a newly inserted image extends over the
whole paragraph. You may adjust its size using the keyboard shortcuts ⌥← ,
⌥→ , ⌥↑ , ⌥↓ (to adjust the size a bit faster, you may use ⌥⇧← , ⌥⇧→ , ⌥⇧↑ , ⌥⇧↓ ). An
explicit size can also be specified using Insert „ Geometry „ Size or „ Size. After
completion of your drawing, it is possible to automatically crop it to its actual
size (plus some additional padding), using Insert „ Geometry „ Crop or „ Crop;
an example of such a cropped image is shown in Figure 8.1.
In some cases, you may want to draw something on top of an existing image
or other kinds of content. This can be done by selecting the relevant back-
ground image and clicking on Insert „ Image „ Draw over selection. Similarly,
you may use Insert „ Image „ Ink here to make manual graphical annotations at

151
152 DRAWING PICTURES

The quick brown fox jumps over


the lazy dog. The quick brown
fox jumps over the lazy dog. The
quick brown fox jumps over the
lazy dog. The quick brown fox
jumps over the lazy dog. The
quick brown fox jumps over the
lazy dog. The quick brown fox
jumps over the lazy dog.
Figure 8.1. Example of a “cropped image” Figure 8.2. Example of inking above
with a default padding of 1spc. the selected brown fox.

the current cursor position using the mouse (or a pen in the case that you have
a tablet).
The following formula shows an example of drawing a picture over an existing
formula:
Hypothenuse
a 2 + b 2 = c2

Figure 8.2 shows a similar example in which the red oval was inked over
the text. When making laptop presentations, it can be extremely useful to
put graphical and mathematical annotations on top of existing pictures:
see Figure 8.3.
By design, graphical annotations (created using Draw over selection or Ink here)
are drawn on top of the annotated text. Annotations are also allowed to par-
tially overlap with the surrounding text. The amount of permitted overlap
can be specified using Insert „ Geometry „ Overlap. This basically determines
the region where you are allowed to draw.

a2 b2

c2

Figure 8.3. Picture of a Pythagoras tree with mathematical annotations. The picture is due
to Atze van der Ploeg and freely available from WIKIMEDIA.
8.2 STARTING NEW PICTURES 153

Cartesian Polar

Logarithmic Notebook

Figure 8.4. Various available types of grids with different colors.

You may exit the graphics mode using Focus „ Exit graphics or . You may
re-enter the graphics mode by clicking inside the annotated text; alternatively
you may put your cursor just behind the annotated text and use Focus „ Enter
graphics or . The annotated text itself can be edited by replacing the draw-
over tag by a draw-under tag using Focus „ Draw over „ Draw under (or Insert „
Geometry „ Draw over from inside the graphics mode).

Inside graphics mode, the cursor is replaced by a red cross so as to indicate


the current position more precisely. For even more control, it is often useful
to display a grid while you are drawing (see Figure 8.4), which can be done
using Insert „ Grid „ Type „ Cartesian or „ Type „ Cartesian. In that case, the
red cross is automatically “snapped” to the grid as soon as you approach grid
points or edges. This makes it easy to draw pictures that contain many lines
between grid points, or other graphical elements whose “control points” lie
on a grid. Snapping can be useful on other occasions as well, such as starting
a line segment at the exact intersection of two curves; see section 8.7 for more
details.

In the menu Insert „ Grid or it is possible to adjust the colors of the axes and
the grid-lines, as well as the number of subunit grid-lines per unit grid-line.
By default, grids are printed; you need to remove them after completing your
drawing if you do not want them to appear in print.

The origin of the grid is initially set at the center of the screen. You may scroll
the picture using the arrow keys ← , → , ↑ , ↓ (or ⇧← , ⇧→ , ⇧↑ , ⇧↓ if you want to
move fast). The default unit for grids is 1 cm. You may specify a different unit
using the menu Insert „ Geometry „ Unit or „ Unit. You may also zoom in and
out using + and - , Insert „ Geometry „ Zoom, or „ Zoom.
154 DRAWING PICTURES

8.3 Graphics mode

When drawing pictures, the user interface of TEXMACS works in a slightly dif-
ferent way than in text mode. Before going into more details, let us briefly
summarize the main design philosophy behind the graphical editor.

We have already encountered the icons and for specifying the global
properties of the image and of a guiding grid.

The second and third groups of icons , , , , , , , , , , on


the mode-dependent toolbar can be used to insert new graphical elements. For
instance, clicking on will put the editor into “insert polyline mode”. This
allows you to insert new polyline objects: one mouse click for the first and
every next point, and a double click for the last point. The vertices of such a
polyline object are also called control points. You may move control points of
existing polyline objects by dragging them with the mouse. In “insert polyline
mode” it is also possible to move control points of circles and other graphical
elements in this way; this saves you the trouble of switching modes for such
basic a posteriori adjustments.

TEXMACS supports various kinds of curves such as polylines, arcs of circles,


splines, and Bezier curves. In each of these cases, the shape of the curve is spec-
ified via its control points, which typically (but not necessarily) lie on the curve
itself. Other graphical elements may also contain text. The most basic tex-
tual objects consist of one control point for the position and the corresponding
text itself. The more elaborate “arrow with text” objects consist of two con-
trol points for the start and the end of an arrow, together with accompanying
text. Such objects may for instance be useful for drawing commutative dia-
grams. You may enter “insert text mode” using , whereas arrows with text
are only available via the Insert menu.

The rendering of a graphical object is completely determined by its control


points, its text fields (if any), and its style properties. The available style prop-
erties for a given mode are shown in the focus toolbar. The style properties of
graphical objects can also be edited via the focus toolbar. In “insert line mode”,
this allows you to select a color, a line width, possible arrows at the endpoints,
etc. For textual elements, the style properties typically include horizontal and
vertical alignment. Using the ↩ key, it is also possible to apply the current style
properties to the object under your mouse. Conversely, the shortcut ⇧↩ allows
you to fetch the properties of an existing object. This may be useful if you want
to apply the same properties to another object.

The last group of icons , , , , on the mode-dependent toolbar can be


used to edit existing objects or groups of objects. The first icon allows you
to modify style properties. The next three icons , , make it easy to move,
resize, and rotate objects. The last icon is used for grouping a collection of
graphical objects inside a single object and vice versa.
8.4 GRAPHICAL OBJECTS 155

Technically speaking, it should be noted that a graphical picture is simply a list


of graphical objects that are drawn on top of each other in sequence. The order
in which this is done is called the stacking order. Whenever several objects
overlap, the stacking order clearly influences the rendering of a picture. Inside
graphics mode, when hovering the mouse over an object, you may change
its stacking order using the ⇞ and ⇟ keys: ⇞ raises your object “one level up”
in front of other objects, whereas ⇟ moves it “one level down”.
We also note that some of the actions in graphics mode use the right mouse
button. If your mouse has only one button, then it is usually possible to emulate
the right button by holding the control key while pressing the unique mouse
button.

8.4 Graphical objects


Points
Points are among the simplest objects supported
by TEXMACS. You enter “insert point mode” using
or Insert „ Point. New points are inserted via
a single mouse click and existing points can
be moved by dragging them using the mouse.
Points can be removed by pressing ↩ or the right
mouse button while hovering over them. The
color, shape, and size of points can be specified Figure 8.5. Six points on a circle.
using the style properties.

Polylines and closed polygons


You enter “insert polyline mode” using or Insert „ Line. In this mode, a new
polyline (also called a broken line object) can be started via a single mouse
click. At every next mouse click, a new control point is added. The last control
point is specified using a double click. While entering a polyline, you may use
the right button of your mouse in order to remove the latest added point. This
is equivalent to the “undo” shortcut ⌘[ .
You may also edit existing polyline objects inside “insert polyline mode” or
any other “insert mode”. We already mentioned that control points can be
moved by dragging them using the mouse (Figure 8.6b). In addition, a new

a b c
a b

Control points Moving points Adding points

Figure 8.6. A posteriori editing of polylines. Figure 8.7. A filled polygon and polyline.
156 DRAWING PICTURES

control point can be inserted on an existing line segment using the same tech-
nique. In order to do so, hover the mouse pointer over the edge where you
want to insert a new point; the two neighboring control points should be high-
lighted (Figure 8.6c). Then start dragging and a new control point will appear.
When hovering over a control point, the right mouse button or the ⌫ key can
be used to remove it. When holding the shift key ⇧ while clicking on the right
mouse button, the entire object will be removed.
Polygons are a variant of polylines for which the last and the first control point
are also joined by a line. You may draw them using or Insert „ Polygon. The
style properties allow you to specify a fill color or pattern for the interior of
a polygon (Figure 8.7a). Broken line objects may also be filled, but the result
usually looks less nice (Figure 8.7b).
Circles and arcs of circles
You may enter “insert circle mode” using or
Insert „ Circle. New circles are inserted by speci-
fying three points on the circle using single mouse
clicks. Arcs of circles are inserted in a similar way,
provided that you are in “insert arc mode” ( or
Insert „ Arc). As usual, the three control points can Figure 8.8. A filled circle and
be moved a posteriori by dragging them using the a circular arc, together with
mouse. The style properties allow you to specify their three control points.
a fill color (Figure 8.8).

Smooth curves
Smooth curves are similar to polyline objects with this difference that they are
nicely rounded at the control points. You may draw smooth curves using
or Insert „ Curve; their closed variants can be obtained through or Insert „
Closed curve. New curves and control points can be inserted in the same way
as for polyline objects and polygons. Removal and a posteriori editing of con-
trol points also works similarly.
TEXMACS supports two types of smooth curves: splines and cubic Bezier curves.
Splines are the default type of curves for and . The precise shape of a spline
curve is determined as a function of all control points. Moving a control point
will therefore affect the whole curve and not just the neighboring parts, even
though the changes will be most prominent near the control point. By con-
trast, the shape of individual pieces of a Bezier curve is entirely determined
by the four closest control points.
The differences between splines and Bezier curves can be seen in Figures 8.9a
and 8.9b. The banana from Figure 8.9a is a closed spline with four control
points. Figure 8.9b shows the closed Bezier curve that is obtained by using the
same control points.
The banana from Figure 8.9b is actually a “simplified” Bezier curve, that was
inserted using Insert „ Closed curve „ Closed smooth. More general (cubic) Bezier
curves have two types of control points: principal control points that lie on
8.4 GRAPHICAL OBJECTS 157

a b
a b c

Figure 8.9. Comparing splines and Bezier curves. Figure 8.10. Bezier curves with general tangents.

the curve and additional control points that specify the tangents of the curve
at these principal control points. Every principal control point is surrounded
by exactly two control points for controlling these tangents. In Figure 8.9c we
have drawn yet another banana by using such a general Bezier curve. Notice
that we specified both a horizontal and a vertical tangent at each of the two
endpoints of the banana.
General Bezier curves are inserted using Insert „ Curve „ Bezier or Insert „
Closed curve „ Closed Bezier. They are a bit more awkward to edit because
of the different types of control points. But they are very useful for tech-
nical drawings that require very precise control over the curves. For
instance, it becomes possible to alternate straight and rounded portions
within the same curve (Figure 8.10a). They also allow you to draw heart-like
shapes (Figure 8.10b).
Text objects and mathematical formulas
Ordinary text can be incorporated into pictures after switching to “insert text
mode” ( or Insert „ Text). In this mode, a mouse click inserts a text object at
that position. While editing text, you are no longer in graphics mode, and the
interface will change to the usual one for editing text. In order to return to the
graphics mode, it suffices to click anywhere inside the picture. In case your
picture contains several text objects, you may easily move from one object to
the others using the cursor keys ← , → , ↑ , and ↓ . As usual, text objects can be
moved by dragging them using the mouse and removed using the right mouse
button or ⌫ .

C e πi/2 = i

e πi = −1 e 2πi = 1
G

A B e 3πi/2 = −i

Figure 8.11. Example of text in a picture. Figure 8.12. A picture with mathematical formulas.
158 DRAWING PICTURES

TEXMACS also has a special mode for inserting mathematical formulas ( or


Insert „ Mathematics). The same graphical result can be obtained by inserting
a text object as above and then creating a mathematical formula inside it
using $ . Nevertheless, the dedicated “insert formula mode” is handy for pic-
tures in which you need to insert many formulas.

Longer blocks of text


The above “insert text” and “insert formula” modes are mainly intended for
short fragments of text. For longer portions of text, the “insert text block” mode
is more appropriate ( or Insert „ Long text). Line wrapping is activated in this
mode and text blocks are allowed to extend over several paragraphs. Using
style properties that are available from the focus toolbar, you may control the
width of text blocks, as well as the interline spacing and optional borders and
background colors.

Hand-drawn curves
Sometimes it may be desirable to quickly sketch a picture as if you were
drawing it using a pen on a sheet of paper. This is particularly natural if you
own a tablet PC or if you connected an external graphical tablet to your com-
puter. The graphical editor offers a special “inking mode” to this purpose,
which is entered using or Insert „ Hand drawn.
If you own a graphical tablet with a pen, the
“inking mode” allows you to directly draw
curves on the screen. It is also possible to “ink”
using a traditional mouse by holding the mouse
button down while drawing. Currently, the
inking mode produces straightforward polylines
that can be edited a posteriori as described above.
Notice however that inked curves usually contain
many control points, which makes it tedious to
edit them one by one. On the other hand, global Figure 8.13. Hand-drawn greeting.
transformations are easy to apply a posteriori, as
explained in section 8.6.

Other graphical objects

In addition to the primitive graphical objects described above, TEXMACS also


provides a few graphical macros for drawing more complex objects that are
composed of primitive objects. For the moment, these graphical macros are
still somewhat experimental, so they have only made available from the Insert
menu. Currently, the “arrow with text” macro is the most important one, since
it may be useful for the creation of commutative diagrams: see section 4.8. The
experimental graphical-macros package contains several macros for elec-
8.5 STYLE PROPERTIES 159

Figure 8.14. Closed splines with various line and fill colors. Figure 8.15. Pattern fill demo.

tronic components, among others. Future versions of TEXMACS are likely to


provide more and more constructs of this kind.

8.5 Style properties

Color

This property applies to any of the graphical object types and specifies the line
or font color. The color can either be selected from a fixed palette of common
colors, using a special color picking window (Focus „ Color „ Palette), or by
name (Focus „ Color „ Other). TEXMACS supports many familiar colors by their
English names, such as red, purple, gold, or olive. In addition, you may use
hexadecimal values of the form #rrggbb, such as #c04080 (75% red, 25% green,
50% blue).

Fill color

This property applies to all graphical object types except text and mathematics.
It specifies a fill color for the object. Notice that TEXMACS also allows you to
specify a pattern for the fill color (see Figure 8.15).

Opacity

This property applies to all graphical object types and specifies an opacity
between 0% and 100%. The default is 100% and lower opacities will make the
object more transparent (see Figure 8.16).

Line width

The line width property applies to all curves (polylines, splines, Bezier curves,
arcs, circles, and their closed variants), including curves that may occur inside
other graphical objects (such as arrows with text). The default line width is 1 ln,
which corresponds to the width of the fraction bar in mathematical formulas.
Figure 8.17 shows the effect of changing the line width. It is recommended
160 DRAWING PICTURES

Figure 8.16. A circle on top of another object, using increasing opacities.

0.5 ln
1 ln
2 ln
5 ln
2 mm

Figure 8.17. The same curve using different line widths.

to use ln as a unit for line widths, but any other length unit such as mm is
also allowed.

Dash style and dash patterns


Various dash styles are available for curves in Focus „ Line dashes (see
Figure 8.18). In addition to the standard dash styles, TEXMACS offers several
two-dimensional dash patterns: see Figure 8.19.

Figure 8.18. Dash styles. Figure 8.19. Dash patterns.

Dash style unit


In Focus „ Line dashes „ Unit, you may specify a unit for the length of line dashes.
The default unit is 5 ln and higher values result in longer dashes. TEXMACS
adjusts the lengths of dashes so that curves always consist of an integer number
8.5 STYLE PROPERTIES 161

Horizontal Vertical

10 ln 5 ln
10 ln 10 ln
5 ln 10 ln 20 ln
10 ln 20 ln
20 ln 5 ln
20 ln 10 ln
20 ln 20 ln
Figure 8.20. Varying the horizontal dash unit. Figure 8.21. Varying the pattern dash units.

of dashes. This makes dashed curves look better, especially when they are
closed or when they have arrows: see Figure 8.20.
In the case of two-dimensional dash patterns,
you may specify both a horizontal and a ver-
tical dash unit using Focus „ Line dashes „ Unit „
Other. In the case of “wave pattern dashes”, the
horizontal and vertical unit respectively con-
trol the wave length and the amplitude: see
Figure 8.21. In Figure 8.22, we have also shown
an example of “meander pattern dashes”, with
30 ln for both the horizontal and vertical dash
units. Figure 8.22. Meander pattern dashes.

Line arrows
Several kinds of arrows can be attached to the endpoints of curves using Focus „
Line arrows (see Figure 8.23). The orientation of such arrows is determined
by the tangents to the curves at these endpoints.

Figure 8.23. The same segment using different types of “arrows” at the extremities.
162 DRAWING PICTURES

Size Border
Disk Round Square Plus
4 px 1 px
10 ln 1 px
Diamond Triangle Star Cross
10 ln 2 ln
Figure 8.24. Point styles for black line and red fill colors. Figure 8.25. Point size and border width.

Point style
A few different styles are supported for displaying points: solid disks, circles,
squares, diamonds, triangles, stars, and two types of crosses; see Figure 8.24.
Two additional style properties control the size and the line width for drawing
the borders. Notice that the px unit (which stands for the size of a pixel on the
screen) remains constant while zooming in or out. The ln unit is proportional
to other standard units such as cm, so that you may prefer this unit if you want
the points to automatically adjust together with other graphical objects.

Text alignment
For textual and mathematical boxes, it is possible to specify their horizontal
and vertical alignment. The three modes for horizontal alignment are “left”,
“center”, and “right”; see Figure 8.26a. Besides the classical “bottom”, “center”,
and “top” modes, TEXMACS also provides modes for vertical alignment at the
baseline and axis; see Figure 8.26b. We recall that the axis is an invisible hori-
zontal line that goes through the vertical center of the character “x”.

8.6 Editing groups of objects


The “group edit” modes (which correspond to the icons , , , , on
the mode-dependent toolbar) allow you to modify existing graphical objects
individually or jointly. In each of these modes, the left mouse button is used to
perform specific actions, whereas the right mouse button allows you to specify
groups of objects on which to operate.

Left b

Bottom y Base y Center y


Center Axis y Top y

Right

Figure 8.26. Horizontal and vertical alignment of text boxes.


8.7 SNAPPING 163

If you wish to operate on a group of objects, then you may use single clicks on
the right mouse button in order to toggle those objects that should be part of
the group. Alternatively, you may specify a rectangular region by dragging
the mouse while holding the right button down. In that case, all objects inside
the region will be included in the group.
The first group editing mode is entered using or Insert „ Set properties, and
can be used for modifying the style properties of one or more objects. If you
select a group of objects, then the current properties of the group are shown in
the focus toolbar. You may then modify them there or via the focus menu. If
several objects of the selection have different values for a given property, then
the focus toolbar will indicate “mixed” for that property. In the “set proper-
ties” mode, a left mouse click will simply select the object under your mouse.
The next three modes , , (or Insert „ Move objects, Resize objects, Rotate
objects) allow you to move, resize, and rotate graphical objects, respectively. If
you selected a group of objects, then the desired transformation can be achieved
by dragging the mouse while holding the left button down. If you did not
select any group of objects, then individual objects can be transformed in a
similar way. In the cases of resize operations and rotations, the center of the
bounding box for the transformed group of objects remains fixed.
The last group editing mode is entered using or Insert „ Group/ungroup.
Assuming that you selected a group of several objects, a left mouse click groups
these objects together into a single object. Inversely, when clicking on the
resulting “group object”, it is ungrouped back into simpler objects that can
be manipulated individually.
The group editing modes can also be used in order to copy and paste graphical
objects. Assuming that you selected a group of objects, you can copy it to the
clipboard using ⌘w , , or Edit „ Copy. When pasting this selection using ⌃y ,
, or Edit „ Paste, a duplicate group will be inserted at exactly the same loca-
tion as the original group. The new copy is automatically selected as a group,
which allows you to immediately apply a transformation to it. This is partic-
ularly convenient in “move objects” mode, in which case you typically move
the pasted group of objects to a new location. If you need several copies at
different locations, the same procedure (pasting and moving to a new location)
can be repeated.

8.7 Snapping
For technical pictures, exactness is important. When drawing freely by hand
or using the mouse on a modern high precision screen, it is not so easy to
specify control points up to the pixel. This makes it hard to draw lines that
are exactly horizontal or vertical. Similarly, it is difficult to make a new line
start at the exact intersection of two curves. What is more, such intersections
usually do not have coordinates that are integer multiples of a pixel. Con-
sequently, what may appear to be the right intersection point on your screen
may look awful when zooming in or printing out on a high resolution printer.
164 DRAWING PICTURES

Snapping is a technique that makes it easier to draw pictures in which lines are
guaranteed to be horizontal or vertical when needed, and for which various
other graphical requirements can be met exactly. The idea is that certain points,
such as control points, grid points, or intersections of curves, are considered
to be “special” by the editor. Whenever you approach the cursor sufficiently
close to such a point, the cursor snaps to it, as if attracted by magic force.
Some of these special points may actually be more special than others. For
instance, a point on a curve is more special than a generic point and the intersec-
tion of two curves is more special than a generic point on one of the intersecting
curves. When two special points are competing for attention, the cursor will
be snapped to the most special one. Sometimes, ambiguities still occur. In
that case, you may use the ⇥ key in order to cycle among all possibilities. For
instance, assume that we drew several curves starting at the same point. If
we want to move the starting point of one of these curves, by dragging it using
the mouse, then we may first need to hit ⇥ one or more times to make sure
that we are adjusting the right curve.
The precise types of points that are considered “special” by the editor can be
controlled by toggling the items in the Snap menu on the focus bar. The active
kinds of snapping are indicated by the icons next to this menu; they can be
deactivated by clicking on the corresponding icons. TEXMACS currently imple-
ments the following kinds of snapping (see Figure 8.27):
None. Deactivate all forms of snapping (except snapping to control points).

All. Activate all forms of snapping.

Grid points. ( ) Snaps to all grid points. For a standard Cartesian grid,
this means that we snap to points (x, y) for which both x and y are inte-
gers (or multiples of 1/n in the case when n subunit steps are used).
Grid lines. ( ) Use snapping to all horizontal and vertical lines that join
two grid points. For a standard Cartesian grid, this means that we snap
to points (x, y) for which x or y is an integer (or a multiple of 1/n in the
case when n subunit steps are used).
Grid-curve intersections. ( ) For snapping to intersection points between
curves drawn by the user and horizontal or vertical lines that join two
grid points.
Curve points. ( ) Snap to arbitrary points on curves.
Curve intersections. ( ) Snap to intersections between curves, including
self-intersections.
Text corners. ( ) Text objects and mathematical formulas are surrounded
by an invisible rectangular bounding box. The cursor may be snapped
to the corners of this box as well as to the midpoints of the edges. This
kind of snapping is useful for the creation of commutative diagrams, as
explained in section 4.8.
8.7 SNAPPING 165

Grid points Grid lines Grid-curve intersections

Curve points Curve intersections Text corners Text borders

Hello

Hello world
A B

C
Figure 8.27. Illustration of the different kinds of snapping that are supported.

Text borders. ( ) This variant of the above way of snapping can be used
for snapping to arbitrary points on the bounding box. This is useful if
your text needs to be connected to many other graphical elements using
arrows.

Two additional parameters control the precise way that snapping takes place.
The “snapping distance” can be changed using Snap „ Snap distance; when
approaching a special point closer than this distance, your cursor will snap.
The default snapping distance is 10 pixels. People who are skilled with the
mouse may prefer a smaller distance, whereas larger distances are typically
more adequate on high resolution screens. When drawing pictures that con-
tain many small details, snapping occasionally becomes annoying. Besides
changing the snapping distance, another useful trick for such situations is to
zoom in using + , edit the details, and then zoom back out using - .
For text objects and mathematical formulas, you may also specify the “text
padding” using Snap „ Text padding. This quantity controls the additional
padding to be inserted between the physical bounding box of the text and the
logical bounding box for snapping purposes.
Interactive geometry programs such as C INDERELLA, D R . G EO , or
GEOGEBRA [48, 12, 30] implement a further improvement with respect to snap-
ping: geometric constructions. Assume for instance that we constructed a picture
with two intersecting circles 𝒞 1 and 𝒞 2, together with a line segment ℓ between
the two intersection points. In interactive geometry programs, this line seg-
ment ℓ is automatically updated when moving the control points of 𝒞 1 or 𝒞 2.
In TEXMACS, the cursor is only snapped to the correct intersection points when
drawing ℓ. If you change 𝒞 1 or 𝒞 2 afterwards, then you will have to move
the endpoints of ℓ to the new intersection points.
Chapter 9
Laptop presentations

9.1 Introduction

TEXMACS provides a special beamer style for the creation of laptop presenta-
tions. A beamer presentation consist of a series of screens instead of pages.
During a presentation, the screens are displayed one after another, via a remote
controller or special keyboard shortcuts. Using special markup, the screens
can be further subdivided, so as to make part of their content appear progres-
sively or in alternation. The presentation may also contain dynamic elements
such as animations or on-the-fly mathematical computations.

There exist two main types of screens: textual and graphical ones. Textual
screens are simply pages of the size of your screen and similar formatting rules
apply as on ordinary paper. In particular, a consistent layout is guaranteed
throughout the presentation. Graphical screens are pictures of the size of your
screen with an optional title. Text can be placed anywhere inside such pic-
tures and freely moved around. It is also easy to insert other graphical objects
such as polygons, circles, and more general curves.

During an actual presentation, it is important to use the entire screen and


remove all menu bars, toolbars, and other clutter. This is the purpose of the
presentation mode, which can be activated and deactivated using View „ Presen-
tation mode or ⌃F9 . The main keyboard shortcuts for traversing your slides
forward and backward are F11 and F10 . The keys F9 and F12 are used to
go to the start and end of the presentation, whereas ⇟ and ⇞ allow you to
directly move forward and backward by one screen at a time. TEXMACS also
provides a panorama mode which can be toggled using View „ Show panorama
or ⌃F10 . This mode provides a global overview of the entire presentation and
allows you to quickly move the cursor to any position.

During live performances, a remote controller is often preferred for navigating


through the presentation. TEXMACS supports several types of remote controllers.
Some of them (such as Apple infrared controllers) should work out of the box.
Others map the buttons on the remote controller to certain keys on your key-
board, and you will need to toggle View „ Remote control in order to remap these
keys to the right actions during presentations. If necessary, the appropriate
mappings can be specified in Edit „ Preferences „ Keyboard „ Remote control.

166
9.2 THEMES AND STYLE OPTIONS 167

Bluish Parchment
Multiplication in Fq[X] 1/1 Multiplication in 𝔽q[X] 1/1

Kronecker : MFp(n) = O(I(n log p)) if log n = O(log p) Kronecker : M𝔽p(n) = O(I(n log p)) if log n = O(log p)

SchönhageStrassen : MFq(n) = O(n log n log log n MFq(1)) if char Fq > 2 Schönhage–Strassen : M𝔽q(n) = O(n log n log log n M𝔽q(1)) if char 𝔽q > 2
Schönhage : MFq(n) = O(n log n log log n MFq(1)) for all q Schönhage : M𝔽q(n) = O(n log n log log n M𝔽q(1)) for all q
Kronecker : MFpk(n)  MFp(k n), modulo O(k n log p) operations Kronecker : M𝔽p k(n) ≍ M𝔽p(k n), modulo O(k n log p) operations

Theorem Theorem
We have, uniformly in q: We have, uniformly in q:
Mq(n) = O((n log q) log(n log q) 4log

log(nlog q) (nlogq)
Mq(n) = O((n log q) log(n log q) 4 ): ).

Theorem Theorem
Modulo plausible conjectures, we have, uniformly in q: Modulo “plausible conjectures”, we have, uniformly in q:

Mq (n) = O((n log q) log(n log q)): Mq(n) = O((n log q) log(n log q)).

Dark vador Blackboard


Multiplication in Fq[X] 1/1 Multiplication in F [X ]
q
1/1

Kronecker : MFp(n) = O(I(n log p)) if log n = O(log p) Kronecker : MFp (n ) = O (I(n log p )) if log n = O (log p )

Schönhage–Strassen : MFq(n) = O(n log n log log n MFq(1)) if char Fq > 2 Schönhage–Strassen : MFq (n ) = O (n log n log log n MFq (1)) if char F >2
q

Schönhage : MFq(n) = O(n log n log log n MFq(1)) for all q Schönhage : MFq (n ) = O (n log n log log n MFq (1)) for all q

Kronecker : MF k (n ) ˘ MFp (k n ), modulo O (k n log p ) operations


˘
Kronecker : MFpk(n)  MFp(k n), modulo O(k n log p) operations p

Theorem Theorem

We have, uniformly in q: We have, uniformly in q:


log*(n log q )
Mq(n) = O((n log q) log(n log q) 4log
(nlogq)
): Mq (n ) = O ((n log q ) log(n log q ) 4 ).
Theorem Theorem
Modulo “ plausible conjectures ”, we have, uniformly in q: Modulo “plausible conjectures”, we have, uniformly in q:

Mq (n ) = O ((n log q ) log(n log q )).


Mq(n) = O((n log q) log(n log q)):

Figure 9.1. Various beamer themes.

By activating the debugging tool Tools „ Debugging tool and Debug „ keyboard,
you may determine the particular mappings used by your remote control.

9.2 Themes and style options

You may select one of the beamer themes in order to specify the global look
and feel of your presentation. Such a theme mainly corresponds to a collec-
tion of colors and background patterns for titles, mathematical formulas, theo-
rems, etc., and the presentation itself. Assuming that the focus is on your entire
presentation, the available themes can be found in Focus „ Beamer theme; see
Figure 9.1 for a few examples.
In addition to the main theme, we recall from section 2.7 that the rendering of
individual markup elements can be further customized via the Focus „ Pref-
erences menu. For instance, inside a screen title, you may select Focus „ Prefer-
ences „ Framed titles as an alternative for the default title bar rendering at the
top of the screen. Similarly, inside a theorem, you may select the alternative
Hanging theorems rendering. Yet another example is the use of an alternative
color for mathematical formulas. See Figure 9.2 for the effect of such customiza-
tions.
168 LAPTOP PRESENTATIONS

Default non-framed theorems Hanging theorems


Multiplication in Fq[X] 1/1 Multiplication in Fq[X] 1/1

Kronecker : MFp(n) = O(I(n log p)) if log n = O(log p) Kronecker : MFp(n) = O(I(n log p)) if log n = O(log p)
SchönhageStrassen : MFq(n) = O(n log n log log n MFq(1)) if char Fq > 2 SchönhageStrassen : MFq(n) = O(n log n log log n MFq(1)) if char Fq > 2

Schönhage : MFq(n) = O(n log n log log n MFq(1)) for all q Schönhage : MFq(n) = O(n log n log log n MFq(1)) for all q

Kronecker : MFpk(n)  MFp(k n), modulo O(k n log p) operations Kronecker : MFpk(n)  MFp(k n), modulo O(k n log p) operations

Theorem. We have, uniformly in q: Theorem We have, uniformly in q:

Mq(n) = O((n log q) log(n log q) 4log Mq(n) = O((n log q) log(n log q) 4log
 (nlog q)
(nlog q)
): ):

Theorem. Modulo plausible conjectures, we have, uniformly in q: Theorem Modulo plausible conjectures, we have, uniformly in q:
Mq (n) = O((n log q) log(n log q)): Mq (n) = O((n log q) log(n log q)):

Figure 9.2. Customized rendering for various markup elements.

The top-level focus menu also allows you to specify an aspect ratio for your
presentation. Traditional projectors use a ratio of 4:3 or 5:4. When connecting
your laptop to a widescreen television or certain recent projectors, you may
need to select a ratio of 16:9 or 8:5 instead. In case of doubt, we recommend to
opt for a 4:3 or 8:5 ratio.
When preparing a presentation, it is sometimes nice to see all screens in succes-
sion, rather than editing them one by one. This can be achieved by selecting the
Paper page mode from the icon menu on the focus toolbar or using Docu-
ment „ Page „ Format „ Page rendering „ paper. Alternatively, the Panorama mode
allows you to see miniature versions of all your slides on a single screen. The
paper and panorama page modes are also useful whenever you need to reor-
ganize your presentation. Indeed, they allow you to select ranges of screens
and to copy and paste them.

9.3 Switching, folding, and unrolling


The root of a presentation consists of a screens tag. This tag is an example of a
switch: it contains an arbitrary number of screens as its arguments, but only one
screen is displayed at each time. The Insert „ Fold „ Switch menu provides sev-
eral other types of switches, each of which allows you to show different pieces
of text in a successive and mutually exclusive manner. The most common
Standard switch is used for paragraph-wide content (similar to “displayed” for-
mulas), whereas you should use Tiny switches for inline text (similar to “inline”
formulas).
Inside a switch, new branches can be inserted after or before the currently vis-
ible branch using Focus „ Insert argument after or Insert argument before; you
may also use ⌥→ , ⌥← , or one of the icons or on the focus toolbar. We also
note that switches can be nested inside each other. For example, it is perfectly
allowed to insert, say, a standard switch inside a screens switch. When tra-
versing a presentation forwards using F11 , you will only move to the next
screen of the screens switch after traversing all branches of the innermost
switch.
9.3 SWITCHING, FOLDING, AND UNROLLING 169

Another popular way to traverse a presentation is to progressively unroll con-


tent. This can be done by inserting one of the unrolling tags from Insert „ Fold „
Unroll:

Compressed. When using this default unrolling style, the branches that
have not been unrolled are simply ignored. As a consequence, if the
unroll tag is followed by other text, then this subsequent text will move
downwards while unrolling.

Phantoms. When using this style, the branches that have not yet been
unrolled are “displayed” using invisible ink. If the unroll tag has not
completely been unrolled, then there will be blank lines between the
unroll tag and subsequent text (if any).

Greyed. For this style, the branches that have not yet been unrolled are
“pre-displayed” using lightly visible ink.

These primitive unrolling tags can be combined with the various kinds of item
lists described in section 3.6. For instance, Insert „ Fold „ Unroll „ Itemize inserts
a standard item list that can be unrolled progressively according to the default,
compressed unrolling style. Using the standard mechanism of structured vari-
ants (see section 2.7), one may next replace the itemize and unroll tags by any
of their variants.
Inside a list that can be unrolled, pressing ↩ creates a new unrollable branch
with a list item. Sometimes you may want to unroll more than one item at
once; in that case, you have to manually insert additional items to the branch,
e.g. by typing \ i t e m ↩ .
A variant of unrolling is unfolding, in which case there are exactly two branches,
one of which is always visible, and one of which can be “folded”. Different
folding styles are available through Insert „ Fold „ Folded. Some of the rendering
styles display a button that may be pushed in order to fold or unfold. The
input-output fields inside computer algebra sessions are also foldable.
Yet another variant of folded structures is available through Insert „ Fold „ Sum-
marize. The tags in this menu are switches with two branches, again with
different rendering styles.
When using TEXMACS in combination with an external plug-in, such as a com-
puter algebra system, you will notice that all input-output fields in sessions are
foldable. In addition, you can create so-called “executable switches” using the
items in the Insert „ Fold „ Executable submenu. This allows you to switch back
and forth between a given input and the corresponding output.
We already explained that switches may be nested in a natural way. The same
holds for the other tags that we have just described. Moreover, in the Insert „
Fold „ Traversal menu, you may specify whether unrolled and unfolded struc-
tures should be folded back after traversal.
170 LAPTOP PRESENTATIONS

Elimination of x from Elimination of x from


x sin y − 3 x y = 𝛼 x sin y − 3 x y = 𝛼
yields yields
𝛼 𝛼
x= . x= .
sin y − 3 y sin y − 3 y
Figure 9.3. Example of highlighting a variable x when switching from one screen to a next
one.

9.4 Overlays
The mechanisms of switches, unrolling, and unfolding cover the most frequent
kinds of traversal of a slide show. However, there are cases in which more
complex successions are needed. For example, imagine that, for a given screen,
we wish to highlight all occurrences of the variable x in red on the next screen
(see Figure 9.3). This could be achieved by using a switch tag: we copy the
whole screen to both the first and second branch of the switch, and then color
red all instances of x in the second branch. However, this solution has the
disadvantage that any a posteriori modification on the slide has to be made
both in the first and in the second branch.
TEXMACS provides the “overlay” mechanism for this kind of more complex
successions of screens. You may insert a pile of overlays using Insert „ Fold „
Overlays „ Standard. At the start, the pile contains a unique overlay, but new
overlays can then be added using the standard keyboard shortcuts ⌥→ and
⌥← for structured insertion. When applied to overlays, the standard keys F10
and F11 for traversing the presentation have the effect of moving up and down
in the pile of overlays.
By default, all text that is typed by the user will be visible on all overlays. But,
using the filters in the menu Insert „ Fold „ Overlay, it is also possible to create
text that is only visible on specified overlays in the pile. There are four basic
types of visibility filters:

Visible from here on. Text that is visible on this and all subsequent over-
lays.

Visible until here. Text that is visible on this and all previous overlays.

Visible only here. Text that is visible only on this overlay.

Visible except here. Text that is visible on all but the current overlay.

As in the case of unrolling, the “invisible” or “hidden” overlays can be dis-


played in several ways. For standard overlays (which are inserted using Stan-
dard or Compressed in Insert „ Fold „ Overlays), invisible text is simply ignored.
When using Phantoms, the invisible content is rendered using invisible ink;
9.5 DECORATIONS 171

this corresponds to the intuitive concept of a pile of transparent layers. The


last Greyed style displays the ”hidden” overlays, but “greys them out” using
lightly visible ink.
The precise way in which “shown” and “hidden” content are rendered for
overlays is controlled by two tags shown* and hidden* that can be redefined or
customized by the user. In particular, different color alternation schemes can
be specified for a region of text using Insert „ Fold „ Overlay „ Specify color alter-
nation. For instance, in order to achieve the effect mentioned in the example
from Figure 9.3, you may specify a “black to red” color alternation, and then
use a Visible from here on type of overlay.
Instead of switching between “shown” and “hidden” states depending on the
overlay, it is also possible to switch between two alternate texts: depending
on whether a certain predicate is met, we show the “main content” on certain
overlays and the “alternate content” on the remaining ones. TEXMACS provides
the following alternate state switches:

Alternate from here on. The alternate text will be used on this and all sub-
sequent overlays.

Alternate until here. The alternate text will be used on this and all pre-
vious overlays.

Alternate only here. The alternate text will only be used on this overlay.

Alternate except here. The alternate text will be used on all but the current
overlay.

Notice that the implementation of alternations still relies on the shown* and
hidden* tags. In particular, when using the Greyed type of overlays, the
“hidden” alternative will only be greyed out, and superposed with the “shown”
one.
When editing overlays, the focus bar indicates the overlay that you are cur-
rently working on. It also allows you to quickly jump to any of the other
overlays. Similarly, if your cursor is inside a visibility filter, then the focus
bar indicates the overlays on which the tag will be in “shown” state using a
bold font. You may also control the slide on which the visibility changes.

9.5 Decorations
In order to decorate your laptop presentations, TEXMACS provides a few extra
markup elements: granite, manila-paper, metal, pine, ridged-paper, and rough-
paper. These tags will put your content on a nice, natural background, as
illustrated in Figure 9.4. When using the beamer style, these decorations are
available in the Insert „ Prominent menu.
172 LAPTOP PRESENTATIONS

Granite Metal Pine


a2 + b 2 = c2 a2 + b 2 = c2 a2 + b 2 = c2

Manila paper Ridged paper Rough paper


a2 + b 2 = c2 a2 + b 2 = c2 a2 + b 2 = c2

Figure 9.4. Some standard ornaments for decorating your presentations.

9.6 Graphical screens


By default, new screens are textual and untitled. It is possible to transform
a newly created textual screen into a graphical one using Focus „ Draw, or by
clicking on the Draw button on the focus bar. A title may be entered similarly,
using Focus „ Title.
For subsequent screens, the style of the previous screen will be replicated.
Assume for instance that we created a graphical screen with a title. Then newly
inserted screens will automatically be graphical and titled as well. You may
remove a title by selecting it using the mouse and pressing ⌫ . The same holds
for the picture on a graphical screen, but in this case the selection has to be
performed with some care at the extremities of the picture. Indeed, clicking
inside the picture makes you enter the graphics mode.
Graphical screens are essentially pictures that can be edited as explained in
chapter 8. Nevertheless, for pictures in a laptop presentation, a few special
rules apply. The most important changes concern the insertion of new screens
and the manipulation of overlays, which are done via the menus Insert „ Slides,
Insert „ Overlays, and . There is also a special mode for animating graphical
objects (Insert „ Animate objects or ); see section 9.7.3.
The Insert „ Slides menu is a substitute for the top-level focus menu of a slide
show. It allows you to insert or remove screens without leaving the graphics
mode. The first part of the menu has the same purpose.
The Insert „ Overlays menu can be used for the creation and manipulation of
overlays in graphics mode. Graphical overlaying always applies to the entire
picture. An existing picture with a single layer can be transformed into a pic-
ture with more layers using Insert „ Overlays „ Insert overlay before or Insert „
Overlays „ Insert overlay after. As soon as there are multiple layers, each graph-
ical object admits an additional property that controls on which overlays the
object should be visible. This property is shown on the toolbar after Overlay.
It can be modified via the same toolbar or Focus „ Overlay mode, in a similar
way as other properties such as the color. The currently visible overlay is also
indicated on the focus toolbar and a pulldown menu allows you to quickly
jump to any other overlay.
9.7 ANIMATIONS 173

9.7 Animations

TEXMACS includes increasingly good support for animations in laptop presenta-


tions. Although a few cleverly placed animations can make your presentation
slick and impress the audience, one should always be careful to not overuse
this feature. Indeed, animations tend to grab all attention and thereby dis-
tract from the actual content of your talk.
You should always ask yourself how, and if, animations add something mean-
ingful to the main discourse, rather than providing a superficial amusement.
For instance, an animated arrow between two text boxes naturally directs atten-
tion from one point to another, whereas a progressively appearing text or an
impressive three dimensional screen transition is usually more “for show”.
Nevertheless, progressively appearing text may be appropriate when unfolding
output of a computation, so as to remind of the fact that computations usu-
ally need time. Even drastic animations may be appropriate at key moments
of a talk: at the very start or end, when stating the main theorem, or when-
ever a little show can help relax the audience.
TEXMACS provides three main types of animations: basic animated effects, user-
composed animations, and transformed animations. Some of the mechanisms
are reminiscent of the ones described in the previous subsections for switches,
overlays, etc., except that here time is continuous rather than discrete. Other
atomic animations are “animated gif pictures”, which can be inserted from
Insert „ Animation „ Animation, and sounds, which can be inserted from Insert „
Animation „ Sound. Support for movies should be added later.

Each animation in a presentation comes with its own individual player and it
starts as soon as it appears. For example when unrolling a list of animations,
a new animation will appear and be played every time that you press F11 ; the
animations that were already started before will just keep playing. You may
use the ⌃F12 keystroke in order to replay all currently visible animations.

9.7.1 Basic animations

The most basic animations allow you to make some content appear or disap-
pear gradually. TEXMACS provides various ways for doing this in the menus
Insert „ Animation „ Appear and Insert „ Animation „ Vanish.

For instance, assume that you wish to let the greeting “Hello
Hello world”
world grad-
ually fade in. After typing the text, it suffices to select it, and apply Insert „
Animation „ Appear „ Fade. On the focus toolbar, you will see a Duration field
that you may use to specify the length of the animation. The duration can
also be decreased or increased using the shortcuts ⌘← and ⌘→ . We recom-
mend durations between 0.25s and 1s. Besides fading in, TEXMACS supports
gradual sliding (Translate), progressive uncovering (Progressive), and zooming
in (Zoom): see Figure 9.5.
174 LAPTOP PRESENTATIONS

Effect t=0 t= 3 t= 3 t=1


1 2

Translate Hello worldworld


Hello world
Hello
Hello
world
world Hello world
Progressive Hello Hello Hello world Hello world
Fade Hello world Hello world Hello world Hello world
Zoom Hello world Hello
Hello world
Hello world world Hello world Hello world
Hello world

Figure 9.5. Animations for gradual appearance of text.

Effect t=0 t= 3 t= 3 t=1


1 2

Translate Hello worldworld


Hello world
Hello
Hello
world
world Hello world
Translate Hello worldHello
Hello world
HelloHello
Hello
world
world
Hello world
Translate Hello world Hello
Hello world
world Hello
Hello world
world Hello world
Hello world Hello
Translate Hello world Hello world
world Hello
Hello world
world Hello world
Progressive world Hello world Hello world
Progressive Hello world Hello world Hello world
Progressive Hello world Hello world Hello world Hello world
Progressive world Hello world Hello world Hello world

Figure 9.6. Sliding in and progressive appearance of text for various directions.

For each of the appearance and vanishing effects, the focus toolbar also con-
tains fields with additional parameters for the animation. In the case of fading
in, this allows you to specify the initial intensity. In the case of translations,
you may specify the direction in which the sliding takes place, either using
the icon, or using the more detailed fields Start x and Start y. The default
direction for both Translate and Progressive is from left to right. The effect of a
few other directions is illustrated in Figure 9.6.
The appearance and vanishing animations are special cases of “alterations”.
When applying a general translation Insert „ Animation „ Alter „ Translate to
some piece of text, you may specify arbitrary positions for both the start and
the end. This may be useful if you want to insert an animation that shows the
“end credits” (or references) for your presentation. In that case, you should
specify 0 for both Start x and End x, take −1 for Start y, and 1 for End y. Notice
that the animations described so far only work for inline content. In order to
apply them to block content (i.e. text that runs over multiple lines or para-
graphs), you should put your text inside a table and enable line wrapping.

t=0 t= 4 t= 2 t= 4 t=1
1 1 3

daddy
Thanks to Thanks to Thanks to Thanks to Thanks to
granny
mommy mommy mommy mommy mommy
sissy
daddy daddy daddy daddy daddy
Thanks to
granny granny granny granny granny
mommy
sissy sissy sissy sissy sissy
daddy
Figure 9.7. Animation for the end credits.
9.7 ANIMATIONS 175

Effect t=0 t= 3 t= 3 t=1


1 2

Shadowed Hello world Hello world Hello world Hello world


Emboss Hello world Hello world Hello world Hello world
Outlined emboss Hello world Hello world Hello world Hello world

Figure 9.8. Three dimensional animations for emphasizing text.

Further basic animations are available in Insert „ Animation „ Emphasize. The


purpose of these animations is to emphasize text through an animation that
catches the eye. Currently, three different kinds of three dimensional “jumping
out” have been implemented: see Figure 9.8.

9.7.2 Merging and time bending


There are several ways to transform existing animations or combine them into
new ones. By default, when playing two animations next to one another, they
are played simultaneously. Using Insert „ Animation „ Compose, it is also pos-
sible to play several animations one after another. The individual elements of a
composed animation are typically fixed animations of a given duration, which
can be inserted using Insert „ Animation „ Fixed. You may also use moving or
progressive content as a building block. An animation can be repeated indefi-
nitely using Insert „ Animation „ Repeat. This may for instance be used to create
blinking text.
Another type of transformation is “time bending”, which amounts to accel-
erating certain parts of the animation while decelerating others. For the basic
animations from the previous subsection, the playing rhythm can be modified
via Focus „ Time evolution or the menu on the focus toolbar. For general
animations, time bending can be applied using Insert „ Animation „ Retime.
The most useful type of time bending consists of making the animation start
and/or end more smoothly. This corresponds to what happens if you physi-
cally move an object: indeed, it always takes some time to acquire speed. It is
often a good idea to end appearance animations smoothly. Another supported
time transformation is “bumping”, in which case the animation is played and
then replayed in the reverse direction. This is often nice for animations that
temporarily draw attention to some text. We finally note that the time evolu-
tion can be reversed by toggling Focus „ Time evolution „ Reverse. This turns an
appearance animation into a vanishing one and vice versa. The types of time
bending that we just discussed are illustrated in Figure 9.9.

Normal Smooth end Smooth Bump Reversed

Figure 9.9. Some available time bending modes.


176 LAPTOP PRESENTATIONS

t = t0 = 0 t= 3 t= 3 t = t1 = 1
1 2

Figure 9.10. Simple example of morphing.

9.7.3 Continuous deformations


One of the most powerful mechanisms in TEXMACS for the creation of anima-
tions is morphing. The idea is to explicitly create a finite number of control frames
at times t 0 < t 1 < ⋅ ⋅ ⋅ < t l−1 < t l. At intermediate times t i < t < t i+1, the content
to be displayed is the result of a continuous deformation of the frame at time
t i into the frame at time t i+1.
A simple example with just two control frames t 0 = 0 and t 1 = 1 is shown in
Figure 9.10. Continuous deformations are only possible between similar objects.
For this reason, the two control frames both contain an octagon; the only dif-
ferences are the positions of the control points and the fill color.
In general, all numerical quantities, lengths, and colors can be morphed. Those
parts of the control frames that differ in any other ways will usually not deform
continuously. For example, TEXMACS cannot continuously deform “Hello” into
“Hello”, but it can continuously deform the slope of slanted text that was entered
using Format „ Font effects „ Slanted: hello → hello → hello → hello . Indeed, this
slope is a numerical parameter that can be specified on the focus toolbar. Other
tags with numerical, length or color parameters can be animated similarly.
For animations of large pieces of text or graphics, the TEXMACS morphing algo-
rithm attempts to automatically detect objects in the control frames that can be
morphed one into another. This is useful when animating a picture in which
some of the graphical objects may appear or disappear depending on the con-
trol frame. However, one should not expect any miracles: if the detection algo-
rithm fails on a given object, then continuous morphing will be disabled for
this object.
In order to animate an existing piece of text or graphics, you must select it
using the mouse, and do Insert „ Animation „ Animate. You will be prompted
for the duration of the animation and an animation toolbar will automatically
appear with a timeline (you may also use View „ Animation toolbar for control-
ling the visibility of this toolbar). By clicking on the timeline, you may move
to the corresponding control frame and edit it. As soon as you are done, press
the button in order to activate your animation.
The rendering of a document fragment often depends on parameters such as a
color, the position of some object, or the slope of slanted text. Nice animations
can be obtained by continuously modifying such parameters. For instance, if
9.7 ANIMATIONS 177

you wish to progressively embolden some text, then you may proceed as fol-
lows:
1. Select the text and embolden it using Format „ Font effects „ Embold.
2. Set the initial emboldening strength to 0 in the focus toolbar.
3. Select the text (together with the embold tag) and do Insert „ Animation „
Animate.
4. In the time line, go to the last control frame of the animation.
5. Set the final emboldening strength to the desired value.
6. Watch your animation by pressing the button.
You may re-edit the animation using the icon on the animation toolbar. It is
also possible to replay the animation as many times as you wish using the
button or ⌃F12 .
Concerning the timeline, we note that the current frame is indicated via an
asterisk *, whereas control frames are indicated using plus signs +. You may
suppress a control frame using the button, and replace the entire anima-
tion by the current frame using . When animating a graphical picture, the
timeline contains a few additional icons that allow you to specify when newly
inserted objects should become visible or invisible. For example, assume that
we are editing an animation of ten seconds and that the current frame cor-
responds to the frame when t = 5s. If you are in the default mode, then a
newly inserted curve will be visible between t = 5s and t = 10s. In the mode,
it will rather be visible between t = 0s and t = 5s. In the mode, the curve will
be visible throughout the whole animation.

9.7.4 Graphical animations


The morphing mechanism from the previous section regards your animation
as a succession of frames that are edited on a frame-by-frame basis. An alterna-
tive point of view is to regard an animation as a collection of animated objects
that live their own lives and that can be edited on an object-by-object basis.
Inside a graphical picture, individual objects can be animated according to
this philosophy. This is most adequate if you wish to sprinkle an existing pic-
ture with a few animated elements.
In order to animate one of the objects inside a picture, you should select the
animation mode using or Insert „ Animate objects. It is recommended that
you also activate the animation toolbar using View „ Animation toolbar. When
clicking on a graphical object such as a line segment, a Status field appears on
the focus bar. The default “inanimated” status can be changed via the popup
menu that opens when you click on it. TEXMACS offers the following types of
animations (see Table 9.11):
Ink in. Emulate the movement of a pen that draws a curve. This is most
useful for animated arrows that progressively point from a starting point
to some end point.
178 LAPTOP PRESENTATIONS

Effect t=0 t= 3 t= 3 t=1


1 2

A A A A
Ink in

B B B B

A A A A
Ink out

B B B B

Fade in

Fade out

Animated

Figure 9.11. Basic graphical animations.

Ink out. The same as Ink in, but it the reverse direction. This allows you for
instance to obtain a “retracting arrow”.

Fade in. Smoothly increase the opacity from 0% to 100%.

Fade out. Smoothly decrease the opacity from 100% down to 0%.

For more general animations, you may use Focus „ Status „ Animated. This
option works similarly to the morphing mechanism that we explained in the
previous section: the animation toolbar displays a time line and you may edit
the control points of your graphical object at different times. The last row in
Figure 9.11 shows an example: we first drew the filled glass at t = 1, then ani-
mated the object, and finally moved the two upper control points of the yellow
liquid at t = 0 so as to coincide with the two lower control points.
Graphical animations of the type that we just described have the advantage
that they behave similarly to ordinary graphical objects in many respects. For
example, it is easy to move an entire animation to a different place in the pic-
9.8 EXPORTING BEAMER PRESENTATIONS 179

ture or to copy and paste it. On the other hand, the control points can only be
edited in the individual time frames attached to the animation.

9.8 Exporting beamer presentations


At certain venues, it is not possible to use your own laptop for making pre-
sentations. In such cases the organizers often impose a specific file format for
presentations such as PDF or POWERPOINT. TEXMACS has native support for
exporting a beamer presentation as a PDF file. This works well for basic pre-
sentations, but there are several quirks if you make use of all functionality
provided by TEXMACS:

• Although the PDF reference format specifies mechanisms for the inclu-
sion of animations and 3D graphics, most PDF viewers do not implement
these features. For this reason, TEXMACS animations are not exported
to PDF.

• Various other “dynamic” types of markup are not exported to PDF. For
instance, you may run an external computer algebra system inside a
TEXMACS presentation, but only the final output can be exported to PDF.

When exporting a presentation, TEXMACS emulates the traversal of the docu-


ment using Dynamic „ Next and generates one page for every next state. In
particular, if your presentation contains folded or unrollable elements, then
your PDF typically contains far more pages than the number of slides in your
original presentation.
Note that the PDF export facility also provides a user preference Edit „ Prefer-
ences „ Convert „ Pdf „ Expand beamer slides. This technical option is somewhat
tricky to explain, but if you are not happy with the PDF export of a presenta-
tion, then it may be worth it to try this setting and check whether it improves
things for you.
At present, beamer presentations cannot be exported to LATEX. Fortunately,
such conversions are rarely needed: you usually do not send your presen-
tations to publishing companies that tend to bother authors with specific docu-
ment formats and presentation styles.
Chapter 10
Special editing facilities

In this chapter, we discuss some of the general editing facilities that are imple-
mented in TEXMACS. Of course, this includes basic operations that can also be
found in other editors: “cut and paste”, “search and replace”, etc. But, more
interestingly, some of these facilities take advantage of the additional struc-
ture of TEXMACS documents. Typical examples of structured editing features are
“structured cursor movement” and “structured variants”. Traditional opera-
tions such as “search and replace” can also exploit the document structure. For
instance, when searching x in math mode, you will only find matches that are
also in math mode.

10.1 Cut and paste

You can select text and formulas by moving the mouse while holding the left
button. In order to delete the selected region, use Edit „ Cut or ⌃w ; to copy it, use
Edit „ Copy or ⌘w . Next, paste it as many times as you want using Edit „ Paste
or ⌃y . Alternatively, you may copy a selected region using the middle mouse
button.
It is also possible to change the text properties of a selected region. For instance,
in order to make some black text red, you select it using the left mouse button
and select the desired red color in Format „ Color. Similarly, if you select
a formula and click on Insert „ Fraction, then the formula becomes the numer-
ator of the new fraction.
When using the copy and paste mechanism to communicate with another
application, TEXMACS and the application first have to agree on a data format.
TEXMACS accepts multiple formats for pasted text; by default, it uses its own
format for copying. Copying and pasting data in other formats is possible
using Edit „ Copy to, Cut to, and Paste from. For instance, a LATEX formula can
be pasted inside a TEXMACS formula using Edit „ Paste from „ LaTeX. You may
also specify your preferred default import and export formats using Tools „
Miscellaneous „ Import selections as and Export selections as.

By default, copying and pasting uses the “primary clipboard”. Using the Edit „
Copy to, Cut to, and Paste from menus, you may specify as many other clip-
boards as you like. This allows you to keep multiple selections in memory,
ready to be pasted.

180
10.2 SEARCH AND REPLACE 181

There are two ways to make selections using the keyboard. The first way is
to use the cursor keys ← , → , etc. while simultaneously holding down the shift
key ⇧ . Alternatively, you may press ⌃␣ once to set a starting position. When
moving around using the cursor keys, the text between the starting position
and the current position keeps being selected. The selection gets cleared by
pressing ⌃g .

Notice that the ⌃␣ shortcut also allows you to make structured selections. You
may select the current word by pressing ⌃␣ twice. Each additional time you
press ⌃␣ results in the selection of the smallest structure that encompasses
the current selection. Ultimately, when the entire document gets selected,
pressing ⌃␣ once more clears the selection.

10.2 Search and replace

Textual search and replace

You can start searching text by pressing ⌃s or Edit „ Search. Doing this, a new
special “search toolbar” will appear below the main text, just above the footer.
When typing text in the search field of the toolbar, all occurrences of this text
will be highlighted in the main document. Moreover, one “principal” occur-
rence will be highlighted in red and you may navigate through all occurrences
using ⇞ and ⇟ (or ↑ and ↓ , or ↩ ). Using ↖ and ↘ , you may jump to the first
and last occurrences. As soon as you press the escape key ⎋ , the search toolbar
will be closed, searching stops, and focus returns to the main document.

During a search, TEXMACS only looks for text in the same mode and language as
at the position where you started your search. In other words, when searching
for x in math-mode, you will not find any x's in ordinary text (which are usu-
ally irrelevant). As a current limitation, the search string on the search toolbar
can only contain ordinary text and no math-symbols or structured text. Below,
we will discuss a mechanism that allows you to search for more general math-
ematical symbols and formulas.

In order to replace text, you should use Edit „ Replace or press ⌃= . This will
cause a special “replace toolbar” to appear below the main text, just above the
footer. The search field of this bar contains the string to search for, whereas the
replace field contains the string to replace with. Again, you may use the ⇞ and
⇟ keys in order to navigate through the occurrences of the search string. When
pressing ⇥ or ↩ in the search field, focus will be moved to the replace field.
You may still use the ⇞ and ⇟ keys in order to navigate through the occur-
rences of the search string. In addition, pressing ↩ will replace the principal
occurrence of the search string by the replace string. Using ⇧↩ , you may undo
the last replacement. You may replace all remaining occurrences by pressing
⌃↩ . As in searching, the query-replace command is mode and language sensi-
tive.
182 SPECIAL EDITING FACILITIES

General search and replace


The search and replace toolbars are quite rudimentary in the sense that they
only allow for searching and replacing plain text. By pressing the icon on
either of these toolbars, you may expand the toolbar into a full-blown window
with larger search and replace fields that may contain arbitrary markup.
Searching and replacing can be done using more or less the same keyboard
shortcuts as with the toolbars, but you may now search and replace arbitrary
content. In order to switch back to the toolbar methods for searching and
replacing, you have to click on the icon.
When searching non-textual content, the conditions for a match are somewhat
relaxed. For example, assume that you are just starting a new search with an
empty search field. Then typing F6 inserts the strong tag with no text inside
yet. Instead of looking only for “strong empty strings”, TEXMACS will look for
all strong markup in your document. If you next enter the letter “a”, then
TEXMACS will look for all strong text that contains the letter “a”. In a similar
x
way, when searching for the formula , TEXMACS will highlight all fractions
in which the numerator contains the variable x. Yet another example: a search
for √x will highlight all formulas in which the denominator contains a square
a+b
root that contains the variable x. For instance, the fraction will be high-
x+y c+ x+y
lighted, but not .
a+ y

When using the structured search and replace widgets, TEXMACS also imple-
ments a few additional special tags for enhancing structured searching. First
of all, it can happen that you need to search for certain content inside a special
context. For example, you might want to search for all occurrences of the letter
“a” inside a strong tag. When searching for a, as above, TEXMACS will highlight
all strong tags that contain the letter “a”. In order to highlight the letters “a”
themselves, you should first insert the strong tag inside an empty search field
using F6 . You next type ⌃? to insert a special select-region tag, and finally
enter the letter “a” inside this tag.

10.3 Spell checking


If the ispell program or any compatible substitute has been installed on
your system, then you may use it to check your text for misspelled words by
pressing ⌘$ or Edit „ Spell. Of course, you will also need the dictionaries cor-
responding to the languages in which your texts are written; ispell usually
comes with an English dictionary.
The interface for spell checking is similar to the one for searching and replacing
text. Misspelled words are highlighted in the same way as search hits. You may
again navigate through the highlighted words using ⇞ and ⇟ (or ↑ and ↓ ).
There is also a spell bar just above the status bar to assist you with the cor-
rection process.
10.5 STRUCTURED EDITING 183

More precisely, given a highlighted incorrect word, the spell bar proposes a list
of possible corrections. You may select one of these corrections by typing the
corresponding number or by pressing the corresponding button on the spell
bar. In the absence of a suitable correction, you may explicitly enter one inside
the Correct field on the spell bar, followed by ↩ .
It may also happen that a correct word was not in the dictionary. In that case
you may add it to the dictionary by typing + or by pushing on the spell bar.
If you are not sure, but temporarily wish to accept the word, then you may
press ⇥ or .
If your document contains text in other languages, don't forget to correctly
specify the language for every piece of foreign text using Insert „ Language. In
that case, TEXMACS will automatically use the corresponding dictionaries when
performing a spell check.

10.4 Undo and redo

It is possible to gradually undo the changes you made in a document from the
moment that you launched TEXMACS. This can be done via Edit „ Undo or using
the keystroke ⌘[ . Undone changes can be “redone” using Edit „ Redo or ⌘] .
TEXMACS maintains the entire “history tree” of all your edits. This history is not
necessarily linear; multiple branches in the history tree may arise as follows:
type “a”, undo the insertion of “a”, type “b”, and then again undo the insertion
of “b”. At this point, there are two redo options: the reinsertion of “a” and the
reinsertion of “b”. In such cases, Edit „ Redo becomes a menu in which you can
select the appropriate branch.
The undo system takes into account changes in the document itself only. In
particular, modifications of most of the global document properties can not be
undone. This includes modifications of the document style, the page size, the
main font, etc. The same remark applies to any modifications outside TEXMACS
that were triggered by your actions. For instance, in a computer algebra ses-
sion, you can undo your edits inside TEXMACS, but not the computations in the
external computer algebra system.

10.5 Structured editing

The behavior of most structured editing operations is conditioned by the


current focus. By default, the focus is on the innermost tag that contains the
cursor. Whenever some selection is active, the focus is rather on the inner-
most tag that contains the selection. Occasionally, during certain structured
editing operations, the focus may be determined in an ad hoc manner. The
current focus is visually indicated through a cyan box around the cursor.
184 SPECIAL EDITING FACILITIES

(( da b|e cf )) (( da be | cf )) (( da | be cf )) ((( a b| c ))) ((( a b| c )))


(( d e f )) (( d e f ))
Figure 10.1. Assume that the cursor is at | inside the left-most matrix. Then the four other
matrices respectively correspond to the insertion of a new column at the right ( ⌥→ ) or
left ( ⌥← ), or a new row below ( ⌥↓ ) or above ( ⌥↑ ).

a a a a a

b c| d b|c d b c|d b | d b c d

c |
Figure 10.2. Assume that the cursor is at|inside the left-most tree. Then the four other trees
respectively correspond to the insertion of a new node at the left ( ⌥← ), at the right ( ⌥→ ),
above ( ⌥↑ ) or below ( ⌥↓ ).

As a first example, consider the structured insertion commands ⌥← , ⌥→ , ⌥↑ ,


and ⌥↓ . These operations are applicable inside both tables and trees, but with
slightly different semantics. Inside tables, they allow you to insert new rows
and columns (see figure 10.1). Inside trees, they correspond to the insertion
of new nodes (see figure 10.2). If you are inside a tree inside a table, then the
innermost tag is a tree, so the current focus will be on the tree. Consequently,
node insertions take precedence over the insertion of new rows and columns.
Similarly, still in the case of tables, the keys ⌥↖ , ⌥↘ , ⌥⇞ , and ⌥⇟ can be used
for inserting a new first or last column, or a new first or last row. The keys ⌥⌫
and ⌥⌦ are mapped to the commands for backward and forward structured
deletion. For tables, this will result in the removal of the column before or after
the cursor (see figure 10.3). In order to remove the enclosing environment you
may use ⌃⌫ .

10.6 Structured cursor movement

TEXMACS implements three main types of structured cursor movement:

1. Traversal of the entire structure of the document.

2. Traversal of tags that are similar to the innermost tag.

3. Movements inside the innermost tag.

Most keyboard shortcuts for structured cursor movements can also be used in
combination with the ⇧ -key so as to simultaneously select text while moving
around.
10.7 STRUCTURED VARIANTS 185

(( da b|e cf )) (( b|e cf )) (( da |cf )) b|

Figure 10.3. Assume that the cursor is at | inside the left-most matrix. Then pressing the
keys ⌥⌫ and ⌥⌦ respectively result in the next two matrices. Pressing ⌃⌫ replaces the
matrix by the content of the cell with the cursor, leaving you with the b at the right-hand
side.

Structured traversal of the document


The ⌃← , ⌃→ , ⌃↑ , and ⌃↓ shortcuts are used for the structured traversal of the
entire document. Inside plain text, ⌃← and ⌃→ allow you to move in a word-
by-word manner, whereas ⌃↑ and ⌃↓ correspond to paragraph-by-paragraph
motion.
In the presence of other markup, the ⌃← and ⌃→ shortcuts allow you to visit
all accessible cursor positions in the document, except that we keep moving
in a word-by-word manner inside plain text. The behavior of the ⌃↑ and ⌃↓
shortcuts is more context-dependent. Inside matrices, they typically allow you
to move one row up or down.

Traversal of tags that are similar to the innermost tag


This type of cursor movement allows you to quickly visit all other tags in the
document that are similar to the innermost tag. The ⌃⇞ and ⌃⇟ shortcuts allow
you move to the previous or next similar tags, whereas ⌃↖ and ⌃↘ directly
jump to the first or last similar tags.
For example, if you are inside a section title, then you may move to the pre-
vious sectional title using ⌃⇞ . Subsection and chapter titles are in particular
understood to be “similar” to section titles. Notice that you may use ⌃§ to
jump to the title of the section you are editing.

Movements inside the innermost tag


It is also possible to quickly move inside the innermost tag without quitting
it. The shortcuts ⌘⌥← , ⌘⌥→ , ⌘⌥↖ , and ⌘⌥↘ allow you to move to the previous,
next, first, or last argument of the innermost tag. Furthermore, the shortcuts
⌘⌥⌫ and ⌘⌥⌦ may be used to exit the innermost tag on the left or on the right.

The behavior may be different in special contexts. For instance, inside tables
or trees, the above shortcuts rather correspond to cell-by-cell or node-by-node
cursor movement. In addition, these cases associate vertical cursor movements
to ⌘⌥↑ , ⌘⌥↓ , ⌘⌥⇞ , and ⌘⌥⇟ .

10.7 Structured variants


When creating an environment like a theorem, an equation, or a list, it often
happens that you need to change the environment a posteriori. The keyboard
shortcuts ⌃⇥ and ⌃⇧⇥ allow you to cycle through the list of structured variants
of the innermost tag, in forward or backward direction, respectively.
186 SPECIAL EDITING FACILITIES

For instance, assuming that you are inside a theorem, pressing ⌃⇥ several times
will change the theorem into a proposition, a lemma, a corollary, a conjecture,
and finally back into a theorem. The ⌃⇧⇥ key allows you to cycle in the reverse
direction: theorem → conjecture → corollary → lemma → proposition → the-
orem. Note that you may also select the desired variant in Focus „ Theorem
or using the Theorem menu on the focus bar.
In the case of mathematical formulas, the ⌃⇥ shortcut allows you to change an
inline formula such as a 2 + b 2 = c 2 into the displayed formula

a 2 + b 2 = c 2.

The editor takes care of potential “trailing spaces and punctuation signs”.
TEXMACS also provides the ⌃# shortcut for turning numbered environments
into unnumbered ones and vice versa (which is equivalent to the icon on the
focus bar). This works for most common environments like theorems, remarks,
tables, equations, etc. Notice that ⌃# also turns an unnumbered itemize envi-
ronment into an enumeration and vice versa, whereas ⌃⇥ allows you to cycle
between the available kinds of list items (bullets, dashes, arrows, etc.).
Folding and unfolding provides yet another interesting example of toggling
between several environments. Inside a computer algebra session such as

Pari] factor (x^15 - 1)

(( x−1 1)

%1 = (((( x + xx ++ xx ++1x + 1 11 )))))


2

(( x − x + x − x + x − x + 1 1 ))
4 3 2

( 8 7 5 4 3
)
you may click on “Pari]” in order to fold the output (i.e. only the input remains
visible) and click once again in order to unfold back to the original state. The
⌃* shortcut achieves the same effect. There are various other foldable envi-
ronments, most of which are available through Insert „ Fold.

10.8 Positioning and resizing objects


The prefix ⌘ may be used for positioning and resizing objects. For instance,
inside a cell of a table, you may use ⌘→ to align the cell more to the right (so
a left-aligned cell becomes centered, whereas a centered cell becomes right-
aligned). Behind a space introduced via Format „ Space, the same shortcut
allows you to increase the width of space. More generally, the following short-
cuts are implemented:

⌘← . Decrease the horizontal size of an object, or align more to the left.

⌘→ . Increase the horizontal size of an object, or align more to the right.


10.9 VERSIONING TOOLS 187

⌘↓ . Decrease/increase the vertical size of an object, or align farther down.

⌘↑ . Increase/decrease the vertical size of an object, or align farther up.

⌘↖ . Decrease the horizontal offset of an object, or left align.

⌘↘ . Increase the horizontal offset of an object, or right align.

⌘⇟ . Decrease the vertical offset of an object, or align at the bottom.

⌘⇞ . Increase the vertical offset of an object, or align at the top.

⌘⌫ . Revert the geometry (size, position, alignment) to the defaults.

⌘⌃⇥ , ⌘⌃⇧⇥ . Cycle among the available length units for specifying the geom-
etry.

⌘⌃[ , ⌘⌃] . Decrease or increase the step size when positioning or resizing.

These shortcuts apply in particular to the following tags:

Spaces. Both horizontal and vertical spaces from the Format „ Space menu.
You should put the cursor just after the space tag for the shortcuts to
apply.

Box modifiers. The tags move, shift, resize, extend, clipped, smash, inflate
from the Format „ Adjust menu.

Animations. The durations can be modified using ⌘← and ⌘→ .

Images. The size and alignment of images can be changed.

10.9 Versioning tools

When writing documents in collaboration with others, one frequently needs


to review changes made by coauthors and either accept, discard, or further
correct them. The integrated versioning tool has been designed to facilitate
this task. After enabling it through Edit „ Preferences „ Utilities „ Versioning tool,
a special Version menu appears in the main menu bar.
Independently from TEXMACS, there exist many programs for “version con-
trol”, such as SUBVERSION [6, 7], GIT [62, 51], DARCS [49], GNU BAZAAR [45],
etc. These systems are complementary to the built-in versioning system; they
operate on the level of the file system and in particular allow you to maintain
several versions of a document. TEXMACS currently provides a rudimentary
support for SUBVERSION, but interfaces for other versioning systems could
easily be added.
188 SPECIAL EDITING FACILITIES

Comparing two versions

Assume that we have two versions old.tm and new.tm of the same document.
In order to see the changes, first load the newer version new.tm, then click on
Version „ Compare „ With older version, and select the older version old.tm. The
buffer will still be named new.tm, and the changes between both versions will
be indicated by special markup. If there are any changes, then the cursor will
be positioned at the first difference. Similarly, you may compare the current
buffer with a newer version on disk using Version „ Compare „ With newer ver-
sion.

It is possible to go through all the differences between the old and new versions
either from the items in the submenu Version „ Move, or using the keyboard
shortcuts ⌃↑ and ⌃↓ . You may also use the general structured navigation
shortcuts ⌃↖ , ⌃↘ , ⌃⇞ , and ⌃⇟ .

Visualization of the differences

Differences between the two versions can be displayed in three ways: by


showing only the old version, only the new version, or both versions simul-
taneously. In all cases, the old version is displayed in dark red and the new
version in dark green: see Figure 10.4.

The visualization style can be specified individually for each individual change,
via Version „ Show or the keyboard shortcuts ⌃← (old version), ⌃→ (new ver-
sion) and ⌃| (both versions). One may also cycle through the different styles
using the structured variant key ⌃⇥ . If you selected some text, then the above
actions will apply to the whole selection. In particular, by selecting the entire
file, you can visualize the older or the newer version, or both versions.

Retaining a specific version

When going through the changes between two versions, it is possible to retain
either one or the other version for each individual difference. Assuming that
the cursor is inside a given difference, this can be done via the submenu Ver-
sion „ Retain. Alternatively, you may use the shortcuts ⌃1 , ⌃2 , and ⌃↩ to retain
the old, new, and currently displayed version, respectively. If both versions are
displayed, then ⌃↩ retains the new version. After retaining one of the versions,
we automatically jump to the next difference, which can then be processed.

If you selected some text, then any of the above actions will retain the appro-
priate version for each of the differences in the selection. This applies in partic-
ular to the case when you select the entire document. A more conservative
approach to process all differences between two versions is to first review them
with ⌃↑ and ⌃↓ while selecting your preferred versions with ⌃← and ⌃→ . Only
at the very end, once you are sure about your choices, you select the entire
document and click on Version „ Retain „ Current version.
10.9 VERSIONING TOOLS 189

The old version of a text text with some words. Old version
The new version of a text with some extra words. New version
The oldnew version of a text text with some extra words. Both versions
Figure 10.4. Three ways to display the differences between two versions.

Detailed grain Block grain


Modern life Modern life
When woringworking in haisthaste, it When woring in haist, it is likely that
is likely that your text will be full of your text will be ful of typos. Odds are
typos. Odds are also high that more also high that more serious mathemat-
serious mathematical mistakes will ical mistakes will ruin your efforts.
ruin your efforts.
When working in haste, it is likely that
a12 +⋅⋅⋅+an2n(a12 +⋅⋅⋅+ your text will be full of typos. Odds
2 are also high that more serious mathe-
an2) ⩾ (a1 + ⋅ ⋅ ⋅ + an)
matical mistakes will ruin your efforts.

a12 + ⋅ ⋅ ⋅ + an2 ⩾ (a1 + ⋅ ⋅ ⋅an)2

n (a12 + ⋅ ⋅ ⋅ + an2) ⩾ (a1 + ⋅ ⋅ ⋅ + an)2


Figure 10.5. Alternative grains for visualizing differences.

Grain control and recomputing the differences


The entries in the submenu Version „ Grain allow you to control the grain at
which differences between versions are computed. By default, we use the finest
grain Detailed. It is also possible to compute differences on a paragraph-based
level, using Block. In that case, the entire paragraphs in which a change occurs
are highlighted, as illustrated in Figure 10.5. The roughest grain Rough will
highlight the entire text, if a change occurs somewhere inside.
The grain is used when comparing two documents using Version „ File „ Com-
pare, but it is also possible to change the grain for a selected portion of text. In
particular, this can be applied on the entire buffer. Similarly, if you change the
grain inside a difference, then the difference will be recomputed using the new
grain.
Note that you may also “change” the grain to the current grain. This has the
effect of updating the differences inside a selection or the current difference at
the cursor position. This may be useful if you changed one of the two versions.
For instance, assume that the old version contained a theorem and that the
theorem was changed into a lemma in the new version while also modifying
parts of its body. When visualizing the changes, the whole theorem will be
highlighted, since there is no appropriate markup to indicate the mere change
from a theorem into a lemma. Therefore, if we want to compare the bodies, the
solution is to first turn the old theorem into a lemma, and then to update the
differences.
190 SPECIAL EDITING FACILITIES

Using external programs such as SUBVERSION for version control


If the file you are editing belongs to a directory that is under version con-
trol (only SUBVERSION is currently supported, although other systems might
follow), then the Version menu contains a few extra entries.
First of all, if the current buffer is under version control, then you may take a
look at its history using Version „ History. The history contains a list of hyper-
links to older revisions, together with short information about who changed
what and when. Older revisions cannot be saved, but you may compare them
with the current user version (on disk or being edited) using Version „ Com-
pare „ With current user version.

After making some changes to a file under version control, the version inside
the editor or on disk no longer corresponds to the version in the repository.
Using Version „ Commit, the current version can be committed to the reposi-
tory. When doing so, you will be prompted for a small explanatory message
about the changes that you have made. A file that is not yet under version
control can be added to the version control system using Version „ Register.
Registering a file does not commit it to the repository: you still have to use
Version „ Commit in order to do so.

If the repository version of the file was modified while you were editing the
local one, then you may merge both versions using Version „ Update. No mech-
anisms for conflict resolution have been implemented yet, although this is
planned for the future.
Chapter 11
Scientific computations
A major feature of TEXMACS is the capability to delegate mathematical com-
putations to external plug-ins and present the results inside the editor. For
computer algebra systems and other scientific software, this is typically done
in shell-like sessions: you simply type the commands to be evaluated, after
which TEXMACS presents the results in a nice, graphical way. Some systems
can also be used in alternative ways, e.g. in order to evaluate a selected expres-
sion inside a formula, or as the computational engine of a spreadsheet.
One special plug-in that is always supported is SCHEME. This purified variant
of LISP is one of the standard extension languages for the GNU project. Many
aspects of the TEXMACS user interface (such as the menus, the keyboard short-
cuts, etc.) can be extended or customized using the SCHEME programming lan-
guage (see chapter 14). SCHEME sessions can in particular be used to test such
customizations on-the-fly.
Another plug-in that is usually present is BASH, the “Bourne-Again Shell”. This
allows you to evaluate operating system commands from within the editor.
The availability of additional plug-ins depends on the software that is installed
on your computer. TEXMACS automatically activates a plug-in whenever the
corresponding external program is detected on your computer. See Help „ Plug-
ins for the list of existing plug-ins and specific documentation on each of them.

11.1 Shell-like sessions


11.1.1 Starting and ending sessions
A new session can be started from the Insert „ Session menu. As explained
above, it is always possible to start a SCHEME session using Insert „ Session „
Scheme; BASH sessions are usually also available via Insert „ Session „ Shell.
The further items in the Insert „ Session menu depend on the plug-ins that are
installed on your system.
A session consists of a sequence of input and output fields and optional text
between them. When pressing ↩ inside an input field of a session, the input text
is evaluated and the result is displayed in an output field. A simple example
of a SCHEME session goes as follows:
Scheme] (+ 1 1)
2
Most plug-ins rely on an external application for computations. When you start
a new session for the first time, TEXMACS automatically launches this external
application in the background. The process that is launched in this way will
be shared by all subsequent sessions for the same plug-in: when “starting”

191
192 SCIENTIFIC COMPUTATIONS

another session, you are actually continuing the previous session at another
place in your documents. In particular, if you launched a long computation,
then you will have to wait until it completes.
Some plug-ins allow you to interrupt long computations using Focus „ Inter-
rupt execution, or using the icon on the focus toolbar (assuming that your
cursor is inside the session). This makes it possible to proceed with other com-
putations in the current environment of your session. Unfortunately, “soft
interruptions” of this kind have been implemented in very few plug-ins only,
for the time being.
You may always force the external application to quit using Focus „ Close ses-
sion or , at the expense of losing your computational environment. When
pressing ↩ in the input of a system that is not, or no longer running, the system
will be restarted automatically. In order to re-evaluate all fields of an existing
session, you may use Focus „ Evaluate „ Evaluate all. Similarly, Evaluate above
and Evaluate below allow you to evaluate all fields above or below the current
field. Whenever a long computation had to be interrupted using Focus „ Close
session, this may be used to restore the same working environment as just
before the problematic command.
Let us emphasize that the execution of commands via external plug-ins is done
in a completely asynchronous manner. This allows you to continue typing
while a long computation is in progress. It also means that sessions of dif-
ferent plug-ins can be run in parallel. In fact, the same mechanism can be
exploited to launch multiple instances of the same plug-in. More precisely,
when inserting a session using Insert „ Session „ Other, you may specify both
a “session type” (Shell, Pari, Maxima, etc.) and a “session name” (the default
name is “default”). Only sessions with the same name and type will share the
same physical process; by varying names, it thus becomes possible to simul-
taneously run multiple instances of the same plug-in.
We finally note that different rules apply in the case of the SCHEME plug-in.
Indeed, since SCHEME is the extension language of TEXMACS, the SCHEME plug-
in is permanently running: there is no need to start it and no way to stop or
interrupt it.

11.1.2 Editing sessions


Inside input fields of sessions, the cursor keys have a special meaning: when
moving up or down, you will move to previous or subsequent input fields.
When moving to the left or to the right, you will never leave the input field
(you may still do this with the mouse).
Some utilities for editing input, output, and text fields are available in the
Focus menu. New fields can be inserted using ⌥↑ (insert above) and ⌥↓ (insert
below). Keyboard shortcuts for removing matching text/input/output fields
are ⌥⌫ (remove backwards) and ⌥⌦ (remove current field).
Example 11.1. MAXIMA is one of the oldest computer algebra systems. Nowa-
days, the system is freely available, while being actively maintained. A typical
11.1 SHELL-LIKE SESSIONS 193

session is shown below. If MAXIMA is present on your system, then you may
put your cursor in one of the inputs, perform some edits, and try to re-execute
it. The welcome message before the first input is only displayed when a new
session is started.
Maxima 5.25.1 http://maxima.sourceforge.net
using Lisp SBCL 1.0.51
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) diff (x^x^x, x)
x
(%o1) x x (x x log (x) (log (x) + 1) + x x−1)
(%i2) integrate (%o1, x)
xlog(x)
(%o2) ee log(x)

(%i3) integrate (x^5 / (x^2 - x + 17), x)


2x−1
239 log (x 2 − x + 17) 1361 arctan 67 3 x 4 + 4 x 3 − 96 x 2 − 396 x
(%o3) + +
2 67 12
It should be noticed that all input/output fields in sessions are foldable: when
clicking on an input prompt such as (%i1) with the mouse, you may fold or
unfold the entry. The output fields of folded entries are hidden, even though
they still exist in the document.
During laptop presentations, a similar folding and unfolding process is per-
formed automatically when traversing your slide show. It is also possible to
fold or unfold all fields in a session using Focus „ Session „ Fold all fields and
Unfold all fields. You may use Clear all fields to physically remove all output
fields; this can be useful for creating a demo session that will be re-executed
from scratch during a presentation.
For the creation of long software demonstrations, it is often convenient to group
input/output fields together into subsessions that are labeled by theme (see Fig-
ures 11.1 and 11.2 below). A subsession is created using Focus „ Session „ Create
subsession or ⌥→ . In that case, the current input-output field becomes the body
of the subsession. A subsession consists of explanatory text followed by the
main body. Subsessions can be folded and unfolded using the mouse or ⌃* .
Groups of input/output fields can be cut, copied, and pasted in the usual way.
You may also use Focus „ Session „ Split session in order to split a big session
into smaller parts. This may prove handy whenever you wish to intersperse
your session with explanatory text.

11.1.3 Input and output options


By default, TEXMACS evaluates input fields when pressing ↩ . Multiline input
can be created using ⇧↩ . Alternatively, when selecting the multiline input
mode using Focus „ Input mode „ Multiline input, the ↩ key will insert a new
194 SCIENTIFIC COMPUTATIONS

line and ⇧↩ may be used in order to evaluate the input field. Note that cer-
tain plug-ins come with built-in heuristics for testing whether the input has
been completed; if not, then ↩ will insert a new line.
Certain plug-ins allow you to type the mathematical input in a graphical, two
dimensional form. If so, this input method can be enabled using Focus „ Input
mode „ Mathematical input; it is usually also possible to copy and paste output
back into the input. However, this may not work perfectly for all plug-ins.
Also bear in mind that the mathematical input mode may preempt key combi-
nations that are also needed to type certain commands. For instance, the key $
is redefined inside math mode, so you have to type ⇧F5 $ in order to enter the
dollar symbol.
Example 11.2. The session from example 11.1 becomes as follows when using
mathematical input (Focus „ Input options „ Mathematical input):
x
(%i1) diff(x x , x)
x
(%o1) x x (x x log (x) (log (x) + 1) + x x−1)
(%i2) %o1 dx
xlog(x)
(%o2) ee log(x)

x5
(%i3) dx
x 2 − x + 17
2x−1
239 log (x 2 − x + 17) 1361 arctan 67 3 x 4 + 4 x 3 − 96 x 2 − 396 x
(%o3) + +
2 67 12
There are also a few output options that are worth mentioning. The evalua-
tion time of individual input fields is reported when Focus „ Output options „
Show timings is enabled. This includes the time that TEXMACS used in order
to process the input and the output, so these timings should only be used as
indications: benchmark tables should instead be computed directly inside the
plug-in.
Computer algebra systems occasionally tend to generate large expressions that
cannot be rendered on a single line. By default, such expressions are rewritten
by TEXMACS so as to make line breaking possible. This means that wide frac-
a
tions b are allowed to be rewritten under the form a/b and similarly for square
roots, matrices, etc. Although this is important for printing purposes, it also
can make the output more difficult to read. If you are not interested in printing
out your computations, then you may wish to turn off the rewriting mecha-
nism, using Focus „ Preferences „ Do not break up large formulas.

11.1.4 Alternative session styles


When running sessions inside a laptop presentation, it is possible to opt for
one of the fancier rendering styles. Figure 11.1 shows a basic alternate style
that was selected using Focus „ Preferences „ Framed input fields. Similarly, Ring
binder notebook style mimics the appearance of a notebook: see Figure 11.2.
11.1 SHELL-LIKE SESSIONS 195

Caas] f (x) ⇒⇐ log log x − x − log log(x + 1);


1
⇐⇒
Caas] f (infinity x)
−1
−2
1 1 1
+
1
log(x ) x 2 log(x ) x
1
2
+
1

1 1
3 log(x ) 2 log(x )
((
2

2 1
3 log(x)3
)) x1 +
3

−1 1
((
1 1
+
11 1
+
1 1
4 log(x) 24 log(x)2 2 log(x)3 x 4
1
+ −
5
))
1
5 log(x) 12 log(x)2
+((
O ((
1
log(x)3
1
x5
+ Ox 6
1
x
))))
⇑ Linear algebra

Caas] ||| da be cf |||


|| g h i ||
(c g + f h) (−a − e) + (a c + b f ) g + (c d + e f ) h + (a e − b d) i

Caas] invert (( 0a b
c
))
b
[[[ −1
a ac ]]]
[[ 0 1
c
]]
Figure 11.1. The framed input style for computer algebra sessions.

Caas] expand((a + b + c)5)


30 a 2 b 2 c + 30 a 2 b c 2 + 30 a b 2 c 2 + 20 a 3 b c + 20 a b 3 c + 20 a b c 3 + 10 a 3 b 2 +
10 a 3 c 2 + 10 a 2 b 3 + 10 a 2 c 3 + 10 b 3 c 2 + 10 b 2 c 3 + 5 a 4 b + 5 a 4 c + 5 b 4 c +
5 a b 4 + 5 a c4 + 5 b c4 + a5 + b 5 + c5
Calculus ⇑

Caas] derive (tan x x, x, x)


(log(x) + 1)2 sin(x x) (x x)2 (log(x) + 1)2 x x xx
2 + +
cos(x )x 3 x
cos(x ) 2 cos(x x)2 x
Caas] sin series(0, 1)
1 1 5 1 7 1
z − z3 + z − z + z 9 + O(z 10)
6 120 5040 362880

Figure 11.2. The ringbinder notebook style for computer algebra sessions.
196 SCIENTIFIC COMPUTATIONS

These examples also demonstrate the use of subsessions. By pressing the


⇑ button (at the left-hand side in Figure 11.1 and at the right-hand side in
Figure 11.2), you may fold the subsession; this also changes the symbol on
the button to ⇓; a second click on this button unfolds the subsession.

11.1.5 Miscellaneous extras

TEXMACS provides facilities to write neat interfaces for computer algebra sys-
tems and other external scientific software. However, the extent to which these
facilities are exploited by individual plug-ins rests on the shoulders of the devel-
opers of these plug-ins [18, 19, 20]. Multiline and mathematical input/output
are examples of features that are exploited by several plug-ins, but not all. Let
us describe a few others that were not mentioned so far.

Tab-completion

This mechanism allows for the automatic completion of long instructions using
the tab key ⇥ , after typing the first few characters. For instance, when typing
mathi in a PARI/GP session and pressing ⇥ , one obtains mathilbert(|). The
command mathilbert is used for the computation of Hilbert matrices:

Pari] mathilbert(3)

(( 1 1 1
))
%1 = ( )))
2 3
(((1
2
1
3
1
4 ))
((
1
3
1
4
1
5
)
Tab-completion is a nice tool not only for experienced users, but also for
beginners who are still learning the precise names of potentially numerous
commands. If there exist multiple completions, then pressing the tab key ⇥
several times allows you to cycle through the list of all possibilities.

Syntax highlighting

Modern program editors often use special colors for names of important
instructions, comments, function declarations, and special constants. This tech-
nique of syntax highlighting makes programs more readable and several TEXMACS
plug-ins support it. For instance, inside SCHEME sessions, commands that have
actually been defined are rendered using a special color. This makes it pos-
sible to spot typos just by looking at the colors:

Scheme] (append (list 1 2) (list "a" "b"))


(1 2 "a" "b")
11.2 PLUG-INS AS SCRIPTING LANGUAGES 197

Eukleides
A B C right 5, 35 deg

draw
(A.B.C) C

circle(A, B, C)
end

label
A -135 deg
B -45 deg A B
C 45 deg
A, B, C right
end
Figure 11.3. Example of an executable switch for the EUKLEIDES plug-in. On the left, we
showed the unevaluated EUKLEIDES commands that describe the picture. On the right-
hand side, you see the result after pressing ⌃* . Hitting ⌃* once more allows you to
switch back to the source code.

Scheme] (appen (list 1 2) (list "a" "b")) ;; Error!


Unbound variable: appen

11.2 Plug-ins as scripting languages


TEXMACS provides a few other types of interfaces to external systems besides
the shell-like interfaces that we just described. First of all, it is possible to insert
a so-called “executable switch” anywhere in the document using Insert „ Fold „
Executable.

For example, if M AXIMA is installed on your system, then Insert „


Fold „ Executable „ Maxima should yield something like Maxima . You
may enter a M AXIMA expression in the yellow part of the switch, say
Maxima diff(x^x,x) . Using ↩ or ⌃* , you may now switch back and forth
between the unevaluated input and the evaluated output x x (log (x)+1). Using
⇧↩ , you enable multi-line input. This kind of executable switches are very
useful for plug-ins like DRATEX, EUKLEIDES, FEYNMF, etc., which are mainly
used for the efficient computation and insertion of special graphics inside
TEXMACS documents: see Figure 11.3.
Some plug-ins such as MAXIMA can even be selected as a scripting language
using Document „ Scripts „ Maxima. When doing so, MAXIMA can be used in the
background as an assistant to the editor, by allowing you to operate directly on
formulas. For instance, if your cursor is inside the formula 1 + 1, then pressing
⌃↩ will automatically evaluate the formula using MAXIMA and replace it by
the result 2.
198 SCIENTIFIC COMPUTATIONS

When selecting a plug-in such as MAXIMA as the scripting language, a top-level


menu Maxima appears. Common mathematical operations such as evaluation,
simplification, differentiation, etc. thus become available through the menus.
For example, the expression (a+b +c)5 can be expanded by putting your cursor
inside the formula and unleashing Maxima „ Simplification „ Expand. If you
enable Maxima „ Keep evaluated expressions, then the evaluated expressions
will be preserved. Expansion of the above expression then yields expand((a +
b + c)5) = c 5 + 5 b c 4 + 5 a c 4 + 10 b 2 c 3 + 20 a b c 3 + 10 a 2 c 3 + 10 b 3 c 2 + 30 a b 2 c 2 +
30 a 2 b c 2 + 10 a 3 c 2 + 5 b 4 c + 20 a b 3 c + 30 a 2 b 2 c + 20 a 3 b c + 5 a 4 c + b 5 + 5 a b 4 +
10 a 2 b 3 + 10 a 3 b 2 + 5 a 4 b + a 5.
Basic executable switches as described above just allow for the evaluation of
commands. If a plug-in can be used as a scripting language, then a more pow-
erful variant of this mechanism becomes available, with the possibility to let
the input of certain switches depend on the output of other ones. More pre-
cisely, assuming that you selected a scripting language from Document „ Scripts,
you may insert a new executable input field using \ ! or Insert „ Link „ Executable
input field. As before, when pressing ↩ , the current input is evaluated and
replaced by the corresponding output; you may switch back to the input by
pressing ↩ once more.
Unlike executable switches, you may now attach an identifier to the executable
input field by deactivating it or by editing the Ref field on the focus bar. Inside
other executable input fields, you may then refer to the value of the field by
inserting a field reference using \ ? or Insert „ Link „ Field reference. If you modify
and re-evaluate an input field, TEXMACS will automatically re-evaluate all other
fields that depend on it.
As an alternative to executable input fields, you may sometimes prefer to insert
plain input fields using \ \ or Insert „ Link „ Input field. These fields can only
be used for input and pressing ↩ inside such a field will only recompute those
other fields that depend on it.

Example 11.3. Executable input fields can be used for educational purposes, by
allowing parts of the document to be modified and recomputed by the reader.
For instance, evaluation of
The derivative of x x equals diff(function,x).
The second derivative is given by diff(derivative,x).
yields
The derivative of x x equals x x (log (x) + 1).
The second derivative is given by x x (log (x) + 1)2 + x x−1.
The first occurrence of x x is an input field with name function. Its first deriv-
ative is computed using an executable input field with name derivative. If
the reader changes the input function x x into something else and presses ↩ ,
then both the first and second derivatives will be updated automatically.
11.3 SPREADSHEETS 199

11.3 Spreadsheets
Recent versions of TEXMACS include a rudimentary support for spreadsheets.
The current implementation still requires speed optimizations, so it is only
suitable for small tables that fit on a single page. One advantage with respect
to more widely used systems such as EXCEL is the ability to perform the under-
lying mathematical computations using any plug-in that qualifies as a scripting
language. Besides basic arithmetical operations, this makes it possible to per-
form more complex operations on cells such as symbolic differentiation or
polynomial factorization.
From a technical point of view, spreadsheets are similar to the executable
switches that were discussed in the previous section. The main difference is
that the input fields are now organized in a table. Consequently, references
indicate a row and a column rather than a name.
Assuming that you selected a scripting language in the menu Document „ Scripts,
say MAXIMA, you may enter a new spreadsheet using Insert „ Table „ Textual
spreadsheet or Numeric spreadsheet. You may edit the spreadsheet as an ordi-
nary table, except that the ↩ key will attempt to reevaluate the cells of the table.
If the contents of a cell are preceded by =, then the cell will be considered as an
input-output switch. More precisely, the input is a formula that will be evalu-
ated using the current scripting language. After evaluation using ↩ , only the
result of the evaluation is shown in the cell. Pressing ↩ once more allows you
to switch back and edit the input expression. Within formulas, one may refer
to other cells using names such as c5 for the third row and the fifth column.

Example 11.4. On the left-hand side of the figure below, we have displayed
a simple table with formulas for evaluating the sums of the first two items of
each row. On the right-hand side, we have shown the result after evaluation.

1 10 =a1+b1 1 10 11
100 1000 =a2+b2 100 1000 1100

Figure 11.4. Evaluation of a simple spreadsheet.

Example 11.5. As illustrated in Figure 11.5, the cells may contain mathematical
formulas and the spreadsheet may take advantage of any of the capacities of
the scripting language.

sin(x 2) sin(x 2)
=diff(a1,x) 2 x cos (x 2)
=diff(a2,x) 2 cos (x 2) − 4 x 2 sin (x 2)
=diff(a3,x) −12 x sin (x 2) − 8 x 3 cos (x 2)

Figure 11.5. Computation of successive derivatives using MAXIMA.


200 SCIENTIFIC COMPUTATIONS

TEXMACS supports a few special notations for applying operations on all cells
in a subtable. Following EXCEL, you may use the notation c3:d5 for indicating
all cells c3, c4, c5, d3, d4, d5 in the block from c3 to d5. An alternative notation
,..., for the range operator : can be entered by typing , , . In a similar way, you
may enter the special notation +⋅ ⋅ ⋅ + by typing + + . For instance, c3+⋅ ⋅ ⋅ + d5
stands for the sum of all cells between c3 and d5.

Example 11.6. The figure below shows how to sum the contents of a range of
cells. Notice that each empty cell evaluates to zero.

15.10 15.10 30.20 15.10 15.10 30.20


100 125 75 100 125 75
28.50 14.25 28.50 14.25
12 16 20 12 16 20
=a1+⋅ ⋅ ⋅ + a4 =b1+⋅ ⋅ ⋅ + b4 =c1+⋅ ⋅ ⋅ + c4 155.6 156.1 139.45

Figure 11.6. Evaluation of sums of columns in a simple spreadsheet.

Note that copying and pasting of subtables works in the same way as for ordi-
nary tables, with the additional property that names of cells are renumbered
automatically, as well as any references to cells in the formulas. Automatic
renumbering is also applied when inserting new columns or rows, or when
removing existing ones.
We already mentioned the similarity between spreadsheets and executable
switches. Both mechanisms can actually be combined in a natural way. On
the one hand, references to executable switches (created using \ ? ) can also be
used inside spreadsheet cells. Conversely, each spreadsheet carries an invis-
ible Ref field. If you select the spreadsheet, then you can edit this field on the
focus bar. The Ref field of the spreadsheet is used as a prefix for referring to
its cells from outside the table or from within other spreadsheets. For instance,
if Ref equals sheet, then sheet-c4 refers to the field c4 inside the spreadsheet.
The same mechanism applies if you need to refer to this cell in another spread-
sheet.

11.4 Remote plug-ins


Plug-ins that have been installed on a remote computer can still be used inside
TEXMACS over an SSH connection.
In order to make this work, you first have to make sure that SSH is installed
on both computers and that connecting by SSH to the remote machine can
be done automatically, without having to type a password. This can be done
by copying your public identity on the local server to the remote server into
the file ~/.ssh/authorized_keys; see the documentation on SSH for more
information.
11.4 REMOTE PLUG-INS 201

The next step is to make sure that TEXMACS has been installed on both com-
puters. The remote TEXMACS installation will mainly be used in order to detect
those plug-ins that can be used on the remote computer.
When everything has been set up in this way, select Insert „ Session „ Remote in
order to open the remote plug-in selector. Add the name of the remote server
by typing its name or IP address and clicking on Add. After a small pause, the
remote server should appear in the list together with the remote plug-ins that
are supported. You may now simply select the plug-in you want to use from
the list. Notice that remote plug-ins may take a few seconds in order to boot.
Servers that have been added to the list of remote plug-in servers will be
remembered the next time you start TEXMACS. You may use the buttons Remove
and Update in order to remove a server from the list and to update the list
of supported remote plug-ins.
Chapter 12
Get it your way
12.1 Creating macros
12.1.1 Hello Nebuchadnezzar
We have encountered an avalanche of markup elements throughout this book.
Why add your own ones on top of the existing? One possible reason is that
you may wish to save time by introducing abbreviations for lengthy names or
notations. Let us see how to do this by defining your own macros.
Assume that we need the name of a king for our new novel and that Neb-
uchadnezzar seems to be the perfect candidate. Then it is natural to introduce a
new macro king as an abbreviation for Nebuchadnezzar. The easiest way to do
this is to open the “macro definition widget” using Tools „ Macros „ New macro.
At the place of enter-name, you may enter the name of your macro: “king”.
The corresponding body “Nebuchadnezzar” can be typed below the ≔ sign.
When done (see Figure 12.1), simply click on Ok. Now that your macro has
been defined, you can use it as many times as you wish by typing \ k i n g ↩ :
Hello Nebuchadnezzar!
Nebuchadnezzar: my beloved leader.
Bye, bye, Nebuchadnezzar.
One big advantage of using macros for abbreviations and special notations
is that it suffices to modify the macro definitions whenever you change your
mind: by positioning your cursor right after one of the king tags, you can edit
the corresponding macro using Focus „ Preferences „ Edit macro. Just change
the body of the macro to “Arikesari Maravarman Nindraseer Nedumaaran”,
if this is your new hero, and all Nebuchadnezzars will mutate accordingly.

Figure 12.1. The widget for macro definitions.

202
12.1 CREATING MACROS 203

Figure 12.2. Example of a matrix definition with arguments.

12.1.2 Adding arguments


As our next example, assume that we wish to define a macro diag that pro-
duces a diagonal matrix
x1 (( ))
(((
⋅⋅

xn
, ))) (12.1)

with the additional constraint that the symbols x and n can be changed each
time the macro is used.
After entering the name of the macro as in the previous example, you may use
the ⌥→ shortcut in order to insert additional macro arguments, say x and n.
When entering the body of the macro, these arguments can be used inside the
body by typing \ x ↩ and \ n ↩ . The resulting macro definition should look
like Figure 12.2. When applying the macro using \ d i a g ↩ , an empty and
editable slot is provided for each argument. Notice that only the first top-left
occurrence of the parameter x can be edited, although the second one at the
bottom-right will be updated accordingly during modifications.
The widget for macro editing is mainly intended for quick definitions of simple
macros. In particular, you may miss the menus and the toolbars of the usual
editor. Nevertheless, most of the usual keyboard shortcuts do work, as well
as the contextual menus that appear when pressing the right mouse button (if
your mouse has a single button, then you should hold the control key ⌃ while
pressing that button). Whenever some keyboard shortcuts are preempted by
the operating system, we also recall from section 2.3.5 that you may emulate
the modifier keys ⌃ , ⌥ , and ⌘ using ⎋ . For instance, ⌥→ is equivalent to ⎋ ⎋ → .
You may have noticed that we used the \ key both for applying the diag macro
and for inserting the macro arguments x and n. The behavior of the \ key is
context-dependent indeed. Inside the definition of a macro with arguments x
and n, typing \ x ↩ will lead to the insertion of the macro argument x. In a
context where the diag macro is defined, TEXMACS will automatically apply this
macro when typing \ d i a g ↩ . Notice that macro arguments are indicated
204 GET IT YOUR WAY

Figure 12.3. Browsing the list of all macros using the macros editor.

using a brown color, whereas tags are displayed in blue.


Another technique that is useful for the definition of macros goes as follows.
First design the prototype macro application in an ordinary TEXMACS window.
That would simply be the diagonal matrix (12.1) for our example. Now copy
this matrix and paste it inside the macro body when defining the diag macro.
Finally replace the variables x and n by the macro arguments x and n that were
entered using \ x ↩ and \ n ↩ . This copy-and-paste technique will turn out
to be even more powerful when editing style files, as described later in this
chapter.

12.1.3 Customizing an existing macro


Whenever your cursor is inside or just after a markup element, you may cus-
tomize the corresponding macro definition using Focus „ Preferences „ Edit
macro or „ Edit macro. For example, assume that we entered the acronym
GNU or LASER (using \ a c r o n y m ↩ or Insert „ Content tag „ Acronym). If
you wish to change the default rendering (a small capitals font), you can cus-
tomize the corresponding acronym macro by positioning your cursor inside
the text GNU or LASER and opening the macro editor with „ Edit macro.
In certain cases, it may also be handy to browse the list of all existing macros
that are active in your current style. This can be done by opening the macros
editor via Tools „ Macros „ Edit macros: see Figure 12.3. You may find the acronym
macro in the list at the left-hand side, possibly after typing the first few char-
acters of the Macro name. A short description of the macro is displayed in the
Documentation area, whenever available. The macro can be edited as usual
in the Macro definition area.
12.1 CREATING MACROS 205

In Figure 12.3, we selected “Source mode” for editing the body of the macro, as
indicated by the pull-down menu at the bottom-left of the window. This mode
is usually most convenient for editing complex macros, whereas the default text
mode tends to be more suitable for simple, visually oriented macros. We also
notice that the macro editor shows macro definitions in an abridged manner:
inside style files and packages the definition from Figure 12.3 would read

hassignjacronymjhmacrojbodyjhwithjfont-shapejsmall-capsjbodyiii

Before we explain the presentation and syntax of source code in full detail,
let us first analyze the customization of an existing macro on a more complex
example.

12.1.4 Anatomy of a macro

The rendering of certain markup elements like acronym is quite straightfor-


ward. Many macros are far more complex and may recursively depend on
other macros.
Assume for example that we wish to customize the proof environment using
the macros editor and replace the “end-of-proof” symbol □ by ■. The internal
structure of the proof is exposed by selecting Source instead of Text in the left
bottom menu of the macros editor. For most styles, the source code is as fol-
lows:

hassignjproofj
hmacrojbodyj
hrender-proofjhproof-textijbodyiii

The prefix “render-” is used for submacros that specifically control the graph-
ical layout. In this case, the arguments of render-proof are the (potentially
translated) text “Proof” and the actual proof body. This additional level of
indirection allows for the specification of alternative proof texts:

Continued proof of the master theorem. We now conclude by


applying the master lemma. □

When customizing a macro, it is important to first understand its structure and


the intent of the other macros on which it relies. In many cases, you really want
to customize one or more of these other macros. In our example, this leads us
to examine the source code of the render-proof macro, which is given by

hassignjrender-proofj
hmacrojwhichjbodyj
hsurroundjjhhtabj0.5fnj0ihqedij
hrender-remarkjwhichj
bodyiiii
206 GET IT YOUR WAY

The surround primitive provides a way to decorate large blocks of text (so-
called “block markup”) at the left and at the right. In this case, the proof text is
decorated with the end-of-proof symbol □, which is produced using the macro
qed. The symbol is preceded by a “horizontal tab” that flushes it to the right
margin. It now suffices to change the definition of the qed macro to ■. The
above proof then reads:

Continued proof of the master theorem. We now conclude by


applying the master lemma. ■

At this point, we succeeded in replacing the □ symbol by ■, but let us push


our explorations a bit farther. The render-remark macro is another even more
central rendering macro, which is also used for remarks, notes, examples, etc.
Its source code is as follows:

hassignjrender-remarkj
hmacrojwhichjbodyj
hrender-enunciationjhremark-namejwhichhremark-sepiijbodyiii

As you can see here, render-remark depends on its turn on a yet more central
macro render-enunciation, which is also used for theorems and exercises. This
additional level of indirection is due to the fact that the bodies of major the-
orem-like enunciations are usually emphasized, whereas proofs, remarks, and
other less prominent enunciations do not the change the font of the main body.
Examination of the definition of render-remark also reveals the possibility to
specify an alternative rendering for the names of remarks (e.g. REMARK 2.3)
and the separator between this name and the corresponding body (usually a
dot). Further investigations lead us to the source code of render-enunciation:

hassignjrender-enunciationj
hmacrojwhichjbodyj
hpadded*j
hsurroundjwhichjhyes-indent*ij
bodyiiii

We have now reached the explicit graphical layout macro padded* that is used
to add vertical whitespace before and after the enunciation.

hassignjpadded*j
hmacrojbodyj
hpadded-normaljlarge-padding-abovejlarge-padding-belowj
bodyiii

The precise amount of spacing is controlled by the style parameters large-


padding-above and large-padding-below. For all macros that depend on padded*,
this leads to entries Focus „ Preferences „ Large padding above and Large padding
below in the Style parameters group. If your cursor is inside a proof, then
12.2 PILGRIMAGE TO THE SOURCE 207

proof

proof-text render-proof remark

qed render-remark render-theorem

remark-name remark-sep render-enunciation

padded*

large-padding-above large-padding-below padded-normal


Figure 12.4. The dependency tree for the proof macro.

you may change these style parameters. The padded-normal macro is defined
directly in terms of typesetting primitives that cannot be further customized:

hassignjpadded-normalj
hmacrojbeforejafterjbodyj
hsurroundjhvspace*jbeforeihno-indentijhhtabj0fnjfirstihvspacejafterij
bodyiii

Figure 12.4 summarizes the recursive dependencies of the proof macro. Once
again: before customizing an existing macro defined by the selected style, it is
recommended to investigate its dependency tree and carefully identify those
submacros that control the behavior that you wish to change.

12.2 Pilgrimage to the source


In the previous section, we have seen that it can be useful to select the “source
code” rendering when editing macros. You may actually select this rendering
style for any TEXMACS document using ⌘⌥s or Document „ Source „ Edit source
tree, and for any selected portion of text using ⌘- . For certain documents, this
gives a better grip on their full structure and in particular reveals any hidden
information such as folded content.
However, contrary to LATEX and HTML (among others), the preferred repre-
sentation of TEXMACS documents is not based on ASCII texts. This makes the
concept of “source code” somewhat ill-defined for TEXMACS documents. As
we will explain in this section, the best mental representation of a TEXMACS
document is to regard it as an abstract tree. There are many ways to render
such trees on a screen, some of which are closer to the printed end-result, and
some of which expose more of the hidden internal structure.
208 GET IT YOUR WAY

12.2.1 Documents as trees


From a more conceptual perspective, TEXMACS systematically regards docu-
ments as trees. Consider for example the formula

1
. (12.2)
x2 + y2

TEXMACS internally represents this formula by a tree12.1

frac (12.3)

1 concat

x rsup +y rsup

2 2

The nodes of the tree are labeled by markup elements (internal primitives or
user-defined macros) and the leaves of the tree are ordinary text strings.
Pursuing our conceptual perspective, one should distinguish between the
abstract document tree and its graphical rendering. In particular, (12.3) is just
an attempt to represent such a tree in a graphically pleasing way. The default
rendering (12.2) is another representation and the “source code” rendering is
yet another possible representation:
hfracj1jxhrsupj2i+yhrsupj2ii
The main virtue of “source code” with respect to other renderings is that it aims
to make the full structure as transparent as possible. But even though TEXMACS
proposes a default “source code” rendering, there is no intrinsic reason to
prefer any particular such rendering over another one. For instance, scheme
expressions provide an alternative that only involves plain ASCII text:

(frac "1" (concat "x" (rsup "2") "+y" (rsup "2")))


We will come back to this representation in chapter 14, since it is particularly
useful when using SCHEME as an extension language for TEXMACS.

12.2.2 Selecting your preferred presentation of source code


The “source code” rendering of document trees can actually be customized
via Document „ Source „ Preferences. We invite you to play around with the
different possibilities in a document of your own (after enabling Document „
Source „ Source tree).

12.1. Notice that x 2 is represented as xhrsupj2i and not as hrsupjxj2i. This is more convenient for
wysiwyg editing purposes, since you do not need to specify the precise mathematical expression
that is being superscripted.
12.2 PILGRIMAGE TO THE SOURCE 209

Angular Scheme
hassignjquick-theoremj (assign “quick-theorem”
hmacrojbodyj (macro “body”
hsurroundjhno-indentiTheorem. jj (surround (no-indent)“Theorem. ” “”
bodyiii (arg “body”))))

Functional LATEX
assign (quick-theorem, assignfquick-theoremgf
macro (body, macrofbodygf
surround (no-indentTheorem. , , surroundfno-indentTheorem. gfgf
body))) bodyggg

Figure 12.5. Different styles for rendering the same source tree.

First of all, you may choose your preferred “Main presentation style”
among “angular”, “scheme”, “functional”, and “LATEX”, as illustrated in the
Figure 12.5.
Secondly, you may wish to reserve a special treatment for certain tags, such as
the formatting tags concat and document for horizontal and vertical concate-
nation. In the menu Tags with a special rendering you may specify to which
extent you want to treat such tags in a special way:
Raw. No tags receive a special treatment.
Format. All tags are rendered as source code, except for the formatting tags
concat and document.
Normal. In addition to the formatting tags, a few other tags like compound,
value, and arg are rendered in a succinct way.
Maximal. At the moment, this option is not yet implemented. The inten-
tion is to allow you to write your own customizations and to allow for
a special rendering of basic mathematical operations such as plus.
These different options are illustrated in Figure 12.6.

Raw Format
hassignjquick-theoremj
hmacrojbodyj hassignjquick-theoremj
hdocumentj hmacrojbodyj
hsurround jhconcat jhno-indentijThe- hsurroundjhno-indentiTheorem. jj
orem. ijj hargjbodyiiii
hargjbodyiiiii

Normal Maximal
hassignjquick-theoremj hassignjquick-theoremj
hmacrojbodyj hmacrojbodyj
hsurroundjhno-indentiTheorem. jj hsurroundjhno-indentiTheorem. jj
bodyiii bodyiii

Figure 12.6. Different ways to render special tags.


210 GET IT YOUR WAY

None Inline
hassignj
quick-theoremj hassignj
hmacroj quick-theoremj
bodyj hmacroj
hsurroundj bodyj
hconcatj hsurroundj
hno-indentij hno-indentiTheorem. j
Theorem. ij j
j bodyiii
bodyiii

Normal All
hassignjquick-theoremj
hmacrojbodyj hassign j quick-theorem jhmacro j body jhdocument j
hsurroundjhno-indentiTheorem. jj hsurroundjhno-indentiTheorem. jjbodyiiii
bodyiii

Figure 12.7. Different levels of compactification.

Another thing that can be controlled by the user is whether the presentation
of tags should be compact or stretched out across several lines. In general, so-
called inline tags are more readable when represented in a compact way. Inline
tags are used for small pieces of content in the middle of a paragraph, such
as a reference or an inline formula. On the other hand, block tags are used for
longer pieces of content that may span over several paragraphs, such as proofs
or item lists. In source code rendering, they typically look better when they are
stretched out over several lines. Note that certain tags (like em for emphasized
text) can be used both as inline and as block tags.
The Compactification menu proposes several levels of compactification:
None. The tags are all stretched out across several lines.
Inline. All non-inline tags are stretched out across several lines.
Normal. All inline arguments at the start of the tag are represented in a
compact way. As soon as we encounter a block argument, the remainder
of the arguments are stretched out across several lines.
Inline arguments. All inline arguments are represented in a compact way
and only block tags are stretched out across several lines.
All. All source code is represented in a compact way.
The visual effect of the different levels of compactification is illustrated in
Figure 12.7.
Finally, the Closing style menu allows you to specify the way closing tags
should be rendered when the tag is stretched out across several lines. The
rendering can either be minimalistic, compact, long, or recall the matching
opening tag. The different options are illustrated in Figure 12.8.
12.2 PILGRIMAGE TO THE SOURCE 211

Minimal Compact
assign quick-theorem hassignjquick-theoremj
macro body hmacrojbodyj
surround hno-indentiTheorem. j hsurroundjhno-indentiTheorem. jj
body bodyiii

Long Repeat
hassignjquick-theoremj hnassignjquick-theoremi
hmacrojbodyj hnmacrojbodyi
hsurroundjhno-indentiTheorem. jj hnsurroundjhno-indentiTheorem. ji
body body
i h/surroundi
i h/macroi
i h/assigni

Figure 12.8. Different ways to render closing tags.

12.2.3 Data or program?

When designing your macros, you will quickly find out that TEXMACS macros
have a dual character. Simple macros such as an abbreviation or a notation
for diagonal matrices are usually visual in nature and best edited in the same
way as ordinary text. More complex macros behave more like programs with
local variables and subprograms. The source code representation tends to be
more convenient for editing such macros. The borderline between textual data
and macro programming is blurry: sometimes both aspects can be found in the
same macro definition.
TEXMACS fully acknowledges this data-or-program duality and provides a few
mechanisms to locally switch between normal and source style rendering. One
typical use case is to quickly examine (and possibly modify) the “source code”
of a small portion of text. For example, assume that we wish to study the
markup that was used in order to produce “brown” and “jumps” in the frag-
ment

The quick brown fox jumps over the lazy dog.

Then it suffices to select “brown fox jumps” and press ⌘- (when activating
the source tool using Tools „ Source macros tool, you may also use Source „
Activation „ Deactivate):

The quick hwith j color j brown j browni fox hmove j jumps j j 0.5exi
over the lazy dog.

This technique inserts an additional (invisible) inactive* tag around the selec-
tion. You have to remove this tag in order to switch back to the original presen-
tation, e.g. by placing your cursor after the “x” in “fox” and pressing ⌃⌫ . Recall
that the source code for the entire document can be edited using Document „
Source „ Edit source tree.
212 GET IT YOUR WAY

Conversely, when editing a macro definition in source mode, you may prefer
the usual non-source rendering for the more graphical portions of text. Con-
sider for instance the definition

hassignjnew-iconjhmacrojhiconjtm_new_x4.pngiii

You may prefer the following presentation that was obtained by selecting hiconj
tm_new_x4.pngi and pressing ⌘+ :

hassignjnew-iconjhmacroj ii

A more complex example is the following:

hassignjdiagjhmacrojvarjdimj(((
( var
1
⋅⋅
𝟎 )))ii
(( 𝟎 ⋅
vardim ))
Here we activated the usual rendering for the matrix using ⌘+ , but switched
back to source code rendering for the arguments var and dim using ⌘- .

12.2.4 The ASCII religion


Let us briefly discuss one aspect of source code that may not be of direct prac-
tical interest, but which may give you some insight into the design philosophy
behind TEXMACS.
Programmers are accustomed to the use of ASCII as their privileged represen-
tation of source code. Over decades, many tools have been developed in order
to make ASCII-style programming highly efficient. However, it is not so clear
that a line of C++ code such as
P = 23*pow(x,3)*pow(y,2)*z + 17*x*pow(z,4) (12.4)
is easier to read than
P = 23 x 3 y 2 z + 17 x z 4 (12.5)
Similarly, some masochism is required to prefer LATEX code

M = \left( \begin{array}{ccc}
1 & \alpha_{1,2} & \alpha_{1,3}\\
0 & 1 & \alpha_{2,3}\\
0 & 0 & 1
\end{array} \right) (12.6)
over
( 1 𝛼1
M = ((( 0
1,2 𝛼1,3
)) (12.7)
(0 0
𝛼2,3
1
))
12.3 GROUPING YOUR MACROS TOGETHER 213

With an appropriate editor like TEXMACS, we do not only claim that (12.5)
and (12.7) can be entered faster than (12.4) and (12.6): we may also regard them
as a better way to represent “source code”.

In fact, we regard it as an interesting challenge to develop a “source code editor”


that is at least as efficient as traditional ASCII-based editors, but that allows for
visually more attractive and readable presentations. The main advantage of
existing editors is that the user is not constrained by the structure of a program.
For instance, the following piece of code was made more readable through
the manual insertion of spaces at appropriate places:

if (cond) hop = 2;
else holala= 3;

However, the precise formatting policy does not appear in the document, so
manual intervention will be necessary if the variable cond is renamed c, or if
the variable holala is renamed hola.

TEXMACS is not really intended to be a program editor yet, so no tools are pro-
vided for dealing with the above example in an automatic way. Nevertheless,
the discussion applies in a lesser extent to the source code mode in TEXMACS.
New users may feel somewhat constrained by the document structure and dis-
oriented by the fact that ASCII-style editing habits not always apply. These
disadvantages are still felt by more experienced users, but compensated by the
benefits of the structured editing facilities. Nevertheless, it remains a challenge
to make it even easier and more natural to edit source code.

12.3 Grouping your macros together

12.3.1 Preambles

The macro editor is an efficient tool for the definition of simple notations and
for basic customizations of existing macros. The resulting macro (re-)defin-
itions are automatically stored in the preamble of your document. More experi-
enced TEXMACS users often do not use the macro editor and prefer to directly
edit the preamble using ⌘⌥p or Document „ Part „ Show preamble. This has the
advantage that you see all macro definitions at once. By putting them in a
suitable order, you may also enhance their readability.

Preambles are edited much in the same way as ordinary documents, except
that you are in source mode. Copying and pasting in particular continues
to work as usual. This is a powerful technique for the definition of complex
macros: first design a prototype macro application in an ordinary document,
next copy and paste it into the body of your macro definition in the preamble,
and finally perform the appropriate replacements of text by macro arguments.
214 GET IT YOUR WAY

Besides macros, you may also edit environment variables using the macro
editor. Examples of environment variables are the page size, the left margin,
the text color, or the number of the current subsection. Some of these environ-
ment variables can also be modified more directly using the Document menu.
For example, the main text color for the document can be selected using Doc-
ument „ Colors „ Foreground.

Just like the \ key allows you to apply a macro whenever it is defined (see
section 12.1.2), you may use it in order to obtain the value of any available envi-
ronment variable. For example, \ c o l o r ↩ yields the value of the current
text color. Inside source code, TEXMACS uses a green color for such environ-
ment variables, as in color.

12.3.2 Style packages

The preamble contains style customizations that apply to one individual doc-
ument. If you are particularly pleased with some of your customizations, then
you may wish to bundle them in a style package that can be reused in other
documents. One efficient way to start a new style package is Tools „ Macros „
Extract style package: this collects all existing customizations in your current
document (both macros and environment variables) and puts them into a new
style package.
Style packages are similar to usual TEXMACS documents, except that you
edit them in source mode, just like preambles. When saving them to disk,
you should also use the .ts extension instead of .tm. The native TEXMACS
style packages are stored in the directory $TEXMACS_PATH/packages, where
$TEXMACS_PATH points to the directory where you installed TEXMACS. You must
put your own style packages in the same directory as the files that use them or in
the directory $TEXMACS_HOME_PATH/packages, where $TEXMACS_HOME_PATH
points to ~/.TeXmacs on UNIX systems and to C:\Documents and
settings\user_name \Application Data\TeXmacs on WINDOWS. After
saving your style package in this way, you may apply it to any of your TEXMACS
files using Document „ Style „ Add package „ Add other package.
Style files are a variant of style packages. Style files control the main document
style, whereas style packages contain customizations that can be combined
with other style files or packages. Style files must be complete in the sense
that all major markup elements (such as section, theorem, equation, bibliog-
raphy, strong, etc.) should be defined. Style packages typically contain extra
personal notations or customizations of existing markup elements.
The complete style of your current document can be extracted using Tools „
Macros „ Extract style file. When saving style files to disk, you should again use
the .ts extension. Native style files are stored in $TEXMACS_PATH/styles.
You should put your own style files in $TEXMACS_HOME_PATH/styles or in
the same directory as the files that use them. The main style is selected using
Document „ Style and user-defined styles are automatically listed there.
12.4 THE STYLE-SHEET LANGUAGE 215

12.4 The style-sheet language


So far, we have discussed how to introduce new notations and how to produce
simple customizations of existing macros. For the design of more complex
macros, TEXMACS provides a special style-sheet language. This language consists
of a set of special primitives that allow you to locally modify an environment
variable, choose between several renderings, perform length computations,
etc. In this section, we give an introduction to some of the most important
primitives. A full exposition is beyond the scope of this book; for more details,
we refer to the reference guide that is found in Help „ Reference guide.
Throughout this section, we assume the editor to be in “source mode”, so that
a top-level Source menu should be available.

12.4.1 Assignments
All user-defined TEXMACS macros and style variables are stored in the “current
typesetting environment”. This environment associates tree values to string
variables. Variables whose values are macros correspond to new primitives.
The others are ordinary environment variables. The primitives for operating
on the environment are available from Source „ Define.
You may permanently change the value of an environment variable using the
assign primitive, as in the example
hassignjhijhmacrojHi there!ii
You may also locally change the values of one or several environment vari-
ables using the with primitive:
hwithjfont-seriesjboldjcolorjredjBold red texti
The with primitive can also be used for local redefinitions of macros:
hwith j strong j hmacro j body j hwith j font-series j bold j color j red j bodyii j hstrong j
strongi texti
The value of an environment variable may be retrieved using the value primi-
tive, as in the following code to increase a counter:
hassignjmy-counterjhplusjmy-counterj1ii
Here we recall that the default rendering of hvalue j my-counteri inside source
code is my-counter (see sections 12.2.2 and 12.3.1). Our example actually shows
that both left-hand sides of assignments and values of environment variables
are emphasized in green, which should help to locate environment variables
inside source code. Similarly, macro arguments can be recognized by their
brown color.
We recall that the value of an existing environment variable can be retrieved
using the \ key. For instance, \ m y - c o u n t e r ↩ yields my-counter. In
source mode, you may also use the keyboard shortcuts ⌘⌃= , ⌘⌃w , and ⌘⌃v
to produce assign, with, and value tags.
216 GET IT YOUR WAY

12.4.2 Macro expansion


The main interest of the style-sheet language is the possibility to define macros.
These come in three flavors: ordinary macros, macros which take an arbitrary
number of arguments and external macros, whose expansion is computed
by SCHEME or a plug-in. The macro-related primitives are available from the
Source „ Macro menu. Below, we will only describe ordinary macros.
Ordinary macros are defined using

hassignjmy-macrojhmacrojx1j ⋅ ⋅ ⋅ jxnjbodyii

After such an assignment, my-macro becomes a new primitive with n argu-


ments, which may be called using

hmy-macrojy1j⋅ ⋅ ⋅jyni

Inside the body of the macro, the arg primitive may be used to retrieve the
values of the arguments to the macro. Notice that the default rendering of hargj
namei inside source code is name:

hassignjhellojhmacrojnamejHello name, you look nice today!ii

It is possible to call a macro with fewer or more arguments than the expected
number. Superfluous arguments are simply ignored. Missing arguments take
the nullary uninit primitive (with rendering ?) as value:

hassignjheyj
hmacrojfirstjsecondj
hifj
hequaljsecondj?ij
Hey first, you look lonely today...j
Hey first and second, you form a nice couple!iii

You are allowed to use macros as values:

hassignjmy-macro-copyjmy-macroi

However, when using this style of macro programming, one should keep in
mind that TEXMACS macros use a call-by-name evaluation strategy, contrary to
functional programming languages such as SCHEME (see section 12.4.4 below).
The compound tag may be used to apply macros that are the result of a com-
putation:

hassignjoverloaded-hij
hmacrojnamej
hcompoundj
hifjhnice-weatherijhappy-hijsad-hiij
nameiii
12.4 THE STYLE-SHEET LANGUAGE 217

12.4.3 Formatting primitives

Most TEXMACS presentation tags can be divided in two main categories: inline
tags and block tags. Inline tags are used for small pieces of text, whereas block
tags can contain text that spans over several paragraphs. For instance, frac is
a typical inline tag, whereas theorem is a typical block tag. Some tags (such as
strong) are inline if their argument is inline and block otherwise.

The most primitive inline tag concat is used for horizontal concatenation:
hconcat j hwith j color j blue j bluei j hem j emphasisii is rendered as blueemphasis.
Similarly, the most primitive block tag document is used for vertical succes-
sions of paragraphs: hdocumentjFirstjSecondjThirdi is rendered as

First
Second
Third

The concat and document tags are so common that their names are actu-
ally hidden for the default rendering of source code (see section 12.2.2 and
Figure 12.6).

When writing macros, it is important to be aware of the inline or block nature


of tags, because block tags inside a horizontal concatenation are not rendered
in an adequate way. For example, hconcatjLeftjhdocumentjTopjBottomijRighti
yields

LeftTop Right
Bottom
instead of the expected

LeftTop
BottomRight

If you need to surround a block tag with inline text, then you must use the
surround primitive:

hassignjmy-theoremj
hmacrojbodyj
hsurroundjhno-indentihwithjfont-seriesjboldjTheorem. ijhright-flushij
bodyiii

In this example, we surrounded the body of the theorem with the bold text
“Theorem.” on the left and a “right-flush” on the right-hand side. Flushing
to the right is important in order to make the blue bounding box around the
theorem look nice when editing the body of the theorem.
218 GET IT YOUR WAY

In most cases, TEXMACS does a good job in determining which tags are inline
and which ones are not. However, you sometimes may wish to force a tag to
be a block environment. For instance, the tag very-important defined by

hassignjvery-importantjhmacrojbodyjhwithjfont-seriesjboldjcolorjredjbodyiii

may be used both as an inline tag and as a block environment. When placing
your cursor just before the with-tag and hitting ↩ followed by ⌫ , you obtain

hassignjvery-importantj
hmacrojbodyj
hwithjfont-seriesjboldjcolorjredjbodyiii

These actions inserted a document tag around the body of the macro. The doc-
ument tag itself is invisible (you should select Tags with special rendering „ raw
in Document „ Source „ Preferences to make it visible), but its presence is indi-
cated through the stretched rendering. Since the body of the macro is now a
block, your tag very-important automatically becomes a block environment as
well.

Another important property of tags is whether they contain normal textual


content or tabular content. For example, consider the definition of the stan-
dard eqnarray* tag (with a bit of the presentation markup being suppressed):

hassignjeqnarray*j
hmacrojbodyj
hwithjpar-modejcenterjmodejmathjmath-displayjtruejpar-sepj0.45fnj
hsurround j hno-page-break*ihvspace* j 0.5fni j hvspace j 0.5fnihno-
indent*ij
htformatj
htwithjtable-hyphenjyij
htwithjtable-widthj1parij
htwithjtable-min-colsj3ij
htwithjtable-max-colsj3ij
hcwithj1j-1j1j1jcell-hpartj1ij
hcwithj1j-1j-1j-1jcell-hpartj1ij
bodyiiiii

The use of surround indicates that eqnarray* is a block environment and the use
of tformat specifies that it is also a tabular environment. Moreover, the twith
and cwith are used to specify further formatting information: since we are a
block environment, we enable hyphenation and let the table extend over the
whole paragraph (unused space being equally distributed over the first and
last columns). Furthermore, we have specified that the table contains exactly
three columns.
12.4 THE STYLE-SHEET LANGUAGE 219

Finally, it is important to bear in mind that style-sheets do not only specify


the final presentation of documents on paper: they also determine the way
documents are presented during the editing phase. Above, we have already
mentioned the use of the right-flush tag in order to improve the rendering of
visual border hints. Similarly, flags can be used to indicate the presence of
invisible arguments while editing a document:

hassignjlabeled-theoremj
hmacrojidjbodyj
hsurroundj
hconcatj
hno-indentij
hflagjId: idjbluejidij
hwithjfont-seriesjboldjTheorem. iij
hright-flushij
bodyiii

More generally, the specific tag with first argument “screen” may be used to
display visual hints that are removed when printing the document (see sec-
tion 7.6.2).

12.4.4 Evaluation control


The Source „ Evaluation menu contains several primitives to control the way
expressions in the style-sheet language are evaluated. These primitives may
in particular be used for the definition of “meta-macros” whose purpose is to
define or redefine other macros. One typical example is the new-theorem meta-
macro for the definition of new theorems:

hassignjnew-theoremj
hmacrojnamejtextj
hquasij
hassignjhunquotejnameij
hmacrojbodyj
hsurroundjhno-indentihstrongjhunquotejtexti. ijhright-flushij
bodyiiiiii

When expanding hnew-theorem j theorem j Theoremi in this example, we first


evaluate all unquote instructions inside the quasi primitive, which yields the
expression

hassignjtheoremj
hmacrojbodyj
hsurroundjhno-indentihstrongjTheorem. ijhright-flushij
bodyiii

Next, this expression is evaluated, thereby defining a macro theorem.


220 GET IT YOUR WAY

It should be noticed that the TEXMACS conventions for evaluation are slightly
different then those from conventional functional languages such as SCHEME.
We recall that SCHEME is the extension language for TEXMACS; see chapter 14 for
a short introduction. The subtle differences between the style-sheet language
and SCHEME are motivated by our objective to make it as easy as possible for
the user to write macros for typesetting purposes. Assuming that you know
the basics of SCHEME, it is instructive to examine the differences on a few exam-
ples.
When TEXMACS calls a macro hmacro j x1 j ⋅ ⋅ ⋅ j xn j bodyi with arguments y1, . . . ,
yn, the argument variables x1, . . . , xn are bound to the unevaluated expressions
y1, . . . , yn, and the body is evaluated with these bindings. The evaluation of yi
takes place each time the argument xi is actually used during the evaluation of
the macro. In particular, when applying the macro hmacrojxjx and again xi to
an expression y, the expression y is evaluated twice.
In SCHEME, the literal bodies of SCHEME macros are evaluated twice, whereas
the arguments of functions are evaluated only once. On the other hand, when
retrieving a variable (whether it is an argument or an environment variable),
the value is not evaluated. Consequently, a TEXMACS macro

hassignjfoojhmacrojxjhblahjxjxiii

corresponds to a SCHEME macro

(define-macro (foo x)
`(let ((x (lambda () ,x)))
(blah (x) (x)))

Conversely, the SCHEME macro and function

(define-macro (foo x) (blah x x))


(define (fun x) (blah x x))

admit the following analogues in TEXMACS:

hassignjfoojhmacrojxjhevaljhblahjhquote-argjxijhquote-argjxiiiii
hassignjfunjhmacrojxjhwithjx*jxjhblahjhquote-valuejx*ijhquote-valuejx*iiiii

Here the primitives quote-arg and quote-value are used to retrieve the value of
an argument or an environment variable. The TEXMACS primitives eval, quote,
quasiquote, and unquote behave in the same way as their SCHEME analogues.
The quasi primitive is a shortcut for quasi-quotation followed by evaluation.

12.4.5 Control flow


The Source „ Flow control menu contains TEXMACS analogues of basic control
flow primitives that can be found in conventional programming languages: if,
case, while, and for-each. However, be warned that the conditional constructs
12.4 THE STYLE-SHEET LANGUAGE 221

are quite fragile: they only apply to inline content and it is recommended
that the various alternatives only affect the rendering, not the structure. For
instance, consider the fragment

hassignjweirdj
hmacrojbodyj
hifjhmy-conditionijHi body!jhlabeljbody iiii

In the “then part” of the if primitive, the body argument is a regular macro
argument that can be edited by the user (we say that it is accessible). In the
“else part”, the body argument is a hidden parameter that should be deacti-
vated before you can edit it. To remain on the safe side, TEXMACS considers the
body argument of the weird macro to be inaccessible, even when it is rendered
according to the “then part”.
The if primitive for conditional typesetting can be entered using ⌘⌃? and is by
far the most important control flow primitive. We recommend to mainly use
it in combination with the compound primitive, as follows:

hassignjrich-appendixj
hmacrojtitlejbodyj
hcompoundj
hifjhlong-documentijchapter-appendixjsection-appendixij
titlej
bodyiii

In this example, rich-appendix is a block environment consisting of a title and


a body, and that is rendered as a chapter for long documents and as a section
for short ones. Notice that the following implementation would have been
incorrect, since the if primitive currently only works for inline content:

hassignjrich-appendixj
hmacrojtitlejbodyj
hifj
hlong-documentij
hchapter-appendixjtitlejbodyij
hsection-appendixjtitlejbodyiiii

The if primitive can also be used in order to implement optional arguments:

hassignjheyj
hmacrojfirstjsecondj
hifj
hequaljsecondj?ij
Hey first, you look lonely today...j
Hey first and second, you form a nice couple!iii
222 GET IT YOUR WAY

However, TEXMACS is not clever enough to detect which arguments are optional
and which arguments are accessible. This information should be specified
manually using the drd-props primitive; see the reference guide for more infor-
mation.

12.4.6 Computational markup


The menus Source „ Arithmetic, Text, Tuple, and Condition contain different
primitives for computing with integers, strings, tuples, and boolean values. For
instance, in the following code, the new-important tag defines a new “impor-
tant tag” as well as a red variant:

hassignjnew-importantj
hmacrojnamej
hquasij
hconcatj
hassignj
hunquotejnameij
hmacrojxjhwithjfont-seriesjboldjxiiij
hassignj
hunquotejhmergejnamej-rediij
hmacrojxjhwithjfont-seriesjboldjcolorjredjxiiiiiii

Here we use the merge primitive in order to concatenate two strings. Precise
positioning is possible through appropriate computations with lengths:

hassignjcenter-axisjhmacrojbodyjhmovejbodyjjhminusj0.5exj0.5hiiii

The purpose of this macro is to vertically center the argument at the position
of the fraction bar. This is achieved by moving it up by half the height 0.5 ex
of an x-character and then back down by half the height 0.5 h of the argument
itself (the length unit h is automatically defined to be the height of the main
body inside the move primitive).
Chapter 13
Designing with style

The previous chapter gave a first introduction to the stylesheet language and
how to add your own macros. We are now ready to dive deeper into this topic
and investigate how to design complete document styles and style packages.

Scientific documents use a variety of style elements: section titles, item lists,
theorems, headers, etc. New document styles are meant to offer the complete
functionality of the built-in styles, but with a special design, which might for
instance be dictated by the “graphical charter” of a journal. Since it would be
cumbersome to redevelop all standard macros from scratch, new styles are
typically designed as customizations of existing ones. The bulk of this chapter
is dedicated to explaining how this works.

Style packages correspond to additional customizations that can be combined


with any base style. This is typically useful for personal notations or when
one or more macros need to be adapted in order to achieve a certain graphical
effect. The explanations in this chapter may serve for the development of style
packages that customize the standard styles.

Advanced users may also design style packages for new types of functionality
such as literate programming or interactive courses. Such style packages are
usually accompanied by extensions to the editor itself, in the form of keyboard
shortcuts, special menu entries, or more complex editing routines. The next
chapter gives a first glimpse of how to develop such enhancements.

13.1 Some words of caution

We recall that one of the main aims of beautiful typesetting and graphical
design is to be “invisible”: readers should focus on content and not be dis-
tracted by typesetting details. This is a quite delicate task which is really a
job for experts on typography. Entire books have been written on this topic;
see for instance [4, 40].

With the advent of typesetting software, the bulk of the traditional design tasks
reduces to the development of high quality document styles. A priori, this still
requires the same kind of expertise, so why would you want to this your-
self? One reason could be that you wish to reproduce the style of a particular

223
224 DESIGNING WITH STYLE

journal. But maybe you just got bored aping your colleague next door and
prefer to have some fun creating your own distinctive style instead.

If you go down this road and design your own style, then it is tempting to
introduce all kinds of fancy decorations for standard environments, such as
boxes around theorems, drop shadows for section titles, your favorite pictures
for list items, etc. Keep in mind that such phantasies may quickly saturate and
irritate your readers. Instead, we invite you to search for more subtle ways to
distinguish yourself. This can often be achieved through the careful selection
of a few fonts, or by modifying some spacings or separators. For example, the
simple use of a sans serif font for theorems will already distinguish your style
from all built-in TEXMACS styles:

Theorem 13.1. This statement has a distinctive look & feel.

Notice that it is not necessary to refrain from all forms of ornaments. For
instance, it may be all right to use the following type of main section titles:

My fancy section

Although such titles are somewhat “aggressive”, they tend to occur only a few
times in a document. As long as this is the only fantasy in your document
style, this remains acceptable, while immediately ensuring a distinctive look
and feel.

Another thing that you should worry about is related to the dual “data
versus program” nature of TEXMACS macros that we first mentioned in sec-
tion 12.2.3. Now the programming side becomes more significant when macros
are grouped together in style files or packages. In many respects, the develop-
ment of style files is analogous to writing software libraries, with macros in the
role of library functions and subroutines. Besides aesthetical considerations, it
is therefore important to think about issues like dependencies, maintainability,
and orthogonality (i.e. how well do your macros combine with macros from
other packages?).

Once again, you should be guided by the notion of simplicity. The simpler
your personal customizations are and the more they rely on standard mecha-
nisms, the more likely they will continue to work well with future versions of
TEXMACS and in combination with other style packages. For example, if your
macros crucially depend on some obscure internal macro that you found in one
of the TEXMACS style packages, then they will break down if the internal macro
happens to disappear in a future version of TEXMACS. Similarly, your macros
may fail to work in combination with alternate styles that do not implement
the required internal macro. For similar reasons, you should avoid complex
macros that adjust the typesetting process in subtle ways: ongoing progress
in the TEXMACS typesetter may make it difficult to maintain such macros.
13.2 ANATOMY OF A STYLE PACKAGE 225

13.2 Anatomy of a style package

Before you start designing your own style files, we recommend you take a
closer look at the existing style files. One fairly complete example is the svjour
base style for articles published by SPRINGER VERLAG. This style is selected
using Document „ Style „ Article „ Springer „ svjour. After selecting this style,
you may open the corresponding source file using Document „ Style „ Edit style.

The first line of the svjour style file specifies the style packages on which
the style is based. It essentially uses the same style packages as the standard
article style, together with one additional package std-latex:

huse-package jstdjenv-basejenv-mathjenv-floatjenv-programjheader-articlej
title-basejsection-articlejstd-latexi

The std-latex package is useful when adapting a LATEX style file to TEXMACS,
since it provides several macros that allow you to specify global style para-
meters in “the LATEX way”. For instance, the svjour style uses the following
lines to specify the global margins and text width—both for single and double
column articles:

hassignjtex-odd-side-marginjhmacrojhifjhequaljpar-columnsj1ij0ptj-30ptiii
hassignjtex-even-side-marginjhmacrojhifjhequaljpar-columnsj1ij0ptj-30ptiii
hassignjtex-text-widthjhmacrojhifjhequaljpar-columnsj1ij25.5ccj17.8cmiii

Various other global style parameters are specified in a similar way.

The remainder of the svjour style file redefines some of the most significant
macros that determine the layout of articles. One may distinguish the following
main categories:

• Specification of the fonts and font sizes to be used.

• Rendering of sectional macros.

• Specification of headers and footers to be used.

• Theorem-like environments.

• Item lists and enumerations.

• Rendering of the document title and the abstract.

Let us briefly study how some of these customizations were carried out for
svjour. More general and detailed explanations will be provided in the sec-
tions below.
226 DESIGNING WITH STYLE

Fonts and font sizes


Style files for journals often specify the main document font and its variants
with care. The svjour style specifies the default font size to be 10 pt with
a 0.2 em interline space, but also redefines the standard tags for other font
sizes, such as small, large, smaller, etc. For example, the default rendering of
footnotes uses a smaller font size that is specified through the smaller tag. The
svjour style redefines it to use a 9 pt font with a 2 pt interline space:

hassignjsmallerjhmacrojxjhwithjfont-base-sizej9jpar-sepj2ptjxiii

Sectional macros
After the main document font and page layout, the rendering of section titles
is the next most significant characteristic of a scientific document style. Most
journals use bold, emphasized, or small capital fonts, and carefully specify the
amount of vertical space to be inserted before and after titles. Styles that were
adapted from LATEX by means of the std-latex package may reproduce TEX-
style rubber spaces using the tex-len macro. For instance, svjour renders main
section titles in the following way:

hassignjsection-titlej
hmacrojnamej
hsectional-normal-boldj
hconcatj
hvspace*jhtex-lenj21ddj4ptj4ptiij
hnormal-sizejnameij
hvspacejhtex-lenj10.5ddj4ptj4ptiiiiii

Here sectional-normal-bold is a utility macro for rendering bold section titles.


It also takes care of a few other issues such as forbidding page breaks just after
the title.

Headers and footers


Most styles determine headers and footers as a function of the title and names
of the authors. TEXMACS provides a few “call-back macros” for this purpose:
header-title (document title), header-author (document author), header-primary
(primary sections), and header-secondary (secondary sections). For example,
the header-author macro is called with the name of the author as an argument,
when specifying this information in the title of your document. The svjour
style exploits this mechanism to redefine the even page header so as to contain
the author's name:
hassignjheader-authorj
hmacrojnamej
hassignjpage-even-headerj
hsmallj
hno-indentihpage-numberihhtabj5mminameiiii
13.2 ANATOMY OF A STYLE PACKAGE 227

Theorem-like environments
Scientific articles require many technical markup elements like theorems, enu-
merations, algorithms, technical pictures, etc. Full-fledged styles may redefine
the rendering of such markup elements. The standard TEXMACS styles con-
tain a large number of macros that allow you to customize specific rendering
aspects. For instance, the main rendering of theorem-like environments is con-
trolled through the render-theorem macro. But it is also possible to change the
font for the text “THEOREM 3.6.” using theorem-name, as well as the separator
“.” after the number using theorem-sep. For our example svjour style, we
essentially have

hassignjtheorem-namejhmacrojnamejhwithjfont-seriesjboldjnameiii
hassignjtheorem-sepjhmacroj. ii
hassignjrender-theoremj
hmacrojwhichjbodyj
hpadded-normalj1fnj1fnj
hsurroundjhtheorem-namejwhichhtheorem-sepiijj
hwithjfont-shapejitalicjbodyiiiii

In the definition of render-theorem, the padded-normal macro is used for speci-


fying the vertical padding around theorem-like environments. The std-utils
style package contains various other handy utility macros of this kind.

Lists and enumerations


Different nesting levels of list environments typically require separate ren-
dering styles. TEXMACS provides the macros enumerate-1, enumerate-2, etc. for
top-level enumerations, second level sub-enumerations, and so on. Most style
files limit themselves to three nesting levels; for svjour, we have

hassign j aligned-accolade-item j hmacro j x j haligned-item j hwith j font-shape j right j


{x}iiii
hnew-listjenumerate-1jaligned-dot-itemjidentityi
hnew-listjenumerate-2jaligned-accolade-itemjhmacrojxjhnumberjxjalphaiii
hnew-listjenumerate-3jaligned-dot-itemjhmacrojxjhnumberjxjromaniii

The new-list construct is used to define the macros enumerate-1, enumerate-2,


and enumerate-3; its second argument is a macro that is used for rendering
items; the third argument contains a macro that is used for transforming the
numbers of items. The macros aligned-item and aligned-dot-item are standard
rendering macros that can be redefined. The rendering of lists themselves is
controlled through the render-list macro.

Document titles and abstracts


One of the most complex parts of style files concerns document titles and
abstracts. The difficulty stems from the fact that title and abstract information
should really be thought of as a collection of metadata for the document. The
228 DESIGNING WITH STYLE

rendering then proceeds in two steps: one first has to collect and reorganize
the data in an appropriate way and then call lower-level rendering macros
in an appropriate order. Here one has to keep in mind that a lot of informa-
tion (keywords, subject classifiers, affiliations, etc.) is optional or may need
to be recombined (various authors with multiple affiliations).
It is recommended that style files only customize the final rendering macros
for title and abstract information. The title mainly consists of a succession of
“blocks” that are rendered using the doc-title-block macro. Specific kinds of
information are rendered using dedicated macros doc-render-title, doc-subtitle,
doc-date, etc. For example, the rendering of the main document title is defined
as follows for the svjour style:

hassignjdoc-render-titlej
hmacrojxj
hsurroundjjhvspacej11.24ptij
hdoc-title-block jhlarger jhwith j math-font-series jboldj font-series jboldj
xiiiiii

13.3 Some tips before things get technical

Before going deeper into the technical details about how to control specific
style elements, let us first discuss a few general tips for the development of
style packages.

Which macros to redefine


Most standard style files and packages consist of a succession of macro defi-
nitions and specifications of default values for environment variables. When
customizing an existing style, it is important to carefully select the macros and
environment variables to be redefined.
Now certain tags in the standard style files are directly exposed to the end-user
through the interface. For instance, you have direct access to the tags strong
and section through the menu entries Insert „ Content tag „ Strong and Insert „
Section „ Section. Other tags such as section-title or render-theorem are rather
provided for customization purposes by developers of style files. Some style
packages also define auxiliary helper macros for internal purposes.
Although sufficiently simple tags like strong can be redefined directly in your
own style files, this is not recommended for more complex tags such as section.
Indeed, the section tag takes care of many tasks: rendering the title, resetting
the counter for subsections, entering the title into the table of contents, and so
on. In order to customize complex tags of this kind, you should rather redefine
one or more of the “companion tags” section-title, section-clean, section-toc,
etc. that control these more specific subtasks.
13.3 SOME TIPS BEFORE THINGS GET TECHNICAL 229

Customizing existing macros


Imagine that you want to change the rendering of a given tag, like lemma. We
have just seen that TEXMACS provides a set of carefully designed companion
macros that can be customized to modify specific aspects of the rendering. For
instance (see section 13.2), you are supposed to redefine one of the macros
render-theorem, theorem-name, or theorem-sep in order to customize the ren-
dering of lemma and all other theorem-like environments.
However, in some cases, it may not be clear which companion macro to cus-
tomize. If we just wanted to change the presentation of lemmas and not of
any other theorem-like environments, then we clearly cannot modify render-
theorem, theorem-name, or theorem-sep. Besides, you may not want to spend
too much time on understanding the macro hierarchy of TEXMACS, thereby
ignoring the very existence of render-theorem, theorem-name, and theorem-sep.
So imagine that you want all lemmas to appear in red. One thing you can
always do is copy the original definition of the lemma macro to a safe place and
redefine it on top of the original definition:

hassignjorig-lemmajlemmai
hassignjlemmajhmacrojbodyjhwithjcolorjredjhorig-lemmajbodyiiii

Alternatively, if only the text inside the lemma should be rendered in red, then
you may do:

hassignjorig-lemmajlemmai
hassignjlemmajhmacrojbodyjhorig-lemmajhwithjcolorjredjbodyiiii

However, be warned that this mechanism is somewhat fragile: if the name


orig-lemma was already in use (for instance, if you already performed a similar
customization in another style package), then you may introduce a circular
dependency lemma → orig-lemma → lemma → orig-lemma → ⋅⋅⋅. Here we note
that TEXMACS contains no safeguards against programming errors by devel-
opers of style packages: infinite loops of the above type will simply crash the
editor.
One obvious fix is to choose the backup name orig-lemma with more care; e.g.
uncolored-lemma might be more appropriate. It is also a good idea to define
the backup macro if only if no macro with the same name already exists; this
can be done by using the provide primitive instead of assign:

hprovidejuncolored-lemmajlemmai
hassignjlemmajhmacrojbodyjhwithjcolorjredjhuncolored-lemmajbodyiiii

At the end of section 13.7, the redefinition of inc-theorem shows a more robust
but subtle mechanism for customizing existing macros.
230 DESIGNING WITH STYLE

Local customizations
Another frequent situation is that you only want to modify the rendering of a
tag when it is used inside another one. On the web, the Cascading Style Sheet
language (CSS) provides a mechanism for doing this. In TEXMACS, you may sim-
ulate this behavior by redefining macros inside a with. For example, imagine
that we want to suppress the inter-paragraph space inside lists within the-
orem-like environments. Then we may use:

hassignjorig-render-theoremjrender-theoremi
hassignjrender-theoremj
hmacrojnamejbodyj
hwithjorig-render-listjrender-listj
hwithjrender-listjhmacrojxjhorig-render-listjhwithjpar-par-sepj0fnjxiiij
horig-render-theoremjnamejbodyiiiii

On the one hand, this mechanism is a bit more complex than CSS, where it
suffices to respecify the par-par-sep attribute of lists inside theorems. On the
other hand, it is also more powerful, since the render-theorem macro applies to
all theorem-like environments at once.

Rely on the “standard utilities”


The style package std-utils contains various useful “helper macros” that
should make it easier to develop style packages. It mainly contains macros for
• Writing block environments that extend over the entire paragraph
width. Notice that the title-base package provides some additional
macros for wide section titles.
• Writing wide block environments that are padded, underlined, over-
lined, or in framed boxes.
• Recursive indentation.
• Setting page headers and footers.
• Localization of text.
It is good practice to rely on these standard macros whenever possible. Indeed,
the low-level TEXMACS internals may be subject to minor changes. When
building upon standard macros with a clear intention, you increase the upward
compatibility of your style-sheets.

Internationalization
Certain tags like theorems, figures, or bibliographies need to print English text
like “Theorem”, “Figure”, or “References”. In order to allow this text to be cus-
tomized, such tags usually come with companion macros theorem-text, figure-
text, bibliography-text, etc. For example, the svjour style redefines the figure-
text macro to print “Fig.” instead of “Figure”. In order to automatically trans-
13.3 SOME TIPS BEFORE THINGS GET TECHNICAL 231

late the text from English into the current language, you should pass it as an
argument to the localize macro. For instance, the section-base package con-
tains the following default definition of bibliography-text:

hassignjbibliography-textjhmacrojhlocalizejBibliographyiii

The directory $TEXMACS_PATH/langs/natural/dic contains the dictionaries


for translations into the supported languages. Here $TEXMACS_PATH is the
place where TEXMACS is installed on your system.

Converting LATEX styles

Style files for TEX/LATEX are particularly complex and ill-behaved, with lots of
auxiliary macros and style parameters without clear semantics. For this reason,
the built-in LATEX converters perform rather poorly on style files. TEXMACS pro-
vides equivalents for some of the most important LATEX styles. If you wish
to mimic another style, then we recommend that you proceed as follows:

• Try to import the LATEX style file. Most of the structure will be lost,
but the converter sometimes manages to import at least a few macros
and environment variables. The result of the conversion may therefore
provide a reasonable start for the development of a TEXMACS equivalent
for your LATEX style.

• Determine an existing TEXMACS style that comes as close as possible to


the desired style and base your new style on it using use-package. Notice
that the converter from the previous step may already have come up
with a good proposal.

• Add a line huse-package jstd-latexi to your style file and customize the
utility macros from that package in order to specify the most important
layout parameters.

• Patiently customize various other macros in order to match the desired


style, following the mechanisms that will be described in the subsec-
tions below.

Concerning the third step, we notice that TEXMACS does not always use the
same conventions as TEX/LATEX when it comes to global layout parameters.
For example, the style parameters \oddsidemargin and \evensidemargin
for left margins on odd and even pages do not mean what you would think,
since TEX automatically adds one extra inch. The std-latex package provides
macros tex-odd-side-margin and tex-even-side-margin that mimic this somewhat
twisted behavior in TEXMACS. Various other style parameters \textwidth,
\topmargin, \jot, \abovedisplayskip, etc. admit similar analogues tex-
text-width, tex-top-margin, tex-jot, tex-above-display-skip.
232 DESIGNING WITH STYLE

The std-latex package also defines a macro tex-len with three arguments
default-length, plus, and minus that emulates the syntax of TEX rubber
lengths. For example, htex-lenj1 emj0.5 emj0.25 emi stands for the rubber length
with default, minimal, and maximal values 1 em, 0.75 em, and 1.5 em, respec-
tively. The corresponding TEXMACS syntax for this rubber length is htmlen j
0.75 em j 1 em j 1.5 emi. See pages 62 and 7.1 for more information on TEXMACS
lengths.

13.4 Customizing the general page layout

The general layout of a document is mainly modified by setting the appropriate


environment variables for page layout and paragraph layout (see the refer-
ence manual for a complete list of these variables). For example, by including
the following lines in your style file, you can set the page size to letter and
the left and right margins to 1.25 in:

hassignjpage-typejletteri
hassignjpage-oddj1.25ini
hassignjpage-evenj1.25ini
hassignjpage-rightj1.25ini

Recall from section 3.10 that the margins may be different on even and odd
pages; the environment variables page-odd and page-right correspond to the left
and right margins on odd pages.

Note that the environment variables for page layout are quite different in
TEXMACS and TEX/LATEX. In order to make it easier to adapt LATEX style files to
TEXMACS, we have therefore provided the std-latex package, which emulates
the environment variables of TEX/LATEX. Typically, this allows you specify
the global layout using declarations such as

hassignjtex-odd-side-marginjhmacroj20ptii
hassignjtex-even-side-marginjhmacroj20ptii
hassignjtex-text-widthjhmacroj33pcii

Notice that page-odd, page-even, etc. are lengths, whereas tex-odd-side-margin,


tex-even-side-margin, etc. are macros that return a length.
The page headers and footers are usually not determined by global environ-
ment variables or macros, since they may change when a new chapter or section
is started. Instead, TEXMACS provides the call-back macros header-title, header-
author, header-primary, and header-secondary. These macros get called when
the document title or author are specified, or when a new primary or secondary
section is started (by default, primary sections correspond to chapters in books,
and to sections in articles). For instance, the following redefinition makes the
13.5 PROCESSING TITLE INFORMATION 233

principal section name appear on even pages, together with the current page
number and a wide underline.

hassignjheader-primaryj
hmacrojtitlejnrjtypej
hassignjpage-even-headerj
hquasiquotej
hwide-std-underlinedj
hpage-the-pageihhtabj5mmihunquotejtitleiiiiii

13.5 Processing title information

The “titles” of scientific documents usually carry a lot of additional information


about the authors, their affiliations, the creation date, grant acknowledgments,
etc. For this reason, TEXMACS treats the title information as a miniature data-
base, and the graphical rendering proceeds in two phases: the most relevant
information is first extracted from the database and reorganized. The actual
rendering is done at a second stage, using dedicated macros for this purpose.

The first stage is fairly complex, since one has to deal with various optional
data fields and potentially multiple authors with multiple affiliations. Var-
ious styles may present the data in different orders and one has to decide how
to present common affiliations among coauthors (see section 3.3.1 for a few
common styles). Since the required rewritings are rather intricate, they are
not performed by TEXMACS macros, but rather through “external” SCHEME rou-
tines whose precise description falls beyond the scope of this book.

The second stage is more straightforward: for each kind of title information,
there is a corresponding rendering macro that can be customized by particular
styles. For instance, the main title, an optional subtitle, the creation date, and
miscellaneous extra title fields are rendered using the macros doc-title, doc-
subtitle, doc-date, and doc-misc. So if the date should appear in a bold italic
typeface and at a distance of at least 0.5 fn from the other title fields, then you
may redefine doc-date as

hassignjdoc-datej
hmacrojxj
hsurroundjhvspace*j0.5fnijhvspacej0.5fnij
hdoc-title-blockjhwithjfont-shapejitalicjfont-seriesjboldjxiiiii

The helper macro doc-title-block should be used for rendering atomic blocks of
title information; many styles implement this macro by centering title blocks,
whereas other styles rather align them to the left. TEXMACS also uses the macro
doc-make-title for encapsulating all title information. You may specify an
amount of padding between titles and the main text by customizing this macro.
234 DESIGNING WITH STYLE

The rendering of author information is done using similar macros author-


name, author-affiliation, author-email, author-homepage, and author-misc. These
macros should rely on the macro doc-author-block for rendering atomic blocks
of author information. In addition, TEXMACS provides variants author-affilia-
tion-note, author-email-note, author-homepage-note, and author-misc-note that
are used when several authors share common information. These variants take
one additional argument that contains the symbol (such as †) that is used to
link the shared information to the corresponding authors.
Author information is often rendered differently for documents with one versus
several authors. In case of a single author, the doc-author macro is used for
rendering the block with all author information. This macro behaves simi-
larly to doc-title, doc-subtitle, etc., and should rely on doc-title-block for its
rendering. If there are multiple authors, then the doc-authors macro is used
for rendering the complete list of authors (the macro uses one argument for
each author), whereas the information of each individual author is encapsu-
lated inside a block that is rendered using the doc-authors-block macro.
Some further global metadata are provided in the abstract rather than in the
title. The rendering of the abstract is controlled via the macro render-abstract.
In addition, TEXMACS provides the macro abstract-keywords for rendering a list
of keywords (one argument for every keyword) and the macros abstract-acm,
abstract-msc, and abstract-pacs for specifying ACM, AMS, and PACS subject
classifiers.

13.6 Customizing sectional tags


TEXMACS provides the same sectional tags as LATEX: part, chapter, section, sub-
section, subsubsection, paragraph, subparagraph, and appendix. TEXMACS also
implements the unnumbered variants part*, chapter*, etc. and special section-
like tags bibliography, table-of-contents, the-index, the-glossary, list-of-figures,
list-of-tables.
One important additional “predicate macro” is sectional-short-style. If it eval-
uates to true, then appendices, tables of contents, etc. are considered to be at
the same level as sections. In the contrary case, they are at the same level as
chapters. Typically, articles use the short sectional style whereas books use the
long style.
The rendering of a sectional tag x is controlled through the macros x-sep,
x-post-sep, x-title and x-numbered-title. The x-sep macro prints the separator
between the section number and the section title. It defaults to the macro
sectional-sep, which defaults in its turn to a wide space. For example, after
redefining

hassignjsectional-sepjhmacroj – ii
sectional titles typically look as follows:

13.1 – Hairy GNUs


13.6 CUSTOMIZING SECTIONAL TAGS 235

Similarly, x-post-sep prints the separator between the section title and subse-
quent text. The x-title and x-numbered-title macros respectively specify how
to render unnumbered and numbered section titles. Usually, the user only
needs to modify x-title, since x-numbered-title is based on x-title. However, if
the numbers have to be rendered in a particular way, then it may be necessary
to redefine x-numbered-title. For instance, consider the redefinition

hassignjsubsection-numbered-titlej
hmacrojnamej
hsectional-normalj
hwithjfont-seriesjboldjhthe-subsectioni. inameiii

This has the following effect on the rendering of subsection titles:

2.3. Very hairy GNUs

Notice that the sectional-normal macro comes from the section-base style
package. You may find several similar macros sectional-normal-italic, sectional-
centered-bold, etc. there for some of the most frequent ways to render section
titles.
There are two main rendering styles for sectional titles. By default, paragraphs
and subparagraphs use a “short” rendering style, with a body that starts imme-
diately after the title:

My paragraph Blah, blah, and more blahs...

All other sectional tags use a “long” rendering style, in which case the section
title takes a separate line on its own:

My section
Blah, blah, and more blahs...

When customizing the rendering of sectional titles, we recommend that you


follow the same conventions: render paragraphs and subparagraphs in the
short way and all others in the long way.
Besides their rendering, several other aspects of sectional tags can be cus-
tomized:

• The call-back macro x-clean can be used for resetting some counters
when a new section is started. For example, in order to prefix all stan-
dard environments by the section counter, you may use the following
lines:

hassignjsection-cleanjhmacrojhreset-subsectionihreset-std-enviii
hassignjdisplay-std-envjhmacrojnrjhsection-prefixinrii
236 DESIGNING WITH STYLE

• The call-back macro x-header should be used in order to modify page


headers and footers when a new section is started. Typically, this macro
should call header-primary or header-secondary, or do nothing.

• The call-back macro x-toc should be used in order to customize the way
new sections appear in the table of contents.

13.7 Customizing numbered textual environments


TEXMACS provides three standard types of numbered textual environments:
theorem-like environments, remark-like environments, and exercise-like envi-
ronments. The first two types of environments are also called “enunciations”.
The following aspects of numbered textual environments can easily be cus-
tomized:

• Adding new environments.

• Modifying the rendering of the environments.

• Numbering the theorems in a different way.

Defining new environments


It is possible to introduce new environments using the meta-macros new-the-
orem, new-remark, and new-exercise. These environments take two arguments:
the name of the environment and the name which is used for its rendering. For
example, you may wish to define the environment experiment by

hnew-theoremjexperimentjExperimenti

The text “Experiment” will automatically be translated if your document is


written in a foreign language, provided that there is an entry for this word in
the TEXMACS dictionaries (see the section on internationalization on page 231).

Customizing the rendering


The main rendering of numbered textual environments can be customized by
redefining the macros render-enunciation, render-theorem, render-remark, and
render-exercise. These macros take the name of the environment (like “The-
orem 1.2”) and its body as arguments. For instance, if you want theorems to
appear in a slightly indented way, then you may redefine render-theorem as
follows:

hassignjrender-theoremj
hmacrojwhichjbodyj
hpadded-normalj1fnj1fnj
hsurroundjhtheorem-namejwhichhtheorem-sepiijj
hwithjfont-shapejitalicjpar-leftjhplusjpar-leftj1.5fnijbodyiiiii
13.7 CUSTOMIZING NUMBERED TEXTUAL ENVIRONMENTS 237

This redefinition produces the following effect:

THEOREM 13.2. This is a theorem that has been indented.

The macros render-theorem and render-remark are both based on the macro
render-enunciation. The only difference between theorems and remarks is that
theorems typically use an italic font. Note that proofs are rendered using
render-proof; this macro is based on render-remark.

As you may have noticed by examining the above redefinition of render-the-


orem, it is also possible to customize the way names of theorems are printed or
redefine the separator between the name and the body. Indeed, these aspects
are controlled by the macros theorem-name and theorem-sep. For example,
consider the following redefinitions:

hassign j theorem-name jhmacro j name jhwith j color jdark redj font-series jboldj font-
shapejsmall-capsjnameiii
hassignjtheorem-sepjhmacroj: ii

Then theorem-like environments will be rendered as follows:

PROPOSITION 13.3: This proposition is rendered in is a fancy way.

Customization of the numbering

All numbered environments such as sections and theorems come with coun-
ters section-nr, theorem-nr, etc. In order to increase, reset, or display the counter
theorem-nr, you should use the companion macros inc-theorem, reset-theorem,
and display-theorem. By redefining these macros, you may customize the way
in which environments are numbered. For instance, by redefining inc-theorem,
you may force theorems to reset the counter of corollaries:

hquasij
hassignj
inc-theoremj
hmacrojhcompoundjhunquotejinc-theoremiihreset-corollaryiiii

Notice the trick with quasi and unquote in order to take into account any addi-
tional action that might have been undertaken by the previous value of the
macro inc-theorem. Indeed, hunquote j inc-theoremi gets replaced by the pre-
vious value of the macro inc-theorem. This macro has zero arguments and
hcompoundjhunquotejinc-theoremii simply evaluates its body.
238 DESIGNING WITH STYLE

TEXMACS organizes counters in various counter groups, which allows you to


simultaneously reset all counters of a certain type at the start of a new section.
The following code from the number-long-article style package is used in
order to prefix all standard environments (theorems, equations, figures, etc.)
with the number of the current section:

hassignjsection-cleanjhmacrojhreset-subsectionihreset-std-enviii
hassignjdisplay-std-envjhmacrojnrjhsection-prefixinrii

13.8 Customizing list environments


Item lists and enumerations are made up of two main ingredients: the outer
list environment and the inner list items. For instance, consider the following
list, together with its corresponding source code:

hitemizej • First item.


hitemiFirst item.
• Second item.
hitemiSecond item.
hitemiThird item.i • Third item.
Then the itemize tag corresponds to the outer list environment, whereas the
bullets of the inner list items are produced by the item tag.
The rendering of the outer list environment is controlled by the render-list
macro, which takes the body of the list as its argument. For example, con-
sider the following redefinition of render-list:

hassignjrender-listj
hmacrojbodyj
hsurroundj
hno-page-break*ihvspace*j0.5fnij
hright-flushihvspacej0.5fnihno-indent*ij
hwithjpar-leftjhplusjpar-leftj3fnijpar-rightjhplusjpar-rightj3fnijbodyiiii

This redefinition affects the rendering of all list environments (itemize, enu-
merate, etc.) and reduces their right margin by 3 fn:

• This text, which has been made so long that it does not fit on a
single line, is indented on the right-hand side by 3 fn.

1. This text is indented by an additional 3 fn on the


right-hand side, since it occurs inside a nested list
environment.

• Once again: this text, which has been made so long that it does
not fit on a single line, is indented on the right-hand side by 3 fn.
13.8 CUSTOMIZING LIST ENVIRONMENTS 239

In a similar way, you may customize the rendering of list items by redefining
the macros aligned-item and compact-item. Both these macros take the text
for marking the item as their only argument (e.g. a bullet or a number). The
macro aligned-item aligns the marker to the right (so that subsequent text is
left-aligned), whereas compact-item aligns it to the left (so that subsequent text
may not be aligned).
For example, consider the following redefinition of aligned-item:

hassignjaligned-itemj
hmacrojxj
hconcatj
hvspace*j0.5fnij
hwithjpar-firstj-3fnjhyes-indentiij
hresizejhembbbjxijhminusj1rj2.5fnijjhplusj1rj0.5fnijiiii

Then items inside all list environments with aligned items will be “blackboard
emboldened”:
Items in aligned description lists are rendered using aligned-item.
First condition.
Second condition.
Items in compact description lists are rendered using compact-item.
Gnus and gnats. Nice beasts.
Micros and softies. Evil beings.
In this example, we used hresize jhembbb j xijhminus j1rj2.5fnijjhplus j1rj0.5fniji
to put hembbb j xi inside a box of width 3 fn: the new left limit of the box is
2.5 fn to the left of the original right limit 1 r; the new right limit is 0.5 fn
farther to the right. We next used hwithjpar-firstj-3fnjhyes-indentii to move the
resulting box 3 fn to the left, thereby aligning it to the right13.1.
Remark 13.4. Both aligned-item and compact-item are inline macros. They are
also base macros for various other internal macros aligned-space-item, long-
compact-strong-dot-item, etc. that are used for the rendering of the different
types of lists (itemize-arrow, description-long, etc.).
The std-list package also provides a macro new-list to define new lists. Its
syntax is hnew-listjnamejitem-render jitem-transformi, where name is the name of
the new list environment, item-render an (inline) macro for rendering the item
and item-transform an additional transformation that is applied on the item text.
For instance, the enumerate-roman environment is defined by

hnew-listjenumerate-romanjaligned-dot-itemjhmacrojxjhnumberjxjromaniii

13.1. There are simpler ways to achieve the same effect, but the way we presented here has the
advantage that the alignment remains correct when boxes are moved during line breaking.
Chapter 14
Extend beyond imagination
One major feature of TEXMACS is the possibility to extend the editor using the
GUILE-SCHEME extension language. Such extensions can be simple, like a per-
sonal boot file with frequently used keyboard shortcuts, or more complex,
like a plug-in with special editing routines for documents of a particular type.
The SCHEME language can also be used interactively from within the editor
or invoked by special markup like “actions”.
Why SCHEME? The choice may indeed seem somewhat odd if you are accus-
tomed to more conventional programming languages such as C++, JAVA,
or PYTHON. In particular, SCHEME's heavily parenthesized syntax may scare
more than one person. But it turns out that this baroque syntax has several
advantages for our application. For one thing, it is easy to learn. More impor-
tantly, it enables us to treat programs and data in a uniform manner, which
is particularly useful in the light of section 12.2.3. Other major advantages of
SCHEME are its interactivity and high level of abstraction.
This chapter starts with a crash course on SCHEME [56]. There are several more
extensive books on this topic, such as [15, 11, 52]. We also recommend to take
a look at the GUILE reference manual [22], since this is the SCHEME implemen-
tation on which TEXMACS is currently based.
The rest of the chapter provides an introduction to programming TEXMACS
extensions in SCHEME. More explanations on this subject can be found in Help „
Scheme extensions. It is also instructive to take a look at those TEXMACS source
files that are written in SCHEME. These files can be found in the progs subdi-
rectory of the path $TEXMACS_PATH where you installed TEXMACS. For instance,
$TEXMACS_PATH/progs/math/math-kbd.scm lists the keyboard shortcuts in
math mode.

14.1 A quick introduction to SCHEME


14.1.1 SCHEME sessions and atomic data types
TEXMACS uses SCHEME through an interactive interpreter. For a first encounter
with the language, we invite you to launch an interactive SCHEME session using
Insert „ Session „ Scheme. This allows you to enter commands after the SCHEME
prompt and execute them by pressing ↩ :
Scheme] (+ 1 1)
2
As you can see in this stunning example, applying a function f to the arguments
a1,..., an is done using (f a1 ... an). Besides numbers, other fundamental
atomic data types in SCHEME are booleans (#t and #f), characters (#\a, #\b,

240
14.1 A QUICK INTRODUCTION TO SCHEME 241

#\c, . . . ), strings ("hi", "there", . . . ) and symbols (x, fun, gnu2018, my-sym,
x/3*,...). The following mini-session shows a few typical computations with
such objects:
Scheme] (> 3 2)
#t
Scheme] (if (> 2 3) "yes" "no")
"no"
Scheme] (string->list "Bonjour")
(#\B #\o #\n #\j #\o #\u #\r)
Scheme] (string-append "Hi" " " "there" "!")
"Hi there!"
Scheme] (string->symbol "hop@boeh!stuff*")
hop@boeh!stuff*
Scheme] (symbol? 'my-sym)
#t
One difference between strings and symbols is the notation, since strings need
to be double quoted. Moreover, strings are literal constants, just like the num-
bers 2 and 3.14, whereas symbols are evaluated by SCHEME. One may prevent
a SCHEME expression from being evaluated using ' as a prefix operator; this
explains why we used 'my-sym in order to obtain the symbol my-sym. From a
computational point of view, symbols are sometimes more efficient: the equality
of two symbols can be checked in unit time, whereas all characters in two
strings need to be compared.
Symbols are also used as names for variables and functions. We note that
SCHEME is very flexible when it comes to names of functions: all characters can
be used except for whitespace and the special characters ()[]{}#.,;'"`\. This
makes it possible to use suggestive names string->symbol and symbol? for
converters and predicates. Also note that the dash - tends to be used (instead
of _) as a connector for multiple-word function names such as string-append.
In particular, many function names are prefixed by the type of their principal
argument.

14.1.2 Lists and SCHEME trees


Expressions of the form (x1 ... xn) are also called lists and they are one of
the most fundamental data structures in SCHEME. Lists are either constructed
using list (from its list of entries) or cons (from the first head entry and the
tail list of remaining entries):
Scheme] (list (+ 1 2 3) "hopsa" (= 2 3.4))
(6 "hopsa" #f)
242 EXTEND BEYOND IMAGINATION

Scheme] (cons (* 1 2 3 4 5) (list 6 7 8 9 10))


(120 6 7 8 9 10)
Notice that the second method corresponds to the way lists are stored in
memory: the empty list corresponds to a special constant, whereas non-empty
lists are stored as pairs with the first element of the list and a pointer to the
tail. One may test for emptiness using the null? predicate and access the head
and the tail using the car and cdr accessors. Moreover, (caar l), (cadr l),
etc. can be used as shorthands for (car (car l)), (car (cdr l)), etc.

Scheme] (define l (list 1 2 3))


Scheme] (list (null? l) (car l) (cdr l) (caddr l)
(null? (cdddr l)))
(#f 1 (2 3) 3 #t)
Lists are also quite convenient for the representation of TEXMACS document
√a
fragments. For instance, (frac (sqrt "a") "b") represents the fraction b .
One may use the prefix operator ' to construct explicit SCHEME expressions of
this kind, as we saw before in the case of symbols. The general mechanism is
called quoting and it is extremely convenient:

Scheme] (sqrt "a") ;; try to apply the function sqrt to "a"


Wrong type (expecting real number): "a"
Scheme] '(sqrt "a") ;; prevent evaluation using quoting
(sqrt "a")
SCHEME also offers the prefix operator ` for quasi-quoting. Like quoting, quasi-
quoting switches off evaluation; however, the evaluation of specific parts of
the expression can be switched on again using the prefix operators , and ,@
(called unquoting and unquote-splicing):

Scheme] `(hop (hola ,(+ 1 2) ,(string->list "hop"))


(hola ,(* 3 4) ,@(string->list "hop")))
(hop (hola 3 (#\h #\o #\p)) (hola 12 #\h #\o #\p))
Those SCHEME expressions that correspond to snippets of TEXMACS documents
will be called SCHEME trees. A SCHEME tree is either a string or a list of the
form (l t1 ... tn), where l is a TEXMACS primitive or macro and t1, . . . ,tn
are other SCHEME trees. One may convert such SCHEME trees to actual TEXMACS
trees and vice versa using the routines stree->tree and tree->stree:

Scheme] (stree->tree '(math (frac (sqrt "a") "b")))


√a
b
Scheme] (define my-name "John")
14.1 A QUICK INTRODUCTION TO SCHEME 243

Scheme] (stree->tree
`(concat "My name is " (strong ,my-name) "."))
My name is John.

14.1.3 Declaring functions and macros


New SCHEME functions can be declared using define:
Scheme] (define (fibonacci n)
(if (<= n 1) 1
(+ (fibonacci (- n 1))
(fibonacci (- n 2)))))
Scheme] (fibonacci 25)
121393
Scheme] (define (.. i j)
(if (< i j) (cons i (.. (+ i 1) j)) (list)))
Scheme] (.. 0 15)
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
One important feature of SCHEME is that it is a functional programming lan-
guage: functions can both be used as arguments and return values for other
functions. For example, you may use apply and map to apply a function to a
list of arguments or to each element of a list:
Scheme] (apply + (list 1 2 3 4))
10
Scheme] (map fibonacci (.. 0 15))
(1 1 2 3 5 8 13 21 34 55 89 144 233 377 610)
The following syntax allows use to define functions that return functions:
Scheme] (define ((unary-compose f g) x) (f (g x)))
Scheme] (unary-compose fibonacci fibonacci)
#<procedure #f (x)>
Scheme] ((unary-compose fibonacci fibonacci) 5)
34
SCHEME also provides syntactic sugar to declare functions with an arbitrary
number of arguments. The following improvement of unary-compose shows
an example:
Scheme] (define ((compose f . gs) . xs)
(apply f (map (lambda (g) (apply g xs)) gs)))
Scheme] ((compose - * +) 1 2 3 4)
;; (- (* 1 2 3 4) (+ 1 2 3 4)
14
244 EXTEND BEYOND IMAGINATION

Notice that (lambda (g) (apply g xs)) stands for the function that takes g
as input and that returns (apply g xs).
Yet another powerful feature of SCHEME is the possibility to enrich the lan-
guage with new primitives, through the declaration of SCHEME macros. This is
done using the keyword define-macro that has a similar syntax as define,
but with the difference that the return value is evaluated a second time.

Scheme] (define-macro (sum i vals . body)


`(apply + (map (lambda (,i) ,@body) ,vals)))
Scheme] (sum k (.. 0 10) (* k k))
;; (apply + (map (lambda (k) (* k k)) (.. 0 10)))
285
This example also illustrates the power of quasi-quotation in combination with
the macro system.
TEXMACS heavily relies on this possibility to extend the SCHEME language with
new macros. For instance, new keyboard shortcuts and menus can be defined
using the kbd-map and tm-menu macros, by means of a convenient syntax. In
fact, function and macro declarations themselves should be done using tm-
define and tm-define-macro: as will be detailed in section 14.3.2 below,
these enhanced versions of define and define-macro make it possible to
overload functions and macros in a contextual way; they also allow you to
enrich functions with extra information that may be exploited by the graph-
ical user interface, such as “suggested values” for certain function arguments.

14.1.4 Basic control structures

Local variables in SCHEME are introduced using the keyword let*, whereas
set! can be used to assign a new value to such a variable:
Scheme] (define (foo x)
(let* ((a (* x x))
(b (+ a x)))
(set! a (* a b))
(+ a x)))
Scheme] (foo 100)
101000100
The if primitive can be used both as an instruction and as an expression that
returns a value. SCHEME programmers also frequently rely on the cond prim-
itive which provides an elegant abbreviation for expressions like

(if c1 expr1
(if c2 expr2
...))
14.2 CUSTOMIZING THE GRAPHICAL USER INTERFACE 245

For instance:

Scheme] (define (mix l1 l2)


(cond ((null? l1) l2)
((null? l2) l1)
(else `(,(car l1) ,(car l2)
,@(mix (cdr l1) (cdr l2)))))))
Scheme] (mix (list 'a 'b 'c) (list 1 2 3 4 5))
(a 1 b 2 c 3 4 5)
The boolean combinators and and or can take an arbitrary number of argu-
ments. In fact, the types of the arguments are allowed to be arbitrary with
the property that any value distinct from #f is considered to be “true”. More
precisely, the evaluation of (and x1 ... xn) stops as soon as the first xi in
the list evaluates to #f (in which the return value is #f). If this never happens,
then the evaluation of xn is returned. Similar rules apply for the or primitive
and various other functions that manipulate boolean values.

Scheme] (define a #f)


Scheme] (define (set!a b) (set! a b) a)
Scheme] (list (and "hi" "there")
(and "hi" (set!a 10) #f (set!a 100))
a)
("there" #f 10)

14.2 Customizing the graphical user interface

14.2.1 Your personal boot file

So far, we have seen how to execute SCHEME commands from interactive ses-
sions. In order the develop more permanent SCHEME code for TEXMACS, the
simplest method is to create a personal boot file that should be named

$TEXMACS_HOME_PATH/progs/my-init-texmacs.scm

We recall that $TEXMACS_HOME_PATH usually points to the .TeXmacs subdirec-


tory of your home directory ~. If it exists, then the personal boot file is assumed
to contain a SCHEME program that will be executed every time you launch
TEXMACS. As a first test, you may create a personal boot file with a single line

(display* "Hello world!\n")

Every time you launch TEXMACS from the command line, this should display
Hello world! on your terminal.
246 EXTEND BEYOND IMAGINATION

14.2.2 Adding your own keyboard shortcuts

You may use the command kbd-map in order to define new keyboard short-
cuts. For example, if you wish to be able to start a new definition by typing
D e f . (and similarly for lemmas, propositions, and theorems), then it suffices
to add the following code to your personal boot file:

(kbd-map
("D e f ." (make 'definition))
("L e m ." (make 'lemma))
("P r o p ." (make 'proposition))
("T h ." (make 'theorem)))

Each shortcut is of the form (s cmd), where s is a string of key-combinations


and cmd the SCHEME command that should be executed. The command (make
name) starts a new tag with a given name at the current cursor position.
It is also possible to define shortcuts that only apply under certain circum-
stances. Assume for instance that we wish to define the shortcut p i for π,
but only in math mode. Assume in addition that we wish to be able to quickly
enter π2 and 2 π i as variants. This can be achieved as follows:

(kbd-map
(:mode in-math?)
("p i" "<mathpi>")
("p i var" (insert '(concat "<mathpi>" (rsup "2"))))
("p i var var" "2*<mathpi>*<mathi>"))

In this example, the command (insert t) is used to insert a given TEXMACS


tree t at the current cursor position. Since the insertion of strings is very
common, it is allowed to use ("p i" "<mathpi>") as a shorthand for
("p i" (insert "<mathpi>")).
Special keys such as ↩ , ⌫ , → , etc. carry special names return, backspace,
right, etc. Keyboard combinations using “Shift”, “Control”, “Alter”, and
“Meta” are obtained using the prefixes S-, C-, A-, and M-. In order to define ⌘⌃↩
as a keyboard shortcut for inserting a big vertical space, one may therefore use

(kbd-map
("C-M-return" (insert '(vspace "2fn"))))

Some simple keyboard shortcuts such as → or ⌃↩ are so heavily overloaded


that TEXMACS treats them in a special way. For example, → triggers the action
(kbd-right), which in turn invokes the function kbd-horizontal with suit-
able arguments. Instead of redefining the → shortcut, it is therefore better
14.2 CUSTOMIZING THE GRAPHICAL USER INTERFACE 247

to customize the function kbd-horizontal whenever appropriate. The cus-


tomization of existing functions will be discussed in more detail in section 14.3.2
below.

14.2.3 Adding your own menus

TEXMACS menus are generated through special SCHEME functions such as


texmacs-menu, insert-menu, or texmacs-extra-menu. Simple menus are
created using the macro menu-bind:

(menu-bind hello-menu
(-> "Opening"
("Dear Sir" (insert "Dear Sir,"))
("Dear Madam" (insert "Dear Madam,")))
(-> "Closing"
("Yours sincerely" (insert "Yours sincerely,"))
("Greetings" (insert "Greetings,"))))

Simple menu entries are of the form (label cmd), whereas -> is used in order
to create submenus. The menu hello-menu needs to be attached to one of
the standard menus in order to be accessible through the interface. Top-level
menus for your personal use should be added to texmacs-extra-menu (so
that they will appear just before the Focus menu):

(menu-bind texmacs-extra-menu
(=> "Hello" (link hello-menu))
(former))

The syntax => corresponds to a top-level pulldown submenu, whereas former


refers to the previous value of texmacs-extra-menu. We will come back
to the former primitive in section 14.3.2 below. Here it provides us with a
clean mechanism to extend the menu texmacs-extra-menu more than once,
if needed, possibly in different SCHEME modules.

You may use assuming or when for conditional menus; in the case of when,
the conditional menu items are greyed whenever the condition is not met. In
order to add hello-menu to insert-menu under the condition that we are
using the letter style, you may proceed as follows:

(menu-bind insert-menu
(former)
(assuming (style-has? "letter-style")
--- ;; horizontal separating bar
(link hello-menu)))
248 EXTEND BEYOND IMAGINATION

14.3 Extending the editor

14.3.1 Manipulation of active content

All TEXMACS documents or document fragments can be thought of as trees.


There are three data types that correspond to such trees:

Scheme trees. We have already encountered the type stree of scheme trees
in section 14.1.2; for instance, the scheme tree (frac (concat "a"
a2
(rsup "2")) "b+c") represents the formula b + c . Scheme trees can in
principle be manipulated using stand-alone SCHEME programs that do
not even require TEXMACS to be installed on your computer.

TEXMACS trees. The type tree of TEXMACS trees is a data type that is hard-
coded in the C++ source code of TEXMACS. It can in particular be used
to represent active document fragments that are visible in TEXMACS win-
dows. The tree type is an extension to the SCHEME language that is
specific to TEXMACS and that is only available inside the editor.

Hybrid trees. Often, it is also convenient to mix the above types of trees
into a super-type tm of so-called hybrid trees. More precisely, a hybrid
tree is either a string, a tree, or a list of the form (l x1 ... xn), where
l is a symbol and x1, . . ., xn are other hybrid trees.

Here is one example of each of these types of trees:

Scheme] (define st '(frac (concat "a" (rsup "2")) "b+c"))


Scheme] (define tt (stree->tree st))
Scheme] (define ht `(math (concat ,tt "+" ,tt)))
You may already have noticed that tree objects are pretty-printed inside
SCHEME sessions:

Scheme] ht
(math (concat <tree <frac|a<rsup|2>|b+c>> "+" <tree
<frac|a<rsup|2>|b+c>>))
Scheme] (tm->tree ht)
a2 a2
+
b+c b+c
The predicates stree?, tree?, and tm? can be used to test whether a given
SCHEME object is a tree of type stree, tree, or tm:

Scheme] (map (lambda (p?) (map p? (list st tt ht)))


(list stree? tree? tm?))
((#t #f #f) (#f #t #f) (#t #t #t))
14.3 EXTENDING THE EDITOR 249

One special TEXMACS tree is the root tree (root-tree). Each open TEXMACS
document is a child of the root tree and vice versa. Arbitrary subtrees of the
root tree are called active trees and each such subtree is aware of its position
inside the root tree. Using dedicated SCHEME routines from the tree API, this
allows us to make changes in documents simply by assigning new values to
active TEXMACS trees. In order to use these routines, one first has to import
them from the appropriate module:

Scheme] (use-modules (utils library tree))

The following routine can then be implemented to clear the buffer being edited:

Scheme] (define (clear-document)


(tree-set (buffer-tree) `(document "")))
Positions within trees are indicated through lists of numbers called paths and
so are cursor positions. For instance, the superscript 2 in the SCHEME tree
(frac (concat "a" (rsup "2")) "b+c") corresponds to the path (0 1
0), whereas the cursor position just behind the + in the denominator corre-
sponds to the path (1 2):

0
frac 1

concat b+c
2
1
a rsup
0
2

The primitives tree-set, tree-ref, and tm-ref can be used for the modifi-
cation and retrieval of subtrees along paths:

Scheme] (tm-ref st 0 1 0)
"2"
Scheme] (tree-set tt 0 1 0 "3")
3
Scheme] (tm->tree `(math ,ht))
a3 a3
+
b+c b+c
Another useful macro for writing editing routines is with-innermost: it looks
for the innermost tree at the current cursor position that matches a certain
predicate, assigns this tree to a local variable, and then runs some code. If the
predicate cannot be matched, then nothing is done. If a tag is provided instead
of a predicate, then we test whether the root of the tree is labeled by that tag.
250 EXTEND BEYOND IMAGINATION

Together with what precedes, we are now in a position to define a routine


that swaps the numerator and the denominator of a fraction, and attach it to
the keyboard shortcut ⌃% :
Scheme] (define (fraction-swap)
(with-innermost t 'frac
(tree-set t `(frac ,(tm-ref t 1)
,(tm-ref t 0)))))
Scheme] (kbd-map ("C-%" (fraction-swap)))

14.3.2 Contextual overloading


For large software projects, it is important that different modules can be devel-
oped as independently as possible. The mechanism of contextual overloading is
of great help here: it allows you to implement a default version of a routine in
a base module, and then customize this implementation in other modules.
In order to get the main idea, consider the implementation of a given function-
ality, like hitting the return key. Depending on the context, different actions
have to be undertaken: by default, we start a new paragraph; inside a table,
we start a new row; etc. A naive implementation would check all possible
cases in a routine kbd-enter and call the appropriate routine. However, this
makes it impossible to add a new case in a new module without modifying the
module that defines kbd-enter. By contrast, the system of contextual over-
loading allows the user to conditionally redefine the routine kbd-enter several
times in distinct modules.
Let us illustrate how this works on a simple example. Assume that we want to
define a function hello that inserts “Hello” by default, but “hello()” in mode
math, while positioning the cursor between the brackets, after the sixth char-
acter. Using contextual overloading, this can be done as follows:

(tm-define (hello)
(insert "Hello"))

(tm-define (hello)
(:mode in-math?)
(insert-go-to "hello()" '(6)))

The keyword :mode specifies that the second declaration only applies in math-
mode, when (in-math?) evaluates to #t. The order in which routines are over-
loaded is important. TEXMACS first tries the latest (re)definition. If this definition
does not satisfy the requirements, then it tries the before-last (re)definition,
and so on until an implementation is found that matches the requirements.
In particular, if we swap the two declarations in the above example, then the
general unconditional definition of hello will always prevail. If the two dec-
larations are made inside different modules, then it is up to the user to ensure
that the modules are loaded in the appropriate order.
14.4 TYPESETTING VIA SCHEME 251

Inside a redefinition, it remains possible to access the former definition using


the keyword former. In particular, the code

(tm-define (hello)
(if (in-math?)
(insert-go-to "hello()" '(6))
(former)))

is equivalent to the second declaration in our example.

Contextual overloading generalizes traditional overloading on types of argu-


ments, as in C++ and various other languages. On the one hand, it becomes
possible to overload on the “context”, such as the cursor being inside a mathe-
matical formula. On the other hand, you may use conditions that do not only
take into account the types of function arguments, but also their values. For
instance, consider a routine my-replace that replaces a tree what by another
tree by in the current document. Then it is easy to add an optimization for the
case when what and by coincide:

(tm-define (my-replace what by)


default-implementation )

(tm-define (my-replace what by)


(:require (== what by))
(noop))

Besides tm-define and tm-define-macro, several other TEXMACS extensions


of SCHEME support the contextual overloading mechanism. For instance, kbd-
map and menu-bind support overloading on mode.

14.4 Typesetting via SCHEME

The TEXMACS stylesheet language is very convenient for the design of simple
and moderately complex macros. Certain macros however may require rewrit-
ings that are easier to program in a full-fledged language like SCHEME. In this
section, we give a few examples of how this can be done.

14.4.1 Hello world!

Let us start with the traditional “hello world” example. Using the TEXMACS
stylesheet language, one may implement a macro hello as follows:

hassignjhellojhmacrojnamejHello name!ii
252 EXTEND BEYOND IMAGINATION

The same effect can be achieved using the following external SCHEME function:

(tm-define (ext-hello t)
(:secure #t)
`(concat "Hello " ,t "!"))

The :secure directive is added in order to indicate that the function can safely
be used from within the stylesheet language: you don't want to destroy your
hard disk merely by opening a TEXMACS document. In order to use the function
ext-hello, we still need to create a TEXMACS macro hello that calls this func-
tion. This is done as follows:

hassignjhellojhmacrojbodyjhexternjext-hellojhquote-argjbodyiiii
hdrd-propsjhellojarityj1jaccessiblejalli

The drd-props command is used in order to specify useful properties of the


hello macro: the macro takes one argument and “all” arguments are “acces-
sible” in the sense that they can be edited from within TEXMACS in the same
way as usual macro arguments.

14.4.2 Integration into the editor


In order to play with the examples in this section, TEXMACS includes a special
SCHEME module that can be found in $TEXMACS_PATH/progs/utils/misc/
extern-demo.scm and a corresponding style package extern-demo. When
selecting the style package using Document „ Style „ Add package „ Example „
extern-demo, the SCHEME module extern-demo.scm is loaded automatically;
this is due to the following instruction at the start of the style package:

huse-modulej(utils misc extern-demo)i

The header of the extern-demo style package also declares a variable extern-
demo-dtd that can be used to conditionally define editing functions for this
style package. First of all, we may introduce a new editing mode for the style
package:

(texmacs-modes
(in-extern-demo% (style-has? "extern-demo-dtd")))

The % suffix is reserved for mode declarations. The above declaration also
defines the corresponding predicate in-extern-demo?. At a second stage, we
may add a keyboard shortcut for the macro hello from the previous subsection:

(kbd-map
(:mode in-extern-demo?)
("H i" (make 'hello)))
14.4 TYPESETTING VIA SCHEME 253

In a similar way, you may create personal style packages and SCHEME modules
in the directories

$TEXMACS_HOME_PATH/packages
$TEXMACS_HOME_PATH/progs
We recall that $TEXMACS_HOME_PATH defaults to the .TeXmacs subdirectory of
your home directory.

14.4.3 Highlighting subexpressions

Let us now consider a more useful example of how to extend the typesetter
with functionality that is written in SCHEME. Assume that we wish to highlight
all occurrences of a subexpression such as x inside a given mathematical for-
mula. This might for instance be handy for laptop presentations.
We start with the SCHEME function ext-highlight that recursively traverses
a given TEXMACS tree t and marks all subtrees that are equal to st:

(tm-define (ext-highlight t st)


(:secure #t)
(cond ((tm-equal? t st) `(marked ,t)) ;; t = st
((tree-atomic? t) t) ;; t =
/ st and t is a leaf
(else
(let* ((m (lambda (u) (ext-highlight u st)))
(l (map m (tree-children t))))
(if (forall? tree? l) t
`(,(tree-label t) ,@l))))))

The condition (forall? tree? l) checks whether all elements in the list l
are TEXMACS trees. It can recursively be verified that our routine returns the
original tree t if and only if no hits were found. This property is important
because it ensures that the highlighted tree remains accessible.
Next we add the following code to the corresponding stylesheet:

hassign j highlight jhmacro j body j sub jhextern j ext-highlight jhquote-arg j bodyij


hquote-argjsubiiii
hdrd-propsjhighlightjarityj2jaccessiblej0i

We consider body as the 0-th argument, so the drd-props command specifies


that body is indeed accessible.
We may now use the routine to mark all variables x inside a formula:
x−y
sin(x) + .
x
254 EXTEND BEYOND IMAGINATION

The implementation of ext-highlight actually contains a problem, since the


x in the numerator x − y did not get highlighted. Do you understand the reason
behind this “bug”?14.1

14.4.4 Circulant matrices


For our last example, we show how to create a macro with arguments x 1, x 2,
x 3, . . . , x n that displays the corresponding circulant matrix

(( xx xx xx ⋅x⋅ ⋅ ⋅x⋅ ))
1 2 3 n

((( ⋅ ⋅ x x x x ⋅ )))
n 1 2 3

(( x ⋅ ⋅ ⋅ x x x ))
n 1 2 3

(( x x ⋅ ⋅ ⋅ x x ))
3 n 1
n
2
2 3 ⋅ 1

The SCHEME code is as follows:

(tm-define ((circulant-row l) i)
(let* ((n (length l))
(h (sublist l (- n i) n))
(t (sublist l 0 (- n i)))
(m (append h t))
(r (map (lambda (x) `(cell ,x)) m)))
`(row ,@r)))

(tm-define (ext-circulant t)
(:secure #t)
(let* ((l (tree-children t))
(n (length l))
(m (map (circulant-row l) (.. 0 n))))
`(matrix (table ,@m))))

The corresponding TEXMACS macro circulant with an arbitrary number of argu-


ments is created using the xmacro primitive:

hassignjcirculantjhxmacrojljhexternjext-circulantjhquote-argjliiii
hdrd-propsjcirculantjarityjhtuplejrepeatj1j1ijaccessiblejalli

When evaluating a circulant matrix such as hcirculant j a j b j ci, we note that


the argument l of xmacro contains hcirculant j a j b j ci itself. The drd-props
command specifies that a circulant matrix has 1 + 1 ⋅ n accessible arguments for
some n ∈ {0, 1, 2, . . . }.

14.1. Answer: this is due to the fact that x is a substring of x + y, but not a subtree. In order to
correct the bug, we would need to add extra cases in the routine ext-highlight that also treat
occurrences of st as a substring of t.
Bibliography

[1] O. Arsac, S. Dalmas, and M. Gaëtano. The design of a customizable component to display
and edit formulas. In ACM Proceedings of the 1999 International Symposium on Symbolic and
Algebraic Computation, July 28–31, pages 283–290. 1999.
[2] B. Beeton, A. Freytag, and M. Sargent III, Unicode support for mathematics, http://
www.unicode.org/reports/tr25/tr25-13.pdf, (2012).
[3] T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, and F. Yergeau, Extensible markup lan-
guage (XML) 1.0 (fifth edition), http://www.w3.org/TR/xml/, (2008).
[4] R. Bringhurst. The Elements of Typographic Style. Harley and Marks, 4 edition, 2012.
[5] The Chicago Manual of Style. University of Chicago Press, 17th edition, 2017.
[6] CollabNet, Subversion, https://subversion.apache.org/, (2001).
[7] B. Collins-Sussman, B. W. Fitzpatrick, and C. M. Pilato. Version control with Subversion.
O'Reilly, 2nd edition, 2009.
[8] J. Cristy et al, ImageMagick, https://imagemagick.org/, (1990).
[9] Dafont, https://www.dafont.com/fr/, (2000).
[10] E. Dahlström, P. Dengler, A. Grasso, C. Lilley, C. McCormack, D. Schepers, and J. Watt, Scal-
able Vector Graphics (SVG) 1.1 (second edition), http://www.w3.org/TR/SVG/, (2011).
[11] R. K. Dybvig. The SCHEME programming language. Mit Press, 2009.
[12] H. Fernandes, Gnu Dr. Geo, http://drgeo.eu/, (1996).
[13] The Document Foundation, LibreOffice, http://www.libreoffice.org, (2013).
[14] H. W. Fowler. A Dictionary of Modern English Usage. Oxford University Press, 1926.
[15] D. P. Friedman and M. Felleisen. The Little Schemer. MIT Press, 1996.
[16] M. Goossens, F. Mittelbach, and A. Samarin. The LaTeX Companion. Addison-Wesley, Reading,
Massachusetts, 1993.
[17] M. Grevisse. Le Bon Usage. De Boeck Supérieur (groupe Albin Michel), 16th edition, 2016.
[18] A. G. Grozin. TeXmacs interfaces to Maxima, MuPAD and Reduce. In V. P. Gerdt, editor,
Proc. Int. Workshop Computer algebra and its application to physics, number 11-2001-279 in JINR
E5, page 149. Dubna, June 2001. Arxiv cs.SC/0107036.
[19] A. G. Grozin, TeXmacs-Maxima interface, Arxiv cs.SC/0506226, (June 2005).
[20] A. G. Grozin. TeXmacs-Reduce interface. CoRR, abs/1204.3020, 2012.
[21] M. Gubinelli, J. van der Hoeven, F. Poulain, and D. Raux. GNU TeXmacs: towards a scientific
office suite. In Mathematical Software - ICMS 2014 - 4th International Congress, Seoul, South
Korea, August 5-9, 2014. Proceedings, pages 562–569. 2014.
[22] Guile reference manual, https://www.gnu.org/software/guile/docs/docs-1.8/
guile-ref/, (2010).
[23] D. Harvey and J. van der Hoeven. Integer multiplication in time O(nlog n). Technical Report,
HAL, 2019. http://hal.archives-ouvertes.fr/hal-02070778.
[24] J. van der Hoeven. GNU TeXmacs: a free, structured, wysiwyg and technical text editor. In
Daniel Filipo, editor, Le document au XXI-ième siècle, volume 39–40, pages 39–50. Metz, 14–17
mai 2001. Actes du congrès GUTenberg.
[25] J. van der Hoeven. GNU TeXmacs User Manual. HAL, 2013. http://hal.archives-
ouvertes.fr/hal-00785535.
[26] J. van der Hoeven. Towards semantic mathematical editing. JSC, 71:1–46, 2015.
[27] J. van der Hoeven. Mathematical font art. In Gert-Martin Greuel, Thorsten Koch, Peter Paule,
and Andrew Sommese, editors, Mathematical Software – ICMS 2016: 5th International Con-
ference, Berlin, Germany, July 11-14, 2016, Proceedings, pages 522–529. Cham, 2016. Springer
International Publishing.
[28] J. van der Hoeven, A. Grozin, M. Gubinelli, G. Lecerf, F. Poulain, and D. Raux. GNU TeX-
macs: a scientific editing platform. ACM Commun. Comput. Algebra, 47(1/2):59–61, 2013.

255
256 BIBLIOGRAPHY

[29] J. van der Hoeven, G. Lecerf, and D. Raux. Preserving syntactic correctness while editing
mathematical formulas. In I. Kotsireas and E. Martínez-Moro, editors, Proc. Applications of
Computer Algebra 2015, volume 198 of Springer Proceedings in Mathematics and Statistics, pages
459–471. Cham, 2015. Springer.
[30] M. Hohenwarter et al, GeoGebra, http://www.geogebra.org, (2001).
[31] R. Huddleston and G. K. Pullum. The Cambridge Grammar of the English Language. Cambridge
University Press, 2002.
[32] B. Jackowski, J. Nowacki, and J. Ludwichowski, The TEX Gyre collection of fonts, http://
www.gust.org.pl/projects/e-foundry/tex-gyre/, (2006).
[33] A. Jaffer, T. Lord, M. Bader et al, GNU Guile, http://gnu.org/software/guile, (1993).
[34] G. Kahana, Hummus, https://pdfhummus.com, (2011).
[35] S. Kimball, P. Mattis et al, Gimp, the GNU Image Manipulation Program, https://
www.gimp.org/, (1996).
[36] D. E. Knuth. The TEXbook, volume A of Computers and Typesetting. Addison-Wesley, 1984.
[37] D. E. Knuth. Computer Modern Typefaces, volume E of Computers and Typesetting. Addison-
Wesley, 1986.
[38] L. Lamport. LaTeX, a document preparation system. Addison Wesley, 1994.
[39] A. Larsson et al, Dia, a drawing program, https://wiki.gnome.org/Apps/Dia, (1998).
[40] A. Lawson. Anatomy of a Typeface. Hamish Hamilton, 1990.
[41] W3C M. Smith, HTML: the markup language (an HTML language reference), http://
www.w3.org/TR/html-markup/, (2012).
[42] Microsoft, Office, https://www.office.com/, (1990).
[43] O. Patashnik. BibTeXing. Documentation for general BibTeX users, 1988.
[44] S. Pinker. The sense of style. Penguin, 2014.
[45] M. Pool et al, GNU Bazaar, http://bazaar.canonical.com/, (2005).
[46] G. K. Pullum. Punctuation and human freedom. Natural Language & Linguistic Theory, pages
419–425, 1984.
[47] Qt, https://www.qt.io/, (1995).
[48] J. Richter-Gebert, H. Crapo, and U. Kortenkamp, Cinderella.2, The Interactive Geometry Soft-
ware, http://cinderella.de, (2013).
[49] D. Roundy et al, Darcs, http://darcs.net/, (2003).
[50] Roy Rosenzweig Center for History and New Media, Zotero, http://www.zotero.org,
(2013).
[51] R. E. Silverman. Git pocket guide. O'Reilly, 2013.
[52] M. Sperber, R. K. Dybvig, M. Flatt, A. Van Straaten, R. Findler, and J. Matthews. Revised 6
report on the algorithmic language Scheme. Journal of Functional Programming, 19(S1):1–301,
2009. http://www.r6rs.org/final/r6rs.pdf.
[53] R. Stallman et al, GNU Emacs, https://www.gnu.org/software/emacs/, (1985).
[54] STI Pub companies, STIX fonts project, http://www.stixfonts.org/, (2010).
[55] W. Strunk, Jr. and E. B. White. The Elements of Style. Macmillan, Third edition, 1979.
[56] G. J. Sussman and Jr. G. L. Steele, Scheme, http://www.schemers.org/, (1975).
[57] The Bibdesk Team, Bibdesk, http://bibdesk.sourceforge.net/, (2002).
[58] The Inkscape Team, Inkscape, http://www.inkscape.org, (2003).
[59] Han Thê Thanh. Micro-typographic extensions to the TEX typesetting system. PhD thesis, Masaryk
University Brno, 2000.
[60] F.-N. Thomas and M. Turner. Clear and Simple as the Truth: Writing Classic Prose. Princeton
University Press, 1996.
[61] Toptal designers, Subtle patterns, https://www.toptal.com/designers/
subtlepatterns/, (2011).
[62] L. Torvalds et al, Git, https://git-scm.com/, (2006).
[63] D. Turner, R. Wilhelm, W. Lemberg et al, Freetype, https://www.freetype.org/, (1996).
[64] Unicode Consortium, Unicode, http://www.unicode.org/, (1991).
[65] Wikimedia Foundation, Wikimedia, https://www.wikimedia.org, (2003).
[66] J. M. Williams. Toward clarity and grace. The University of Chicago Press, 1990.
Index

⇧ . . . . . . . . . . . . . . . . . . . . . 28 article .. .. . . . . . . . . . . . .
225
⌃ . . . . . . . . . . . . . . . . . . . 28, 31 .
artistic table .. . . . . . . . . . . . .
101
⌥ . . . . . . . . . . . . . . . . . . . 28, 31 aspect ratio . .. . . . . . . . . . . . .
168
⌘ . . . . . . . . . . . . . . . . . . . 28, 31 assign . . . . .. . . . . . . . . . . . .
215
⎋ . . . . . . . . . . . . . . . . . . . 29, 33 attach to master . . . . . . . . . . . . .
126
⇥ . . . . . . . . . . . . . . . . 29–30, 68–69 attached . . . . . . . . . . . . . . . . ..
61
↩ . . . . . . . . . . . . . . . . . . . . . 29 author . . . . . . . . . . . . . . . . . .
122
ACM computing class . . . . . . . . . . 50 Author . . . . . . . . . . . . . . . . . ..
48
SCHEME session . . . . . . . . . . . . . 191 axis . . . . . . . . . . . . . . . . . .
98, 162
AMS subject classification . . . . . . . . 50 backslash key \ . . . . . . . . . . .
. . 30
#f . . . . . . . . . . . . . . . . . . 240, 245 baseline . . . . . . . . . . . . . . . .
. . 98
#t . . . . . . . . . . . . . . . . . . . . 240 BASH . . . . . . . . . . . . . . . . .
. 191
$TEXMACS_HOME_PATH . . . . 214, 245, 253 beamer . . . . . . . . . . . . . . . .
. . 64
$TEXMACS_PATH . . . . . . . . . . 214, 240 beamer . . . . . . . . . . . . . . .166, 171
' . . . . . . . . . . . . . . . . . . . . 242 beamer aspect ratio . . . . . . . . .
. . 168
, . . . . . . . . . . . . . . . . . . . . 242 beamer theme . . . . . . . . . . .
. . 167
,@ . . . . . . . . . . . . . . . . . . . . 242 Bezier curve . . . . . . . . . . . .
. . 156
` . . . . . . . . . . . . . . . . . . . . 242 BIBDESK . . . . . . . . . . . . . . .
. . 112
abbreviation . .. . . . . . . . . . . . . 56 bibliographic database . . . . . . .
. . 112
abbrv . . . . . . . . . . . . . . . . . . 114 edit . . . . . . . . . . . . . . .
. . 121
abstract . . . . . . . . . . . . . 50, 227, 234 export entries . . . . . . . . . .
. . 124
accented character . . . . . . . . . . . . 47 import entries . . . . . . . . . .112, 124
accessible . . . . . . . . . . . . . . . . 221 new entries . . . . . . . . . . .
. . 123
acm . . . . . . . . . . . . . . . . . . . 114 search . . . . . . . . . . . . . .
. . 123
acmconf . . . . . . . . . . . . . . . . 139 versioning . . . . . . . . . . .
. . 124
acronym . .. . . . . . . . . . . . . . . 56 bibliography . . . . . . . . . 112, 114, 125
action . .. .. . . . . . . . . . . . . . 106 BibTeX . . . . . . . . . . . . . . . 112, 116
.
active tree .. . . . . . . . . . . . . . 249 big figure . . . . . . . . . . . . . . . . 110
acute . . . .. . . . . . . . . . . . . . . 47 big operator . . . . . . . . . . . . . . . . 76
Add . . . . .. . . . . . . . . . . . . . 201 big table . . . . . . . . . . . . . . . . 90, 110
address . . .. . . . . . . . . . . . . . . 48 black . . . . . . . . . . . . . . . . . . . 60
affiliation . .. . . . . . . . . . . . . . . 48 blackboard bold letter . . . . . . . . . . 68
aligned-item . . . . . . . . . . . . 227, 239 blackboard embold . . . . . . . . . . . 147
alignment . . . . . . . . . . . . . . . . . 53 block . . . . . . . . . . . . . . . . . . . 89
alpha . . . . . . . . . . . . . . . . . . 114 block content . . . . . . . . . . . . . . . 97
alt key ⌥ . . . . . . . . . . . . . . . 28, 31 block markup . . . . . . . . . . . . . 51, 56
ancient . . . . . . . . . . . . . . . . . . 61 block tag . . . . . . . . . . . . . . 210, 217
and . . . . . . . . . . . . . . . . . . . 245 Block . . . . . . . . . . . . . . . . . . 189
animation . . . . . . . . . . . . . . . . 173 blur . . . . . . . . . . . . . . . . . . . 149
appear . . . . . . . . . . . . . . . . . 173 bold . . . . . . . . . . . . . . . . . . 60, 147
appendix . . . . . . . . . . . . . . . . . 51 bold letter . . . . . . . . . . . . . . . . . 68
arc . . . . . . . . . . . . . . . . . . . . 156 border . . . . . . . . . . . . . . . . . . . 94
arg . . . . . . . . . . . . . . . . . . . 216 BOURBAKI . . . . . . . . . . . . . . . . . 20
arrow . . . . . . . . . . . . . . . . . 69, 81 bracket . . . . . . . . . . . . . . . . . . 77
arrow with text . . . . . . . . . . . . . 158 breve . . . . . . . . . . . . . . . . . . . 47
art pen . . . . . . . . . . . . . . . . . . 61 buffer . . . . . . . . . . . . . . . . . . . 37

257
258 INDEX

bump . . . . . . . . . . . . . . . . .. 175 control point . . . . . . . . . . . . .154.


C++ . . . . . . . . . . . . . . . . . 240, 251 copy . . . . . . . . . . . . . . . . . .163.
calligraphic . . . . . . . . . . . . . . . . 61 counter . . . . . . . . . . . . . . . . 52. .
calligraphic letter . . . . . . . . . . . . . 68 crop . . . . . . . . . . . . . . . . . .151.
caption . . . . . . . . . . . . . . . . . 110 image . . . . . . . . . . . . . . . 82. .
car . . . . . . . . . . . . . . . . . . . 242 CSS . . . . . . . . . . . . . . . . . .230.
case . . .. . .. . . . . . . . . . . . . . 60 current editing mode . . . . . . . . . 26. .
case . . . . . . . . . . . . . . . . . . . 220 current focus . . . . . . . . . 20, 26, 37, 183
cc . . . . . . . . . . . . . . . . . . . . . 62 cursor path . . . . . . . . . . . . . . . 249
cdr . . . . . . . . . . . . . . . . . . . 242 curve intersections . . . . . . . . . . . 164
cedilla . . . . . . . . . . . . . . . . . . . 47 curve points . . . . . . . . . . . . . . 164
cell cwith . . . . . . . . . . . . . . . . . . 218
alignment . . . . . . . . . . . . . . .
95 DARCS . . . .. . . . . . . . . . . . . 187
border . . . . . . . . . . . . . . . . .
94 dash . . . . . .. . . . . . . . . . . . . . 44
color . . . . . . . . . . . . . . . . . 101 dash pattern .. . . . . . . . . . . . . 160
height . . . . . . . . . . . . . . . .
. 93 dash style . . .. . . . . . . . . . . . . 160
line wrapping . . . . . . . . . . . .
. 96 unit . . . .. . . . . . . . . . . . . 160
operation mode . . . . . . . . . . .
. 92 Data
padding . . . . . . . . . . . . . . .
. 95 Confirm entry . . . . . . . . . .
123 ..
range . . . . . . . . . . . . . . . . 200 Export . . . . . . . . . . . . . .
124 ..
width . . . . . . . . . . . . . . . .
. 93 Export selected entries . . . . .
124 ..
centered . . . . . . . . . . . . . . . . 53, 61 Import . . . . . . . . . . . . . .
112, 124
chalk . . . . . . . . . . . . . . . . . . . 61 Import entries in buffer . . . . .
. . 124
chapter . . . . . . . . . . . . . . . . 50, 234 Import selected entries . . . . .
. . 124
check . . . . . . . . . . . . . . . . . . . 47 New entry . . . . . . . . . . . .
. . 123
choice list . . . . . . . . . . . . . . . . . 80 Open bibliography . . 112, 121, 123–124
CINDERELLA . . . . . . . . . . . . . . 165 Preferences . . . . . . . . . . . . . 124
circle . . . . . . . . . . . . . . . . . . 156 Remove entry . . . . . . . . . . . . 124
citation . . . . . . . . . . . . . . . . . 113 Storage . . . . . . . . . . . . . . . 124
cite . . . . . . . . . . . . . . . . . . . 113 database tool . . . . . . . . . . . . . . 112
clip . . . . . . . . . . . . . . . . . . . 144 database toolbar . . . . . . . . . . . . 123
clipped . . . . . . . . . . . . . . . . . 187 date . . . . . . . . . . . . . . . . . . . . 48
Cluster by affiliation . . . . . . . . . . . 50 dd . . . . . . . . . . . . . . . . . . . . . 62
cm . . . . . . . . . . . . . . . . . . . . . 62 Debug
color . . . . . . . . . . . . . . . . . . 159 keyboard .. . . . . . . . . . . . . 167
column . . . . . . . . . . . . . . . . . 139 decorations . .. . . . . . . . . . . . . 171
comic . . . . . . . . . . . . . . . . . . . 61 decorative . .. . . . . . . . . . . . . . 61
comma . . . . . . . . . . . . . . . . 71, 86 define . . . . . . . . . . . . . . . . . 243
commutative diagram . . . . . . . . . . 81 define-macro . . . . . . . . . . . . . 244
compact . . . . . . . . . . . . . . . . . . 63 degrade . . . . . . . . . . . . . . . . . 150
compact-item . . . . . . . . . . . . . 239 degraded . . . . . . . . . . . . . . . . 148
comparing versions . . . . . . . . . . 188 deleted . . . . . . . . . . . . . . . . . . 56
compound . . . . . . . . . . . . . 216, 221 description . . . . . . . . . . . . . . 55, 238
compressed . . . . . . . . . . . . . . . 169 Detailed . . . . . . . . . . . . . . . . . 189
computer algebra session . . . . . . . 191 determinant . . . . . . . . . . . . . . . 80
concat . . . . . . . . . . . . . . . . . 217 DIA . . . . . . . . . . . . . . . . . . . 151
cond . . . . . . . . . . . . . . . . . . 244 dialogue window . . . . . . . . . . . . . 35
condensed . . . . . . . . . . . . . . 60, 147 differences . . . . . . . . . . . . . . . 188
connected document . . . . . . . . . . 104 digital . . . . . . . . . . . . . . . . . . . 61
content tag . . . . . . . . . . . . . . . . 56 dilate . . . . . . . . . . . . . . . . . . 144
context . . . . . . . . . . . . . . . . . . 25 display* . . . . . . . . . . . . . . . . 245
contextual help . . . . . . . . . . . . 39–40 displayed formula . . . . . . . . . . . . 66
contextual overloading . . . . . . . . . 250 dissociate cells . . . . . . . . . . . . . 100
control frame . . . . . . . . . . . . . . 176 distort . . . . . . . . . . . . . . . . . . 150
control key ⌃ . . . . . . . . . . . . . 28, 31 distorted . . . . . . . . . . . . . . . . 148
INDEX 259

doc-author-block . . . . . . . . . . .
234 Document
doc-render-title . . . . . . . . . . . .
228 Source
doc-title-block . . . . . . . . . . . . .
228 Edit source tree . . . . . . . 207, 211
document . . . . . . . . . . . . . . .
217 Preferences . . . . . . . . . 208, 218
document abstract . . . . . . . . .227, 234 Source tree . . . . . . . . . . . 208
document bibliography . . . . . .
. . 125 Style . . . . . . . . . . . . . . . . 47, 214
document in project . . . . . . . .
. . 125 Add package
document metadata . . . . . . . .
. . . 50 Add other package . .. . . 214
document style . . . . . . . . . . 15, 39, 47 Example
document title . . . . . . . . . 48, 227, 233 extern-demo . . . . . . 252
document update . . . . . . . . . . . . 104 Article . . . . . . . . . . . . . 15, 48
Document . . . . . . . . . . . . . . . 35, 39 article . . . . . . . . . . . . . . . 48
Bibliography . . . . . . . . . . . . . 125 Springer
Colors llncs . . . . . . . . . . . . 15
Foreground . . . . . . . . . . . 214 svjour . . . . . . . . . . 225
Font . . . . . . . . . . . . . . . . . . 58 Beamer . . . . . . . . . . . . . . 15
Informative flags beamer . . . . . . . . . . . . . . 48
Detailed . . . . . . . . . . . . 70, 105 book . . . . . . . . . . . . . . . . 48
Language . . . . . . . . . . . . . 46, 132 Book . . . . . . . . . . . . . . . . 48
Metadata . . . . . . . . . . . . . . . 50 Edit style . . . . . . . . . . . . . 225
Page . . . . . . . . . . . . . . . . . . 64 Education
Breaking exam . . . . . . . . .. . .. 48
Page breaking algorithm letter . . . . . . . . . . . .. . .. 48
professional . . . . . . . 135 Update . . . . . . . . . . . . .. . . 104
sloppy . . . . . . . . . . 135 All . . . . . . . . . . . 104, 108, 110
Format List of figures . . . . . . . . . . 110
Orientation . . . . . . . . . . 64 Table of contents . . . . . . . . 108
Page rendering . . . . . . . . 64 documentation . . . . . . . . . . . . 39–40
beamer . . . . . . . . . . 64 dot . . . . . . . . . . . . . . . . . . 71, 86
paper . . . . 64, 104, 108, 126 dots . . . . . . . . . . . . . . . . . . 71, 146
papyrus . . . . . . . . 64, 126 DR. GEO . . . . . . . . . . . . . . . . . 165
screen . . . . . . . . . . . 64 DRATEX . . . . . . . . . . . . . . . . . 197
Page type . . . . . . . . . . . 64 draw over . . . . . . . . . . . . . . . . 151
Headers . . . . . . . . . . . . . . 65 drawing . . . . . . . . . . . . . . . 106, 151
Margins . . . . . . . . . . . . 65, 138 drd-props . . . . . . . . . . . . . . . . 222
Same screen margins as on paper Due to . . . . . . . . . . . . . . . . . . . 52
.. . .. . .. . .. . .. . .. 64 Dynamic
Page rendering Next . . . . . . . . . . . . . . . . . 179
paper . . . . . . . . . . . . 136 Edit . . . . . . . . . . . . . . . . . . 26, 34
Paragraph . . . . . . . . . . . . . . . 61 Copy . . . . . . . . . . . . . 91, 163, 180
Advanced Copy to . . . . . . . . . . . . . . . 180
Extra interline space . . . . . 142 BibTeX . . . . . . . . . . . . 122, 124
Minimal line separation . . . 143 Correct
Column separation . . . . . . . 139 Correct all . . . . . . . . . . . ..
85
First indentation . . . . . . . . . 142 Correct manually . . . . . . . ..
85
Interline space . . . . . . . . . . 142 Cut . . . . . . . . . . . . . . . . .
180
Interparagraph space . . . . . . 142 Cut to . . . . . . . . . . . . . . . .
180
Line breaking . . . . . . . . . . 131 Paste . . . . . . . . . . . . 91, 163, 180
normal . . . . . . . . . . . . 131 Paste from . . . . . . . . . . . . . . 180
professional . . . . . . . . . 131 BibTeX . . . . . . . . . . . . . . 122
Number of columns . . . . . . . 139 LaTeX . . . . . . . . . . . . . . 180
Part Preferences . . . . . . . . . . . . . . 36
Show preamble . . . . . . . . . 213 Convert
Scripts . . . . . . . . . . . . 30, 198–199 BibTeX . . . . . .. . .. . . 122
Maxima . . . . . . . . . . . . . 197 Pdf . . . . . . . .. . .. . .. 14
260 INDEX

Edit enumeration . . . . . . . . . . . . . 55, 238


Preferences enunciation . . . . . . . . . . . 52, 227, 236
Convert environment . . . . . . . . . . . . . . . 51
Pdf variable . . . . . . . . . . . . . . 39, 214
Expand beamer slides . . 179 epilogue . . . . . . . . . . . . . . . . . 51
General . . . . . . . . 14, 31, 33, 36 equation array . . . . . . . . . . . . . . 66
Buffer management . . . . . . 37 erode . . . . . . . . . . . . . . . . . . 149
Complex actions escape key ⎋ . . . . . . . . . . . . . 29, 33
Through the menus . . . . 36 EUKLEIDES . . . . . . . . . . . . . . . 197
Complex editing actions . . . 37 eval . . . . . . . . . . . . . . . . . . . 220
Details in menus . . . . . . . . 37 ex . . . . . . . . . . . . . . . . . . . . . 62
Interactive questions . . . . . 37 EXCEL . . . . . . . . . . . . . . . . 199–200
Language . . . . . . . . . . . 46 executable input field . . . . . . . . . 198
Look and feel . . . . . . . . . 36 executable switch . . . . . . . . . . . . 197
Emacs . . . . . . . . . . . 37 exercise . . . . . . . . . . . . . . . . 52, 236
User interface language . . . . 37 extend . . . . . . . . . . . . . . . . 143, 187
Keyboard extended . . . . . . . . . . . . . . . . 147
Automatic brackets extension language . . . . . . . 22, 191, 240
Disabled . . . . . . . . . . 77 extern-demo . . . . . . . . . . . . . . 252
Automatic quotes . . . . . . . 44 fade in . . . . . . . . . . . . . . . 173, 178
Remote control . . . . . . . 166 fade out . . . . . . . . . . . . . . . 173, 178
Mathematics family . . . . . . . . . . . . . . . . . . . 60
Automatic correction . . . . . 85 FAQ . . . . . . . . . . . . . . . . . . . . 41
Manual correction . . . . . . . 85 FEYNMF . . . . . . . . . . . . . . . . . 197
Semantic editing . . . . . . . . 83 field reference . . . . . . . . . . . . . 198
Other File . . . . . . . . . . . . . . . . . . 26, 34
Security . . . . . . . . . . . 106 New . . . . . . . . . . . . . . . . 14, 34
Space bar in math mode Save. . . . . . . . . . . . . . . . . 123
Allow spurious spaces . . . . . 70 fill color . . . . . . . . . . . . . . . . . 159
Space bar in text mode first indentation . . . . . . . . . . . . . 61
Allow multiple spaces . . . . . 44 floating
No multiple spaces . . . . . . 44 algorithm . . . . . .138. . . . . . . .
Utilities figure . . . . . . . .138. . . . . . . .
Versioning tool . . . . . . . 187 object . . . . . . . .138. . . . . . . .
Redo . . . . . . . . . . . . . . . . . 183 table . . . . . . . . .138. . . . . . . .
Replace . . . . . . . . . . . . . . . 181 fn . . . . . . . . . . . .
62, 141–142 . . . .
Search . . . . . . . . . . . . . . . . 181 fns . . . . . . . . . . .
. . . . 142 . . . .
Spell . . . . . . . . . . . . . . . . . 182 focus tag . . . . . . . .
. . . . . 38 . . . .
Undo . . . . . . . . . . . . . . . . 183 focus toolbar . . . . . .
. . . 27, 38 . . . .
editor . . . . . . . . . . . . . . . .
122 . . Focus . . . . . . . .
17, 20, 26–27, 35, 38, 48
electronic component . . . . . . .
159 . . A.C.M. computing class . . . . . . . . 50
ellipses . . . . . . . . . . . . . . .
71 . . . A.M.S. subject class . . . . . . . . . . 50
elsart-num .. . . . . . . . . . .
114 . . Above . . . . . . . . . . . . . . . . . 54
em . . . . . . . . . . . . . . . . . .
141 . . Allowed positions . . . . . . . . . . 139
em dash . . . . . . . . . . . . . . .
44 . . . Author . . . . . . . . . . . . . . . . . 48
EMACS . . . . . . . . . 12, 22–23, 31, 33, 37 Affiliation . . . . . . . . . . . . . 48
EMACS-LISP . . . . . . . . . . . . . . . . 22 Email . . . . . . . . . . . . . . . 48
email . . . . . . . . . . . . . . . . . . . 48 Homepage . . . . . . . . . . . . . 48
embold . . . . . . . . . . . . . . . . . 147 Beamer
emboss . . . . . . . . . . . . . . . . . 150 Paper . . . . . . . . . . . . . . 168
emphasize . . . . . . . . . . . . . . . . 56 Beamer theme . . . . . . . . . . . . 167
animated . . . . . . . . . . . . . . 175 Below . . . . . . . . . . . . . . . . . 54
en dash . . . . . . . . . . . . . . . . . . 44 Cell . . . . . . . . . . . . . . . . . . 92
engrave . . . . . . . . . . . . . . . . . 150 Block content . . . . . . . . . . . 97
enter key ↩ . . . . . . . . . . . . . . . . 29 Border . . . . . . . . . . . . . . . 94
INDEX 261

Focus Focus
Cell Input mode
Dissociate joined cells . . .. . . 100 Multiline input . . . . . . . . . . 193
Height Input options
Adjust limits . . . . . .. . .. 94 Mathematical input . . . . . . . 194
Ajust limits Insert above . . . . . . . . . . . . . 121
None . . . . . . . . . . . 101 Insert argument after . . 38, 50, 113, 168
Horizontal alignment . . . . . . . 95 Insert argument before . . . . . . 38, 168
Join selected cells . . . . . . . . 100 Insert below . . . . . . . . . . . . . 121
Line wrapping . . . . . . . . . . . 96 Insert subtable . . . . . . . . . . . 101
Top . . . . . . . . . . . . . . 89 Interrupt execution . . . . . . . . . 192
Operation mode . . . . . . . . . . 92 Keywords . . . . . . . . . . . . . . . 50
Column . . . . . . . . . . . . 92 Last similar . . . . . . . . . . . . . . 38
Columns . . . . . . . . . . . . 96 Length . . . . . . . . . . . . . . . . 141
Entire table . . . . . . . . . . 92 Line arrows . . . . . . . . . . . . . 161
Row . . . . . . . . . . . . . . 92 Line dashes . . . . . . . . . . . . 82, 160
Padding . . . . . . . . . . . . . . 95 Unit . . . . . . . . . . . . . . . 160
Vertical alignment . . . . . . . . . 95 Other . . . . . . . . . . . . 161
Width . . . . . . . . . . . . . . . 93 Make floating . . . . . . . . . . . . 138
Stretch factor . . . . . . . . . 93 Marginal note sep . . . . . . . . . . 138
Close session . . . . . . . . . . . . 192 Miscellaneous . . . . . . . . . . . . . 48
Next similar . . . . . . . . . . . . 20, 38
Color
Other . . . . . . . . . . . . . . 159
Note . . . . . . . . . . . . . . . . . . 48
Palette . . . . . . . . . . . . . . 159
Numbered . . . . . . . . . . . 52, 55, 66
Date . . . . . . . . . . . . . . . . .. 48
Output options
Delete . . . . . . . . . . . . . . . .. 38
Show timings . . . . . . . . . . 194
Describe . . . . . . . . . . . . 20, 39–40
Overlay mode . . . . . . . . . . . . 172
Draw . . . . . . . . . . . . . . . . . 172
Paper . . . . . . . . . . . . . . . . . 40
Draw over
Papyrus . . . . . . . . . . . . . . . . 40
Draw under . . . . . . . . . . . 153
Preferences . . 26, 38–39, 53, 55, 137, 167
Due to . . . . . . . . . . . . . . . .. 52
Compact Lists . . . . . . . . . . . 55
Duration . . . . . . . . . . . . . . . 173
Degraded threshold
Effect pen . . . . . . . . . . . . . . 149
Other . . . . . . . . . . . . 148
Gaussian . . . . . . . . . . . . . 149
Edit macro . . . . . . 18, 39, 202, 204
Motion . . . . . . . . . . . . . . 149
Edit source . . . . . . . . . . 18, 39
Oval . . . . . . . . . . . . . . . 149
Rectangular . . . . . . . . . . . 149 European numbering style . . 26, 52
End x . . . . . . . . . . . . . . . . 174 Footnote sep . . . . . . . . . . 137
End y . . . . . . . . . . . . . . . . 174 Framed input fields . . . . . . . 194
Enter graphics . . . . . . . . . . . . 153 Framed titles . . . . . . . . . . 167
Evaluate Hanging theorems . . . . . . . 167
Evaluate above . . . . . . . . . 192 Highlight incorrect formulas . . . 85
Evaluate all . . . . . . . . . . . 192 Large padding above . . . . . . 206
Evaluate below . . . . . . . . . 192 Large padding below . . . . . . 206
Exit graphics . . . . . . . . . . . . 153 Locus color . . . . . . . . . . . 106
Exit left . . . . . . . . . . . . . . . . 38 Marginal note width . . . . . . . 138
Exit right . . . . . . . . . . . . . . . 38 Padding above . . . . . . . . . 54, 142
First similar . . . . . . . . . . . . . . 38 Padding below . . . . . . . . . 54, 142
Go to anchor . . . . . . . . . . . . 139 Page float sep . . . . . . . . . . 139
Help . . . . . . . . . . . . . . . . . . 40 Page fnote barlen . . . . . . . . 137
Horizontal alignment Page fnote sep . . . . . . . . . 137
Left . . . . . . . . . . . .. . . 138 Paragraph display numbers . . . . 51
Right . . . . . . . . . . . .. . . 138 Prefix by section number . . . . . 52
Input mode Ring binder notebook style . . . 194
Mathematical input . . . .. . . 194 Style parameters . . . . . . . . 148
262 INDEX

Focus Focus
Preferences Table
Visited color . . . . . . . . . . . 106 Size
Previous similar . . . . . . . . . . 20, 38 Set number of rows .. . . 90, 97
Remove argument after . . . . . . . . 38 Special
Remove argument before . . . . . . . 38 Table breaking . . . . . . . . 99
Rename . . . . . . . . . . . . . . . 111 Vertical alignment . . . . . . . 98–99
Resize . . . . . . . . . . . . . . . 90–91 Bottom . . . . . . . . . . . . . 98
Running author . . . . . . . . . . . . 48 Bottom baseline . . . . . . . . 99
Running title . . . . . . . . . . . . . 48 Middle . . . . . . . . . . . . . 98
Search in database . . . . . . . . . 113 Middle baseline . . . . . . . . 99
Search . . . . . . . . . . . . . . 113 Specific baseline . . . . . . . . 99
Session Top . . . . . . . . . . . . . . 98
Clear all fields . . . . . . . . . .193 Top baseline . . . . . . . . . . 99
Create subsession . . . . . . . .193 Width . . . . . . . . . . . . . . . 97
Fold all fields . . . . . . . . . .193 Paragraph . . . . . . . . . . . 97
Split session . . . . . . . . . . .193 Theorem . . . . . . . . . . . . . . . 186
Unfold all fields . . . . . . . . .193 Time evolution . . . . . . . . . . . 175
Set file name . . . . . . . . . . . .114 Reverse . . . . . . . . . . . . . 175
Set length . . . . . . . . . . . . . .141 Title . . . . . . . . . . . . . . . . . 172
Set width . . . . . . . . . . . . . .107 Today . . . . . . . . . . . . . . . . . 48
Set x-offset . . . . . . . . . . . . .107 Vertical alignment
Set y-offset . . . . . . . . . . . . .107 Bottom . . . . . . . . . . . . .
138
Show hidden . . . . . . . . . . . . .
39 Center . . . . . . . . . . . . . .
138
Snap . . . . . . . . . . . . . . . . .164 Top . . . . . . . . . . . . . . .
138
All . . . . . . . . . . . . . . . .164 foldable . . . . . . . . . . . . . . . . .
193
Curve intersections . . . . . . .164 folded . . . . . . . . . . . . . . . . . .
169
Curve points . . . . . . . . . . .164 font . . . . . . . . . . . . . . . . . .
57, 226
Grid lines . . . . . . . . . . . .164 case . . . . . . . . . . . . . . . .
. . 60
Grid points . . . . . . . . . . .164 category . . . . . . . . . . . . . .
. . 61
Grid-curve intersections . . . .164 collection . . . . . . . . . . . . .
. . 58
None . . . . . . . . . . . . . . .164 database . . . . . . . . . . . . .
. . 58
Snap distance . . . . . . . . . .165 device . . . . . . . . . . . . . . .
. . 61
Text borders . . . . . . . . . . .165 effects . . . . . . . . . . . . . . .
. 147
Text corners . . . . . . . . . . .164 family . . . . . . . . . . . . . . .
. . 60
Text padding . . . . . . . . . .165 management . . . . . . . . . . .
. . 57
Start x . . . . . . . . . . . . . . . .174 selection . . . . . . . . . . . . . .
. . 58
Start y . . . . . . . . . . . . . . . .174 serif . . . . . . . . . . . . . . . .
. . 60
Status . . . . . . . . . . . . . . . .177 shape . . . . . . . . . . . . . . .
. . 60
Animated . . . . . . . . . . . .178 size . . . . . . . . . . . . . . . .
. . 60
Fade in . . . . . . . . . . . . .178 slant . . . . . . . . . . . . . . . .
. . 60
Fade out . . . . . . . . . . . . .178 spacing . . . . . . . . . . . . . .
. . 61
Ink in . . . . . . . . . . . . 177–178 stretch . . . . . . . . . . . . . . .
. . 60
Ink out . . . . . . . . . . . . . . 178 weight . . . . . . . . . . . . . .
. . 60
Style . . . . . . . . . . . . . . . . . 114 footer . . . . . . . . . . . . . . . . .
65, 226
Superscript footnote . . . . . . . . . . . . . . . .
. 137
Subscript . . . . . . . . . . . . . 20 for-each . . .. . . . . . . . . . . .
. 220
Table . . . . . . . . . . . . . . . . . 97 Format . . . .. . . . . . . . . . . .
. . 35
Border . . . . . . . . . . . . . . . 98 Adjust . . .. . . . . . . . . 78, 143, 187
Height . . . . . . . . . . . . . . . 97 Clip . .. . . . . . . . . . . . . 144
Horizontal alignment . . . . . . . 98 Extend .. . . . . . . . . . . . . 143
Padding . . . . . . . . . . . . . . 98 Inflate .. . . . . . . . . . . . . 143
Size . . . . . . . . . . . . . . . . 97 Move . .. . . . . . . . . . . . . 143
Minimal number of rows . . 102 Reduce . . . . . . . . . . . . 78, 143
Set number of columns . . 90, 97 Resize .. . . . . . . . . . . 143–144
INDEX 263

Format Format
Adjust Page
Shift . . . . . . . . . . . .. . . 143 This page header . . . . . . . . . 65
Smash . . . . . . . . . . .. . . 143 This page number . . . . . . . . . 65
Break Paragraph . . . . . . . . . 36, 61–63, 139
Group Advanced . . . . . . . . . . . . . 63
Horizontal . . . . . . . . . 45, 133 Character contraction . . . . 135
Vertical . . . . . . . . . . . 136 Character expansion . . . . 135
Line break . . . . . . . . . . 132–133 Intercharacter stretching . . 133
New line . . . . . . . . . . . 132–133 Use margin kerning . . . . . 135
No line break . . . . . . . . . . 132 Alignment
Page break after Column separation . . . . . . 63
New page . . . . . . .. . . 136 Interline space . . . . . . . . . 62
No page break . . . . .. . . 136 Justified . . . . . . . . . . . . 61
Page break before Number of columns . . . . . . 63
New double page . . . . . . 136 Basic
No page break . . . . . . . . 136 Alignment . . . . . . . . . 36, 61
Cell . . . . . . . . . . . . . . . . 92, 95 Centered . . . . . . . . . . 61
Alignment . . . . . . . . . . . . . 95 Justified . . . . . . . . . . 61
Block content . . . . . . . . . . . 97 justify . . . . . . . . . . . 36
Border . . . . . . . . . . . . . . . 94 Left . . . . . . . . . . . . 61
Line wrapping . . . . . . . . . . . 96 Left margin . . . . . . . . 62
Padding . . . . . . . . . . . . . . 95 Right . . . . . . . . . . . . 61
Text height correction . . . . . . . 94 Right margin . . . . . . . . 62
Width . . . . . . . . . . . . . . . 93 First indentation . . . . . . 61–62
Stretch . . . . . . . . . . . . . 93 Interparagraph space . . . . . 61
Color . . . . . . . . . . . . . . . . 101 Number of columns . . . . . . . 139
Display style Space . . . . . . . . . . . . . . 186–187
on . . . . . . . . . . . . . . . .. 66 Special
Font . . . . . . . . . . . . . . . . 58, 101 Decorate atoms . . . . . . . . . 146
Family . . . . . . . . . . . . . 58–59 Phantom . . . . . . . . . . . . . 144
Ok . . . . . . . . . . . . . . . . . 59 Repeat object . . . . . . . . . . 146
Sample text . . . . . . . . . . . . 59 Specific . . . . . . . . . . . . . . . 145
Size . . . . . . . . . . . . . . . . 58 Even pages . . . . . . . . . . . 146
Standard . . . . . . . . . . . . . . 59 Html . . . . . . . . . . . . . . . 145
Style . . . . . . . . . . . . . . 58–59 Image . . . . . . . . . . . . . . 145
Font effects . . . . . . . . . . . . . 147 LaTeX . . . . . . . . . . . . . . 145
Condensed . . . . . . . . . . . 135 Odd pages . . . . . . . . . . . . 146
Degraded . . . . . . . . . . . . 148 Printer . . . . . . . . . . . . . . 145
Distorted . . . . . . . . . . . . 148 Screen . . . . . . . . . . . . . . 145
Embold . . . . . . . . . . . . . 177 TeXmacs . . . . . . . . . . . . . 145
Extended . . . . . . . . . . . . 135 Table . . . . . . . . . . . . . . . . . 97
Gnawed . . . . . . . . . . . . . 148 Alignment . . . . . . . . . . . . . 98
Magnify horizontally . . . . . . 135 Border . . . . . . . . . . . . . . . 98
Slanted . . . . . . . . . . . . . 176 Height . . . . . . . . . . . . . . . 97
Graphical effects . . . . . . . . . . 149 Large tables
Blur . . . . . . . . . . . . . . . 149 Enable page breaking . . . . . 99
Erode . . . . . . . . . . . . . . 149 Padding . . . . . . . . . . . . . . 98
Outline . . . . . . . . . . . . . 149 Width . . . . . . . . . . . . . . . 97
Thicken . . . . . . . . . . . . . 149 Transform . . . . . . . . . . . . . . 144
Hyphenate as . . . . . . . . . . . 46, 132 Dilate . . . . . . . . . . . . . . 144
Line break . . . . . . . . . . . . . . . 45 Rotate . . . . . . . . . . . . . . 144
Page . . . . . . . . . . . . . . . . . . 64 Skew . . . . . . . . . . . . . . . 144
Page number rendering . . . . . . 65 Whitespace . . . . . . . . . . . . . 140
This page footer . . . . . . . . . . 65 Horizontal space . . . . . . . 70, 141
264 INDEX

Format hat . . .. . . . . . . . . . . . . . . . . 47
Whitespace head . . .. . . . . . . . . . . . . . . . 241
Horizontal space header .. . . . . . . . . . . . . . . 65, 226
Custom tab . . . . . . . . .
141 help . . .. . . . . . . . . . . . . . . 39–40
Stretchable . . . . . . . . .
140 Help . . . . . . . . . . . . . . . . . . 35, 40
Tab . . . . . . . . . . . . .
141 About . . . . . . . . . . . . . . . . . 41
Rigid . . . . . . . . . . . . . . . .
43 Full manuals . . . . . . . . . . . . . . 41
Rigid box . . . . . . . . . .141–142 Compile article . . . . . . . . . . 41
Tab . . . . . . . . . . . . .
. . 146 Compile book . . . . . . . . . . . 41
Vertical space after . . . . .
. . 141 Future plans . . . . . . . . . . . . . . 41
Vertical space before . . . .
. . 141 Help us . . . . . . . . . . . . . . . . 41
former . . . . . . . . . . . . . . .247, 251 Interfacing . . . . . . . . . . . . . 23, 41
formula breaking . . . . . . . . . .
. . 194 Manual . . . . . . . . . . . . . . . . 40
fraction . . . . . .. . . . . . . . .
. . . 75 Browse . . . . . . . . . . . . . . . 41
Fraktur letter . . .. . . . . . . . .
. . . 69 Plug-ins . . . . . . . . . . . . . . 41, 191
frame . . . . . . . . . . . . . . . .
. . . 54 Reference guide . . . . . . . . . . 41, 215
framed input fields . . . . . . . . .
. . 194 Scheme extensions . . . . . . . . 41, 240
function application. . . . . . . .
. 70, 86 Search
Gaussian pen . . ... . . . . . . .
. . 149 Documentation . . . . . . . . 26, 40
generic . . . . . . . . . . . . . .
. . . 65 hidden . . . . . . . . . . . . . . . . . 171
GEOGEBRA . . . . . . . . . . . . .
. . 165 hidden argument . . . . . . . . . . . . . 39
geometric construction . . . . . . .
. . 165 history . . . . . . . . . . . . . . . . . 190
homepage . . . . . . . . . . . . . . . . . 48
GHOSTSCRIPT . . . . . . . . . . . .
. . 108
homoglyph . . . . . . . . . . . . . . 67, 86
GIMP . . . . . . . . . . . . . . . .
. . 151
GIT . . . . . . . . . . . . . . . 22, 124, 187
Homoglyph substitutions . . . . . . . . . 85
horizontal
glossary . . . . . . . . . . . . . . . . . 110
alignment . . . . . . .. . .. . .. . 95
entry . . . . . . . . . . . . . . . . 110
group . . . . . . . . .. . .. . .. 133
glyph contraction . . . . . . . . . . . . 134
whitespace . . . . . .. . .. . .. 140
glyph expansion . . . . . . . . . . . . 134 HTML . . . . . . . . . . 20, 22, 51, 106, 145
gnaw . . . . . . . . . . . . . . . . . . 150 hybrid command . . . . . . . . . . . . . 30
gnawed . . . . . . . . . . . . . . . . . 148 hybrid tree . . . . . . . . . . . . . . . 248
GNU BAZAAR . . . . . . . . . . . . . 187 hyperlink . . . . . . . . . . . . . . . . 106
Go .. . .. . .. . . . . . . . . . . . 26, 35 hyphen . . . . . . . . . . . . . . . . . . 44
Back . .
. .. . . . . . . . . . . . . . 35 non-breaking . . . . . . . . . . . . 132
Forward. .. . . . . . . . . . . . . . 35 hyphenation . . . . . . . . . . . . . 46, 131
grain control . . . . . . . . . . . . . . 189 ieeetr . . . . . . . . . . . . . . . . . 114
graphical animation . . . . . . . . . . 177 if . . . . . . . . . . . . . . . . . . . . 220
graphical effect . . . . . . . . . . . . . 149 if . . . . . . . . . . . . . . . . . . 244, 247
graphical screen . . . . . . . . . . . . 172 ifac . . . . . . . . . . . . . . . . . . 139
graphical-macros . . . . . . . . . . 158 image . . . . . . . . . . . . . . . . . . 106
graphics mode . . . . . . . . . . . . . 151 IMAGEMAGICK . . . . . . . . . . . . . 108
grave . . . . . . . . . . . . . . . . . . . 47 in . . . . . . . . . . . . . . . . . . . . . 62
Greek letter . . . . . . . . . . . . . . . . 68 in-math? . . . . . . . . . . . . . . . . 250
greyed . . . . . . . . . . . . . . . . 57, 169 indentation . . . . . . . . . . . . . . 61, 63
grid . . . . . . . . . . . . . . . . . . . 153 index . . . . . . . . . . . . . . . . . . 109
grid curves . . . . . . . . . . . . . . . 164 entry . . . . . . . . . . . . . . . . 109
grid points . . . . . . . . . . . . . . . 164 inflate . . . . . . . . . . . . . . . . 143, 187
grid-curve intersections . . . . . . . . 164 informative flag . . . . . . . . . . 136, 141
group . . . . . . . . . . . . . . . . . . 163 ink in . . . . . . . . . . . . . . . . . . 177
GUILE . . . . . . . . . . . . . . . . . . 240 ink out . . . . . . . . . . . . . . . . . 178
guillemets . . . . . . . . . . . . . . . . . 44 INKSCAPE . . . . . . . . . . . . . . . . 151
hand-drawn curve . . . . . . . . . . . 158 inline formula . . . . . . . . . . . . . . 66
handwritten . . . . . . . . . . . . . . . 61 inline markup . . . . . . . . . . . . 51, 56
hanging punctuation . . . . . . . . . . 135 inline tag . . . . . . . . . . . . . . 210, 217
INDEX 265

input field . . .. . .. . .. . .. . . 198 Insert


Insert missing invisible operators . . . . . 85 Fold
Insert square root . . . . . . . . . . . . . 75 Executable
Insert . . . . . . . . . . 26, 35, 101, 154, 158 Maxima . . . . . . . . . . . 197
Animate objects . . . . . . . . . 172, 177 Folded . . . . . . . . . . . . . . 169
Animation Overlay . . . . . . . . . . . . . 170
Alter Alternate except here . . . . 171
Translate . . . . . . . . . . 174 Alternate from here on . . . 171
Animate . . . . . . . . . . . 176–177 Alternate only here . . . . . 171
Animation . . . . . . . . . . . . 173 Alternate until here . . . . . 171
Appear . . . . . . . . . . . . . . 173 Specify color alternation . . . 171
Fade . . . . . . . . . . . 173–174 Visible except here . . . . . 170
Progressive . . . . . . . 173–174 Visible from here on . . . 170–171
Translate . . . . . . . . 173–174 Visible only here . . . . . . . 170
Zoom . . . . . . . . . . 173–174 Visible until here . . . . . . 170
Compose . . . . . . . . . . . . 175 Overlays . . . . . . . . . . . . . 170
Emphasize . . . . . . . . . . . . 175 Compressed . . . . . . . . . 170
Emboss . . . . . . . . . . . 175 Greyed . . . . . . . . . . . . 171
Outlined emboss . . . . . . 175 Phantoms . . . . . . . . . . 170
Shadowed . . . . . . . . . . 175 Standard . . . . . . . . . . . 170
Fixed . . . . . . . . . . . . . . 175 Summarize . . . . . . . . . . . 169
Repeat . . . . . . . . . . . . . . 175 Switch . . . . . . . . . . . . . . 168
Retime . . . . . . . . . . . . . . 175 Standard . . . . . . . . . . . 168
Sound . . . . . . . . . . . . . . 173 Tiny . . . . . . . . . . . . . 168
Vanish . . . . . . . . . . . . . . 173 Traversal . . . . . . . . . . . . 169
Arc . . . . . . . . . . . . . . . . . . 156 Unroll . . . . . . . . . . . . . . 169
Arrow with text . . . . . . . . . . . . 82 Compressed . . . . . . . . . 169
Automatic Greyed . . . . . . . . . . . . 169
Bibliography . . . . . . . . . . . 114 Itemize . . . . . . . . . . . 169
Glossary . . . . . . . . . . . . . 110 Phantoms . . . . . . . . . . 169
Index . . . . . . . . . . . . 109, 111 Fraction . . . . . . . . . . . . . . 75, 180
List of figures . . . . . . . . . . 110 Geometry
List of tables . . . . . . . . . . . 110 Crop . . . . . . . . . . . . . . . 151
Table of contents . . . . . . . . 108 Crop . . . . . . . . . . . . . . 82
Chapter Draw over . . . . . . . . . . . . 153
Epilogue . . . . . . . . . . . . . . 51 Overlap . . . . . . . . . . . . . 152
Prologue . . . . . . . . . . . . . . 51 Size . . . . . . . . . . . . . . . 151
Circle . . . . . . . . . . . . . . . . 156 Unit . . . . . . . . . . . . . . . 153
Closed curve . . . . . . . . . . . . 156 Zoom . . . . . . . . . . . . . . 153
Closed Bezier . . . . . . . . . . 157 Grid . . . . . . . . . . . . . . . . . 153
Closed smooth . . . . . . . . . 156 Default . . . . . . . . . . . . . . 82
Content tag . . . . . . . . . . . . . . 56 Notebook . . . . . . . . . . . . . 82
Abbreviation . . . . . . . . . . . . 43 Type
Acronym . . . . . . . . . . . . . 204 Cartesian . . . . . . . . . . 153
Strong . . . . . . . . . . . . . 56, 228 Group/ungroup . . . . . . . . . . . 163
Curve . . . . . . . . . . . . . . . . 156 Hand drawn . . . . . . . . . . . . . 158
Bezier . . . . . . . . . . . . . . 157 Image . . . . . . . . . . . . . . . . 106
Database entry . . . . . . . . . . . 121 Big figure . . . . . . . . . . . . 110
Description . . . . . . . . . . . . . . 55 Commutative diagram . . . . . . . 81
Enumerate . . . . . . . . . . . . . . . 55 Draw image . . . . . . . . . 106, 151
Roman . . . . . . . . . . . . . . . 55 Draw over selection . . . 106, 151–152
Enunciation . . . . . . . . . . . . . . 52 Ink here . . . . . . . . . . . 151–152
Theorem . . . . . . . . . . . . . . 26 Insert image . . . . . . . . . 106, 151
Fold . . . . . . . . . . . . . . . . . 186 Link image . . . . . . . . . . 106, 151
Executable . . . . . . . . . . 169, 197 Small figure . . . . . . . . . . . 110
266 INDEX

Insert Insert
Import entry . . . . . . . . . . . 124–125 Presentation tag
Import selected entries . . . . . . . 124 Strike through . . . . . . . . . 57. .
Itemize . . . . . . . . . . . . . . . . 54 Subscript . . . . . . . . . . . 57. .
Language . . . . . . . . . . 46, 132, 183 Superscript . . . . . . . . . . 57. .
Last name . . . . . . . . . . . . .. 122 Underline . . . . . . . . . . . 57. .
Line . . . . . . . . . . . . . . . .. 155 Prominent . . . . . . . . . 53, 61, 63, 171
Link Centered . . . . . . . . . . . . . . 54
Action . . . . . . . . . . . . . . 106 Compact . . . . . . . . . . . . . . 63
Alternate . . . . . . . . . . . . 111 Framed . . . . . . . . . . . . . . 54
Bibliography . . . . . . . . . 125 Indent . . . . . . . . . . . . . . . 63
Index . . . . . . . . . . . . 111 Left aligned . . . . . . . . . . . . 53
Citation Lines around . . . . . . . . . . . 54
Detailed . . . . . . . . . . . 114 Ornament . . . . . . . . . . . . . 54
Invisible . . . . . . . . . . . 114 Overlined . . . . . . . . . . . . . 54
Visible . . . . . . . . . . . . 113 Padded . . . . . . . . . . . . 54, 142
Executable input field . . . . . . 198 Quotation . . . . . . . . . . . . . 53
Field reference . . . . . . . . . . 198 Quote . . . . . . . . . . . . . . . 53
Glossary entry . . . . . . . . . . 110 Right aligned . . . . . . . . . . . 54
Hyperlink . . . . . . . . . . . . 106 Underlined . . . . . . . . . . . . . 54
Include . . . . . . . . . . . . . 126 Verse . . . . . . . . . . . . . . . 53
Index entry . . . . . . . . . 109, 111 Resize objects . . . . . . . . . . . . 163
Interject . . . . . . . . . . . 109 Rotate objects . . . . . . . . . . . . 163
Input field . . . . . . . . . . . . 198 Section . . . . . . . . . . . . . . 25, 51
Label . . . . . . . . . . . . . . . 105 Section . . . . . . . . . . . . . 228
Reference . . . . . . . . . . . . 105 Semantics . . . . . . . . . . . . . . . 88
Reference to note . . . . . . . . 138 Other . . . . . . . . . . . . . . . 87
Text for note . . . . . . . . . . 138 Session . . . . . . . . . . . . . . . 191
Long text . . . . . . . . . . . . . . 158 Other . . . . . . . . . . . . . . 192
Mathematics . . . . . . . . . . . . 82, 158 Remote . . . . . . . . . . . . . 201
Displayed formula . . . . . . . . . 66 Scheme . . . . . . . . . . . 191, 240
Equations . . . . . . . . . . . 90, 105 Shell . . . . . . . . . . . . . . . 191
Inline formula . . . . . . . . . . . 66 Set properties . . . . . . . . . . . . 163
Several equations . . . . . . . 67, 96 Size tag . . . . . . . . . . . . . . 56–57
Move objects . . . . . . . . . . . . 163 Slides . . . . . . . . . . . . . . . . 172
N-th root . . . . . . . . . . . . . . . 75 Symbol . . . . . . . . . . . . . . . . 73
Negation . . . . . . . . . . . . . . . 76 Arrow . . . . . . . . . . . . . . . 73
Note Big operator . . . . . . . . . . . . 76
Floating algorithm . . . . . . . . 138 Binary operator . . . . . . . . . . 71
Floating figure . . . . . . . . . . 138 Binary relation . . . . . . . . . 67, 72
Floating object . . . . . . . . . 138 Miscellaneous . . . . . . . . . . . 73
Floating table . . . . . . . . . . 138 Negation . . . . . . . . . . . . . . 72
Footnote . . . . . . . . . . . . . 137 Table . . . . . . . . . . . . . . . 89–90
Marginal note . . . . . . . . . . 138 Big table . . . . . . . . . . . . 90, 110
Overlays . . . . . . . . . . . . . . . 172 Centered block . . . . . . . . . . 90
Insert overlay after . . . . . . . 172 Choice . . . . . . . . . . . . . . . 90
Insert overlay before . . . . . . 172 Determinant . . . . . . . . . . . . 90
Particle . . . . . . . . . . . . . . . 122 Matrix . . . . . . . . . . . . . 80, 90
Point . . . . . . . . . . . . . . . . . 155 Numeric spreadsheet . . . . . . 199
Polygon . . . . . . . . . . . . . . . 156 Plain tabular . . . . . . . . . . . . 90
Presentation tag . . . . . . . . . . . . 57 Small table . . . . . . . . . . . 90, 110
Greyed . . . . . . . . . . . . . . . 57 Stack . . . . . . . . . . . . . . . . 90
Light . . . . . . . . . . . . . . . . 57 Textual spreadsheet . . . . . . . 199
Overline . . . . . . . . . . . . . . 57 Wide block . . . . . . . . . . . 89, 93
Pastel . . . . . . . . . . . . . . . 57 Text . . . . . . . . . . . . . . . . 76, 157
INDEX 267

Insert look and feel . . . .. . . . . . .. . 14, 36


Title macro . . . . . . . .. . . . . . 17, 202, 244
Abstract . . . . . . . . . .
50 . . . . customize . . . .. . . . . . . . 204, 229
.
Insert title . . . . . . . .
48 . . . . editor . . . . . .. . . . . . . . . . 204
Title suffix . . . . . . . . . . .
122 . . . localization . . .. . . . . . . . . . 230
insert-menu . . . . . . . . . . .
247 . . . macro . . . . . . . .. . . . . . . . . . 216
intent . . . . . . . . . . . . . .
. 16. . . . magnified . . . . . .. . . . . . . . . . 147
internationalization . . . . . . . .
230 . . . main icon toolbar . .. . . . . . . . . . . 26
invisible bracket . . . . . . . .
. 86. . . . margin . . . . . . .. . . . . . . . . . . 65
invisible citation . . . . . . . . .
114 . . . margin kerning . . .. . . . . . . . . . 135
invisible mathematical symbol .
. 86. . . . marginal note . . . .. . . . . . . . . . 138
invisible text . . . . . . . . . . .
144 . . . marked . . . . . . .. . . . . . . . . . . 56
italic . . . . . . . . . . . . . . .
. 60. . . . marker . . . . . . .. . . . . . . . . . . 61
item . . . . . . . . . . . . . . .
. 54. . . . markup . . . . . . .. . . . . . . . . . . 15
list . . . . . . . . . . . . . . .
54, 238 . . element . . . . .. . . . . . . . . . . 37
itemize . . . . . . . . . . . . .
. . 54. . . markup element . .. . . . . . . . . . . 16
JAVA . . . . . . . . . . . . . .
. 240 . . . master document . .. . . . . . . . . . 125
join cells . . . . . . . . . . . .
. 100 . . . math mode . . . . .. . . . . . . . . . . 66
jump in . . . . . . . . . . . . .
. . 63. . . mathematical input . . . . . . . . . . . 194
justified . . . . . . . . . . . . .
. . 61. . . mathematical symbol . . . . . . . . . . . 67
kbd-horizontal . . . . . . . .
. 247 . . . matrix . . . . . . . . . . . . . . . . . . . 80
kbd-map . . . . . . . . . 244, 246, 251–252 Maxima . . . . . . . . . . . . . . . . . 198
kbd-right . . . . . . . . . . . . . . . 246 Keep evaluated expressions . . . . 198
keyboard prefix . . . . . . . . . . . . . . 31 Simplification
keyboard shortcut . . . . . . . . 14, 28, 246 Expand . . . . . . . . . . . . . 198
label . . . . . . . . . . . . . . . . . . . 105 MAXIMA .. . .. . .
21, 192–193, 197–199
lambda . . . . . . . . . . . . . . . . . 244 Maximal clustering . .
. . . . . . . . . . 50
large delimiter . . . . . . . . . . . . . . 77 meaning . . . . . . .
. . . . . . . . . . 16
LaTeX name . . . . . . . . . . . . . . . 74 medieval . . . . . . .
. . . . . . . . . . 61
LaTeX . . . . . . . . . . . . . . . 23, 31, 231 medium . . . . . . . .
. . . . . . . . . . 60
left aligned . . . . . . . . . . . . . . . . 61 menu . . . . . . . . .
. . . . . . 14, 34, 247
left footer . . . . . . . . . . . . . . . . . 27 menu-bind . . . . . .
. . . . . . . 247, 251
length . . . . . . . . . . . . . . . . . 62, 232 meta key ⌘ . . . . . .
. . . . . . . . 28, 31
unit . . . . . . . . . . . . . . . . 62, 140 metadata . . . . . . .
. . . . . . . . . . 50
let* . . . . . . . . . . . . . . . . . . 244 MICROSOFT OFFICE . .
. . . . . . . . . . 13
LIBREOFFICE . . . . . . . . . . . . . . . 13 MICROSOFT WORD . .
. . . . . . . . . . 18
light . . . . . . . . . . . . . . . . . . . . 60 microtypography . . .
. . . . . . . . . 133
line . . . . . . . . . . . . . . . . . . . 155 mm . . . . . . . . . . .
. . . . . . . . . . 62
arrows . . . . . . . . . . . . . . . 161 mode-dependent icon toolbar . . . . . . 26
break . . . . . . . . . . . . . . . 45, 132 modifier key . . . . . . . . . . . . . . . 28
breaking . . . . . . . . . . . . . . 131 monospaced . . . . . . . . . . . . . . . 61
decorated text . . . . . . . . . . 146 morphing . . . . . . . . . . . . . . . . 176
width . . . . . . . . . . . . . . . . 159 motion pen . . . . . . . . . . . . . . . 149
wrapping . . . . . . . . . . . . . . . 96 move . . . . . . . . . . . . . 143, 163, 187
linear transformation . . . . . . . . . . 144 multiline input . . . . . . . . . . . . . 193
link . . . . . . . . . . . . . . . . . . . 106 multiple
input field . . . . . . . . . . . . . . 198 bibliographies . . . . . . . . . . 111, 125
LISP . . . . . . . . . . . . . . . . . . 22, 191 columns . . . . . . . . . . . . . . . 139
list . . . . . . . . . . . . . . . . 54, 238, 241 glossaries . . . . . . . . . . . . . . 111
list . . . . . . . . . . . . . . . . . . 241 indexes . . . . . . . . . . . . . . . 111
list of figures . . . . . . . . . . . . . . 110 multiplication . . . . . . . . . . . . . 70, 86
list of tables . . . . . . . . . . . . . . . 110 my-init-texmacs.scm . . . . . . . . 245
ln . . . . . . . . . . . . . . . . . . . . . 62 name . . . . . . . . . . . . . . . . . . . 56
local bibliography . . . . . . . . . . . 125 negation . . . . . . . . . . . . . . . 70, 76
localize . . . . . . . . . . . . . . . . . 231 nested list . . . . . . . . . . . . . . . . . 54
268 INDEX

new double page . . . . . . . . . . . . 136 PDF . . . . . . . . . 24, 50–51, 106, 148, 179
new line . . . . . . . . . . . . . . . . . 132 pen . . . . . . . . . . . . . . . . . . . . 61
new page . . . . . . . . . . . . . . . . 136 Perlin noise . . . . . . . . . . . . . . . 148
new-exercise . . . . . . . . . . . . . . 236 phantom . . . . . . . . . . . . . . 144, 169
new-list . . . . . . . . . . . . . . . 227, 239 picture . . . . . . . . . . . . . . . 106, 151
new-remark . . . . . . . . . . . . . . 236 size . . . . . . . . . . . . . . . . . 151
new-theorem . . . . . . . . . . . . 219, 236 unit . . . . . . . . . . . . . . . . . 153
No clustering . . . . . . . . . . . . . . . 50 plain . . . . . . . . . . . . . . . . . . 114
non-breaking plug-in . . . . . . . . . . . . . . . . 23, 191
hyphen . .. . .. . . . . . . . . 44, 132 poetry . . . . . . . . . . . . . . . . . . . 53
space . . .. . .. . . . . . . . . 45, 132 point . . . . . . . . . . . . . . . . . . 155
null? . . . . . . . . . . . . . . . . . . 242 style . . . . . . . . . . . . . . . . . 162
number-long-article . . . . . . . . 238 polygon . . . . . . . . . . . . . . . . . 155
numbering . . . . . . . . . . . . . . . . 52 polyline . . . . . . . . . . . . . . . . . 155
oblique . . . . . . . . . . . . . . . . . . 60 position . . . . . . . . . . . . . . . . . 186
office suite . . . . . . . . . . . . . . . . 21 POSTSCRIPT . . . . . . . . . . . . . . . 108
Ok . . . . . . . . . . . . . . . . . . . . 103 POWERPOINT . . . . . . . . . . . . . . 179
opacity . . . . . . . . . . . . . . . . . 159 preamble . . . . . . . . . . . . . . . 17, 213
operator . . . . . . . . . . . . . . . . . . 70 presentation . . . . . . . . . . . . . . . 16
or . . . . . . . . . . . . . . . . . . . . 245 presentation mode . . . . . . . . . . . 166
orientation . . . . . . . . . . . . . . . . 64 prime . . . . . . . . . . . . . . . . . . . 75
ornament . . . . . . . . . . . . . . . . . 54 progressive . . . . . . . . . . . . . . . 173
outline . . . . . . . . . . . . . . . . 61, 149 project . . . . . . . . . . . . . . . . . 125
outlined emboss . . . . . . . . . . . . 150 Project . .. . ..
. . . . . . . . . . . . 126
outlined engrave . . . . . . . . . . . . 150 prologue . . ..
. . . . . . . . . . . . . 51
oval pen . . . . . . . . . . . . . . . . . 149 proportional ..
. . . . . . . . . . . . . 61
overbrace . . . . . . . . . . . . . . . . . 79 protrusion . ..
. . . . . . . . . . . . 135
overlay . . . . . . . . . . . . . . . . . 170 pt . . . . . . . .
. . . . . . . . . . . . . 62
Overlay . . . . . . . . . . . . . . . . . 172 punctuation . . .
. . . . . . . . . . . . . 42
overline . . . . . . . . . . . . . . . . . . 57 PYTHON . . . . .. . . . . . . . . . . . 240
padded . . . . . . . . . . . . . . . . 54, 142 quasi . . . . . .
. . . . . . . . 219–220, 237
padded-normal . . . . . . . . . . . . . 227 quasiquote . . .. . . . . . . . . . . . 220
padding . . . . . . . . . . . . . . . . . . 95 quasi-quote . . .
. . . . . . . . . . . . 242
pag . . . . . . . . . . . . . . . . . . . . 62 quotation . . . .
. . . . . . . . . . . . . 53
page quote . . . . . .
. . . . . . . . . . . 44, 242
break . . . . . . . . . . . . . . . . 136 quote . . . . . .
. . . . . . . . . . . . 220
breaking . . . . . . . . . . . . . . 135 quote-arg . . . .
. . . . . . . . . . . . 220
extension . . . . . . . . . . . . . . 135 quote-value . . . . . . . . . . . . . . 220
footer . . . . . . . . . . . . . . . 65, 226 rectangular pen .
. . . . . . . . . . . . 149
header . . . . . . . . . . . . . . . 65, 226 reduce . . . . .. . . . . . . . . . . . 143
layout . . . . . . . . . . . . . . . . 232 reference . . . .
. . . . . . . . . . . . 105
margin . . . . . . . . . . . . . . . . 65 remark . . . . .. . . . . . . . . . . 52, 236
reduction . . . . . . . . . . . . . . 135 remote control .. . . . . . . . . . . . 166
size . . . . . . . . . . . . . . . . . . 64 remote plug-in .. . . . . . . . . . . . 200
type . . . . . . . . . . . . . . . . . . 64 Remove . . . . .. . . . . . . . . . . . 201
PALATINO . . . . . . . . . . . . . . . . 127 render-abstract . . . . . . . . . . . . 234
panorama mode . . . . . . . . . . . . 166 render-enunciation . . . . . . . . . . 236
paper . . . . . . . . . . . . . . . . . . . 64 render-list . . . . . . . . . . . . . 227, 238
papyrus . . . . . . . . . . . . . . . . . . 64 repeat . . . . . . . . . . . . . . . . . . 146
par . . . . . . . . . . . . . . . . . . 62, 97 replace . . . . . . . . . . . . . . . . . 181
PARI/GP . . . . . . . . . . . . . . . . 196 toolbar . . . . . . . . . . . . . . . . 27
paste . . . . . . . . . . . . . . . . . . 163 resize . . . . . . . . . . . 143, 163, 186–187
path . . . . . . . . . . . . . . . . . . . 249 retaining a version . . . . . . . . . . . 188
pattern . . . . . . . . . . . . . . . 101, 146 retro . . . . . . . . . . . . . . . . . . . . 61
pc . . . . . . . . . . . . . . . . . . . . . 62 return key ↩ . . . . . . . . . . . . . . . 29
INDEX 269

right aligned . .. . . . . . . . . .61 . .. Source


right footer . . .. . . . . . . . . .27 . .. Flow control . . . . . . . . . . . . . 220
right-flush . . . . . . . . . . . . .
219 . . Macro . . . . . . . . . . . . . . . . 216
ringbook style . . . . . . . . . . .
194 . . Text . . . . . . . . . . . . . . . . . 222
root . . . . . . . . . . . . . . . . .75 . .. Tuple . . . . . . . . . . . . . . . . 222
root tree . . . . . . . . . . . . . . .
249 . . space
rotate . . . . . . . . . . . . . . . .
144, 163 in mathematical formula . . . .
70–71 .
Rough . . . . . . . . . . . . . . . .
. . 189 non-breaking . . . . . . . . . .
132 . .
running author . . . . . . . . . . .
. . . 48 SPACES . . . . . . . . . . . . . . .
32–33 .
running title . . . . . . . . . . . .
. . . 48 spc . . . . . . . . . . . . . . . . .
62, 141 .
sample . . . . . . . . . . . . . . .
. . . 56 specific . . . . . . . . . . . . . . .
. 219 .
sans serif . . . . . . . . . . . . . .
. . . 60 spell check . . . . . . . . . . . . .
. 182 .
scheme tree . . . . . . . . . . . . .
242, 248 spell toolbar . . . . . . . . . . . .
. . 27 .
SCHEME . . . . . . . . . . . 22, 191, 220, 240 spline . . . . . . . . . . . . . . . .
. 156 .
scifi . . . . . . . . . . . . . . . . . . . . 61 spreadsheet . . . . . . . . . . . . .
. 199 .
screen . . . . . . . . . . . . . . . . . . . 64 SPRINGER VERLAG . . . . . . . . .
. 225 .
screens . . . . . . . . . . . . . . . . . 168 square root . . . . . . . . . . . . .
. . 75 .
scripting language . . . . . . . . . . . 197 stacking order . . . . . . . . . . .
. 155 .
search . . . . . . . . . . . . . . . . . . 181 status bar . . . . . . . . . . . . . .
. . 27 .
toolbar . . . . . . . . . . . . . . . . 27 std-latex . . . . . . . . 225–226, 231–232
section . . . . . . . . . . . . . 50, 226, 234 std-list . . . . . . . . . . . . . . . 239
section-base . . . . . . . . . . . 231, 235 std-utils . . . . . . . . . . . . . 227, 230
sectional-short-style . . . . . . . . . . 234 stree . . . . . . . . . . . . . . . . . . 248
semantic focus .. . . . . . . . . . . 83, 85 stree->tree . . . . . . . . . . . . . . 242
sep . . . . . . . . . . . . . . . . . . . . 62 stretchable length unit . . . . . . . . . 140
serif .
. . . . . . . . . . . . . . . . . . . 60 strike through . . . . . . . . . . . . . . 57
session . . . . . . . . . . . . . . . . . 191 string->symbol . . . . . . . . . . . . 241
set! . . . . . . . . . . . . . . . . . . 244 string-append . . . . . . . . . . . . 241
shadow . . . . . . . . . . . . . . . . . 150 strong . . . . . . . . . . . . . . . . . . . 56
shadowed raise . . . . . . . . . . . . . 150 structured
shape . . . . . . . . . . . . . . . . . . . 60 cursor movement . . . . . . . . . 38, 184
shell command . . . . . . . . . . . . . 106 deletion . . . . . . . . . . . . . . 38, 184
shell session . . . . . . . . . . . . . . 191 document . . . . . . . . . . . . . 16, 37
shift . . . . . . . . . . . . . . . . . 143, 187 insertion . . . . . . . . . . . . . 38, 184
shift key ⇧ . . . . . . . . . . . . . . . . 28 selection . . . . . . . . . . . . . . . 181
shown . . . . . . . . . . . . . . . . . . 171 variant . . . . . . . . . . . . . . 38, 185
siam . . .. . . . . . . . . . . . . . . 114 style
similar . . . . . . . . . . . . . . . . . 185 file . . . . . . . . . . . . . . . . . 17, 214
size . . . . . . . . . . . . . . . . . . . . 60 option . . . . . . . . . . . . . . . . . 39
skew . . . . . . . . . . . . . . . . . . 144 package . . . . . . . . . . . . . . 17, 214
slant . . . . . . . . . . . . . . . . . . . . 60 parameter . . . . . . . . . . . . . . . 39
slanted . . . . . . . . . . . . . . . . . 147 style-sheet language . . . . . . . . . . 215
small figure . . . . . . . . . . . . . . . 110 subscript . . . . . . . . . . . . . 57, 70, 74
small table . . . . . . . . . . . . . . 90, 110 subsection . . . . . . . . . . . . .
. 50, 234
smash . . . . . . . . . . . . . . . . 143, 187 subtable . . . . . . . . . . . . . . .
. . 101
smooth curve . . . . . . . . . . . . . . 156 SUBVERSION . . . . . . . . . . . . .187, 190
snapping . . . . . . . . . . . . . . . . 164 sum . . . . . . . . . . . . . . . . .
. . 200
source code . . . . . . . . 205, 207–208, 211 summarize . . . . . . . . . . . . .
. . 169
Source . . .. . . . . . . . . . . . . . . 215 superscript . . . . . . . . . . . . 57, 70, 74
Activation surround . . . . . . . . . . . . . . . . 217
Deactivate . . . . . . . . . . . . 211 svjour . . . . . . . . . . . . . 225–228, 230
Arithmetic . . . . . . . . . . . . . . 222 SVN . .. .. . . . . . . . . . . . . . 22, 124
Condition . . . . . . . . . . . . . . 222 switch .
. .. . . . . . . . . . . . . 168, 197
Define . . . . . . . . . . . . . . . . 215 symbol . .. . . . . . . . . . . . . . . . 67
Evaluation . . . . . . . . . . . . . . 219 symbol? . . . . . . . . . . . . . . . . 241
270 INDEX

syntax correction . . . . . . . . . . .. . 85 Tools


syntax highlighting . . . . . . . . . .. 196 Macros
tab . . . . . . . . . . . . . . . . . .. . 62 Extract style package . . . . . . 214
tab key ⇥ . . . . . . . . . . . . 29–30, 68–69 New macro . . . . . . . . . . 17, 202
tab-completion . . . . . . . . . . . 105, 196 Miscellaneous
table . . . . . . . . . . . . . . . . . . . . 89 Export selections as . . .. . .. 180
alignment . . . . . . . . . . . . . . . 98 Import selections as . . .. . .. 180
art . . . . . . . . . . . . . . . . . . 101 Project
border . . . . . . . . . . . . . . . . . 98 Attach master . . . . . . . . .
126 .
breaking . . . . . . . . . . . . . . . 99 Use as master . . . . . . . . .
125 .
macro . . . . . . . . . . . . . . . . 102 Source macros tool . . . . . . . .
211 .
of contents . . . . . . . . . . . . . 108 tracking . . . . . . . . . . . . . . . .
133 .
padding . . . . . . . . . . . . . . . . 98 translate . . . . . . . . . . . . . . .
173, 231
width . . . . . . . . . . . . . . . . . 97 traversal of presentation . . . . . .
. . 169
tag . . . . . . . . . . . . . . . . . . 16, 37 tree . . . . . . . . . . . . . . . . .
208, 248
tail . . . . . . . . . . . . . . . . . . . 241 tree . . . . . . . . . . . . . . . .
. . 248
tensor product . . . . . . . . . . . . . . 70 tree->stree . . . . . . . . . . . .
. . 242
TeX . . . . . . . . . . . . . . . . . . . . 23 tree-ref . . . . . . . . . . . . . .
. . 249
tex-len . . . . . . . . . . . . . . . . . 226 tree-set . . . . . . . . . . . . . .
. . 249
texmacs-extra-menu . . . . . . . . . 247 tutorials .. . . . . . . . . . . . . .
. . . 41
texmacs-menu . . . . . . . . . . . . . 247 twith . . . . . . . . . . . . . . . .
. . 218
texmacs-modes . . . . . . . . . . . . 252 TEXMACS tree . . . . . . . . . . . .
. . 248
text typewriter . . . . . . . . . . . . .
. . . 61
alignment . . . . . . . . . . . .
53, 162 . umlaut . . . . . . . . . . . . . . .
. . . 47
block . . . . . . . . . . . . . .
158 . . underbrace . . . . . . . . . . . . .
. . . 79
borders . . . . . . . . . . . . .
165 . . underline . . . . . . . . . . . . . .
. . . 57
corners . . . . . . . . . . . . .
164 . . unextended . . . . . . . . . . . . .
. . . 60
flow . . . . . . . . . . . . . . .
136 . . ungroup . . . . . . . . . . . . . .
. . 163
inside formulas . . . . . . . . .76 . . . Unicode number . . . . . . . . . .
. . . 74
object . . . . . . . . . . . . . .
157 . . UNICODE . . . . . . . . . . 45–46, 57, 69, 74
tformat . . . . . . . . . . . . . . .
218 . . uninit . . . . . . . . . . . . . . . . . . 216
theme . . . . . . . . . . . . . . . .
167 . . unit . . .. . . . . . . . . . . . . . . . 153
theorem . . . . . . . . . . . . .
52, 227, 236 UNIX . .. . . . . . . . . . . . . . 108, 214
thicken . . . . . . . . . . . . .
. . . . 149 unquote . . . . . . . . . . . . 219–220, 237
thin . . . . . . . . . . . . . . .
. . . . . 60 unquote . . . . . . . . . . . . . . . . . 242
tilde . . . . . . . . . . . . . . .
. . . . . 47 unquote-splicing . . . . . . . . . . . . 242
time bending . . . . . . . . . .
. . . . 175 unroll . . . . . . . . . . . . . . . . . . 169
title . . . . . . . . . . . . . . .
48, 227, 233 unsrt . . . . . . . . . . . . . . . . . . 114
title bar . . . . . . . . . . . . .
. . . . . 26 update .. . . . . . . . . . . . . . . . 104
Title . . .. . . . . . . . . . . .
. . . . . 48 Update .. . . . . . . . . . . . . . . . 201
title-base . . . . . . . . . .
. . . . 230 upright . . . . . . . . . . . . . . . . . . 60
tm . . . . . . . . . . . . . . . .
. . . . 248 upright letter . . . . . . . . . . . . . . . 68
tm-define . . . . . . . . . . .
. . 244, 251 url . . . . . . . . . . . . . . . . . . . . 106
tm-define-macro . . . . . . .
. . 244, 251 use-modules . . . . . . . . . . . . . . 249
tm-menu . . . . . . . . . . . .
. . . . 244 user preferences . . . . . . . . . . . . . 36
tm-plain . . . . . . . . . . . .
. . . . 114 value . . . . . . . . . . . . . . . . . . 215
tm-set . . . . . . . . . . . . .
. . . . 249 vanish ... . . . . . . . . . . . . . . . 173
today . .. . .. . . . . . . . .
. . . . . 48 variant .. . . . . . . . . . . . . . . . . 69
Tools . . . . . . . . . . . . . .
. 25, 35, 112 verbatim . . . . . . . . . . . . . . . . . 56
Database tool . . . . . 112, 114, 121, 123 verse . .. . . . . . . . . . . . . . . . . 53
Debugging tool . . . . . . . . . . . 167 Version . . . . . . . . . . . . . 35, 187, 190
Macros Commit . . . . . . . . . . . . . . . 190
Create table macro . . .. . .. 103 Compare
Edit macros . . . .. . .. . .. 204 With current user version . . .. 190
Extract style file . .. . .. . .. 214 With newer version . . . . . .. 188
INDEX 271

Version View . . . . . . . . . .. . . . . . . .
28, 35
Compare Animation toolbar .. . . . . . .176–177
With older version . .. . .. . . 188 Presentation mode . . . . . . .
. . 166
File Remote control . .. . . . . . .
. . 166
Compare . . . . .. . . . . . . . 189 Show panorama . .. . . . . . .
. . 166
Grain . . . . . . . . . . . . . . . . 189 weight . .. . .. . .. . . . . . .
. . . 60
History . . . . . . . . . . . . . . . 190 when . . . . . . . . .. . . . . . .
. . 247
Move . . . . . . . . . . . . . . . . 188 while . . . . . . . . .. . . . . . .
. . 220
Register . . . . . . .. . . . . . . . 190 whitespace . . . . . .. . . . . 43, 140–141
Retain . . . . . . . .. . . . . . . . 188 wide . . . . . . . . .. . . . . . . . . . 60
Current version .. . . . . . . . 188 wide accent . . . . . .. . . . . . . . . . 79
Show . . . . . . . . . . . . . . . . 188 wide block . . . . . .. . . . . . . . . . 89
Update . . . . . . . .. . . . . . . . 190 with . . . . . . . . . .. . . . . . . . . 215
versioning . . .. . .. . . . . . . . . 187 with-innermost . . .. . . . . . . . . 249
vertical wysiwyg . . . . . . .. . . . . . . . 13, 18
alignment . . . . . . . . . . . . . .. 95 XFIG . . . . . . . . . .. . . . . . . . . 107
group . . . . . . . . . . . . . . . . 136 XML . . . . . . . . . .. . . . . . . . 20, 51
whitespace . . . . . . . . . . . . . 141 zoom . . . . . . . . .. . . . . . . 153, 173
videos . . . . . . . . . . . . . . . . . .. 41 ZOTERO . . . . . . . .. . . . . . . . . 112

You might also like