Skip to content

Align

Align table cell content horizontally and vertically.

AI-assisted, human-approvednovem uses AI to review and keep our documentation up to date.

Set horizontal alignment (left, centre, right) and vertical alignment (top, middle, bottom) for cells selected with the standard slicing syntax. The following symbols specify the direction:

 <    -- left align (horizontal)
 -    -- center align (horizontal)
 >    -- right align (horizontal)
 ^    -- top align (vertical)
 =    -- middle align (vertical)
 v    -- bottom align (vertical)

You can also combine horizontal and vertical alignment by using two characters, where the first character is the horizontal alignment and the second is the vertical alignment (e.g., <^ for left+top).

It can be helpful to think of the symbols "pointing" in the direction of the alignment.

Left

An explicit alignment instruction overrides the template's default. This example left-aligns the entire table.

Use the selector : : with < to left-align all cells.

ctrl/config/table/cell/align
   :     :     <                 -- left align everything

Center

The next example shows how to center all columns in a table except the left one. Often you'll have index values or other information in the left column that you might feel look better left align.

Here we start by replicating the left align everything instruction, and then providing a more specific center align - that centers the rest of the table.

ctrl/config/table/cell/align
   :     :     <   -- left align everything
   :    1:     -   -- center everything except the first column

This example left-aligns the first column, centres the other header cells, and right-aligns the numeric values below them.

Rules are processed in order. These rules left-align all cells, centre the columns after the first, then right-align their body cells.

ctrl/config/table/cell/align
   :     :     <   -- left align everything
   :    1:     -   -- center everything except the first column
  1:    1:     >   -- align everything else to the right

Mix

This example combines column selections and stepped row selections.

The rules right-align the second column, centre the third, and left-align the fourth. Selected rows then alternate alignment in columns five to seven.

ctrl/config/table/cell/align
  :       :      <    -- left align everything
  :      1:      >    -- right align all rows and all columns starting
                      -- at column 2
  0      1:      -    -- center top row starting at column 2

  :      2       -    -- center third column
  :      3       <    -- left align fourth column

 -- create the left "snake" in column five
 4:-1    4       -    -- center fifth column from fifth row and down
 7:9     4       <    -- override row 8-10 and left align

 -- create the right "snake" in column seven
  :      6       <    -- left align column 7
 4:-1    6       -    -- center seventh column from fifth row and down
 7:9     6       >    -- override row 8-10 and right align

-- create the middle "snake" in column six
  :      5       -    -- start by centering column six
 2:-1:4  5       <    -- left align every fourth row starting at row 3
 4:-1:4  5       >    -- right align every fourth row starting at row 5

Vertical Alignment

In addition to horizontal alignment, you can control vertical alignment within cells. This is particularly useful when cells have different heights due to varying content. The vertical alignment glyphs are:

  • ^ - top align (content sits at the top of the cell)
  • = - middle align (content is vertically centered)
  • v - bottom align (content sits at the bottom of the cell)

When using a single vertical alignment character, horizontal alignment defaults to center:

ctrl/config/table/cell/align
   :     :     ^   -- top align everything (horizontal defaults to center)
   :     :     v   -- bottom align everything (horizontal defaults to center)

Combined Alignment

For full control over both horizontal and vertical alignment, combine both characters in a two-character instruction. The first character is the horizontal alignment and the second is the vertical:

 <^   -- left + top
 <=   -- left + middle
 <v   -- left + bottom
 -^   -- center + top
 -=   -- center + middle
 -v   -- center + bottom
 >^   -- right + top
 >=   -- right + middle
 >v   -- right + bottom

This allows precise positioning of content within cells:

ctrl/config/table/cell/align
   :     :     <=   -- left + middle align everything
   0     :     -^   -- center + top align header row
  1:    -1     >v   -- right + bottom align data cells except last column