Inform 7 Home Page / Documentation


Chapter 16: Tables

§16.1. Laying out tables; §16.2. Looking up entries; §16.3. Corresponding entries; §16.4. Changing entries; §16.5. Choosing rows; §16.6. Repeating through tables; §16.7. Blank entries; §16.8. Blank columns; §16.9. Blank rows; §16.10. Adding and removing rows; §16.11. Sorting; §16.12. Listed in...; §16.13. Topic columns; §16.14. Another scoring example; §16.15. Varying which table to look at; §16.16. Defining things with tables; §16.17. Defining values with tables; §16.18. Table continuations; §16.19. Table amendments

arrow-up-left.png Contents of Writing with Inform
arrow-left.png Chapter 15: Numbers and Equations
arrow-right.png Chapter 17: Understanding
arrow-down-right.png Indexes of the examples

§16.1. Laying out tables

When printed books need to display detailed information in a systematic way, they break off from running text and print a table instead. Inform does the same. Here is a typical example:

paste.png Table 2.1 - Selected Elements

Element

Symbol

Atomic number

Atomic weight

"Hydrogen"

"H"

1

1

"Iron"

"Fe"

26

56

"Zinc"

"Zn"

30

65

"Uranium"

"U"

92

238

After the two titling lines, each line represents one row in the table, and entries on a line must be separated by at least one tab character. A table must occupy a single whole paragraph, with no skipped lines or missing entries.

The top line is a title, the first word of which must be the word 'Table'. We can then either give a table number (this need not actually be a number: Table C2, or some such, would be fine), or give a name, or both - as in this case. The possible titling formats are:

Table 2.3
Table of Population Statistics
Table 2.3 - Population Statistics

In the last example we could call the table either "Table 2.3" or "Table of Population Statistics".

Each column then has a name, and the contents must all be the same kind of value. In the elements table the "Symbol" column contains only text, for instance, and the "Atomic weight" column contains only numbers. Any kinds of value will do, so long as all the entries in the column are mutually compatible. (For instance, mixing rooms and things in a single column would be fine, as these can be reconciled, but mixing numbers and rooms would not.)


arrow-up.png Start of Chapter 16: Tables
arrow-left.png Back to Chapter 15: Numbers and Equations: §15.20. Multiplication of units
arrow-right.png Onward to §16.2. Looking up entries