Skip to content

Bar Models

The barmodel{} keyword draws a single horizontal bar (Singapore-style "schéma en barre") split into one or more cells. As for the other keywords, cell values are separated by ;, and options follow a | separator; multiple options are separated by ;. An empty value (or _) leaves the corresponding cell empty.

The barmodel{} keyword has several options:

  • widths — comma-separated list of percentages (one per cell), which must sum to 100. Default: equal widths.
  • fill — background colour of the cells. A single value applies to every cell; a comma-separated list assigns a per-cell colour. Use _ (or none) for a transparent cell.
  • border_color — colour of the bar borders. A single value colours every cell border and the brace strokes; a comma-separated list assigns a per-cell border colour to the bar only (braces fall back to the default colour). Use _ to keep the default colour for a given cell.
  • color — default colour applied to string-derived cell contents.
  • split — per-cell sub-grid. Each entry has the form R×C (or R*C) and subdivides the cell into R rows and C columns; use _ for no split. The bar grows in height to keep every sub-row at full size (max(R)); sub-column widths follow from the cell's overall widths value.
  • brace_top — brackets drawn above the bar. Each entry has the form i-j:label (or i:label for a single column) and spans columns i to j (1-indexed, inclusive). Two optional trailing fields override colours for that entry: i-j:label:stroke sets the bracket / outline colour, and i-j:label:stroke:fill additionally sets a background colour (only meaningful in tape style — see below). Use _ in either field to keep the default. Wrap a label or colour containing ,, ; or : in {...} to protect it from being split.
  • brace_bot — same syntax as brace_top, drawn below the bar.
  • brace_top_style — rendering style for the top entries: brace (default) draws curly brackets ; tape draws filled / stroked rectangles sitting flush above the main bar. In tape mode multiple entries are allowed but their ranges must not overlap.
  • brace_bot_style — same, for entries below the bar.
  • baseline — vertical alignment of the bar with the surrounding text: middle (default), top, or bottom. Braces above/below don't shift this alignment.

Examples :

Expression Renders as
barmodel{12 ; 8 ; 20 ; 5} 128205
barmodel{text{N | color=#36add4} ; text{35 | color=#eba215} |
         widths=75,25 ;
         split=1×3,_ ;
         fill=#e9f6fa,#ffede4 ;
         border_color=#36add4,#eba215 ;
         brace_bot=1-2:text{140 | color=#c7383d}:#c7383d
         }
NNN35140
barmodel{math{x} ; text{$2.80 | color=#eba215} |
         split=1×3,_ ;
         widths=60,40 ;
         fill=#e3ecda,#ffede4 ;
         brace_top=1-2:text{Total = $10 | color=#3771c8}:#3771c8:#d7ddef ;
         brace_top_style=tape;
         brace_bot=1:Notebooks:#5c8526,2:text{Pack of pens | color=#eba215}:#eba215 ;
         color=#5c8526 ;
         border_color=#5c8526,#eba215 ;
         }
xxx$2.80Total = $10NotebooksPack of pens