| Search Locate Previous Next | Contents |
NewLeaf aligns the contents of each cell in a column along the left edge by default.
To align the sales data along the right edge of each column, type:
nlInit ª nlUse'' nltAlign 'right' nltList salesQ1 View docnlClose
Repeat the previous example using 'centre' or 'center' instead of 'right' alignment.
Then, to right- and left-align alternate columns, type:
nlInit ª nlUse'' nltAlign 'Right' 'Left' nltList salesQ1 View docnlClose
There are three things to note here. First, the alignment is not case sensitive, so 'right' has the same effect as 'Right' or 'RIGHT'. Second, the vector of alignment settings is always reshaped to match the number of columns in the table. Thirdly, you can reduce any of the words to two-letter abbreviations, such as 'ce' 'ri' 'ri'.
NewLeaf is also able to align the decimal points in numeric data, and to reserve sufficient space to the right of the decimal for a specified number of digits to appear.
As the sales data have been calculated to one decimal place, try typing:
nlInit ª nlUse'' nltAlign 'decimal1' nltList salesQ1 View docnlClose
The figures in each column are now aligned according to the position of the decimal place, but they are a mixture of integers and floating-point numbers. Try combining an appropriate format specification with the decimal alignment to produce a more consistent appearance:
nlInit ª nlUse'' nltAlign 'decimal1' nltQfmt ((¯1+¯1½salesQ1)½'CF8.1'),'CF9.1' nltList salesQ1 View docnlClose
Continuing with the sales report, left-align the row titles and decimal-align the data:
nlInit ª nlUse'' nltQfmt (''),((¯1+¯1½salesQ1)½'CF8.1'),'CF9.1' nltAlign ('left'),(¯1½salesQ1)½'decimal1' nltList products,salesQ1 View docnlClose
Note that the order in which you set the alignments and the format specifications in this example was the reverse of the order in the previous example. The NewLeaf table properties are mutually independent, so an APL application can set them in whichever order is appropriate to the processing.