HeaderAlignment

HeaderAlignment

is an option for Dataset that specifies how the contents of a header should be aligned within the available area in the header.

Details

  • The following settings can be given:
  • Automaticdefault alignment based on environment
    Leftleft aligned
    Rightright aligned
    Toptop aligned
    Bottombottom aligned
    Baselinebaseline aligned
    Centercentered
    {h,v}separate horizontal and vertical alignments
  • The settings for HeaderAlignment can be given as follows to apply separately to different items:
  • specapply spec to all headers
    {spec1,spec2,,specn}apply speck to headers at dataset level k
    {spec_(1),spec_(2),...,spec_(n), rules}also allow explicit rules for individual headers
  • The speck can have the following forms:
  • {s1,s2,,sn}use s1 through sn; then use defaults
    {{c}}use c in all cases
    {{c1,c2}}alternate between c1 and c2
    {{c1,c2,}}cycle through all ci
    {s,{c}}use s, then repeatedly use c
    {s1,{c},sn}use s1, then repeatedly use c, but use sn at the end
    {s1,s2,,{c1,c2,},sm,,sn}use the first sequence of si at the beginning, then cyclically use the ci, then use the last sequence of si at the end
    {s1,s2,,{},sm,,sn}use the first sequence of si at the beginning and the last sequence at the end
  • Rules have the form ispec, where i specifies a position in the dataset.
  • Positions can be patterns.
  • The position of a header can be read at the bottom of a dataset when you hover over the header.
  • If the left-hand side of a rule is not a list, the setting is applied to any position that contains the left-hand side as a key or index.
  • A pure function f that returns an alignment can be used in place of any alignment. The setting is given by f[item,position,dataset].

Examples

open allclose all

Basic Examples  (2)

Right-align all headers:

Right-align individual headers:

Possible Issues  (1)

If the value of HeaderAlignment is a list and a valid alignment specification, it is interpreted as a single alignment that is applied to all headers. If it is not a valid alignment specification, it is interpreted as a list of alignment values that are applied to successive dataset levels.

Right-align and vertically center all row headers:

Center row headers and right-align column headers:

To force interpretation of a list as alignments that are applied one per level, use full alignment specifications in the list positions:

Introduced in 2020
 (12.1)