✅ Tables
Org-mode tables provide spreadsheet-like functionality directly in your text documents. Scimax VS Code supports creating, editing, navigating, and calculating with tables.
✅ Creating Tables
✅ Manual Creation
Type a table using pipe characters (|) as column separators:
| Name | Age | City |
|---|---|---|
| Alice | 30 | New York |
| Bob | 25 | Boston |
When you press Tab after entering content, the table auto-aligns.
✅ Table Creation Command
Press C-c | or use scimax.table.create to insert a table template.
You'll be prompted for the number of columns and rows.
✅ Converting Text to Table
Select comma-separated or tab-separated text, then use C-c | to convert
it to a table.
1,2 3,4
leads to
| 1 | 2 |
| 3 | 4 |
✅ Editing Tables
✅ Adding/Removing Rows
| Key/Command | Key Binding | Action |
|---|---|---|
| scimax.table.insertRowAbove | M-S-Up | Insert row above current |
| scimax.table.insertRowBelow | M-S-Down | Insert row below current |
| scimax.table.deleteRow | M-S-Backspace | Delete current row |
✅ Adding/Removing Columns
| Key/Command | Key Binding | Action |
|---|---|---|
| scimax.table.insertColumnRight | M-S-Right | Insert column to the right |
| scimax.table.insertColumnLeft | M-S-Left | Insert column to the left |
| scimax.table.deleteColumn | Delete current column |
👀 Moving Rows/Columns
| Command | Key Binding | Action |
|---|---|---|
| scimax.table.moveRowUp | S-up, M-up | Move row up |
| scimax.table.moveRowDown | S-down, M-down | Move row down |
| scimax.table.moveColumnLeft | S-left, M-left | Move column left |
| scimax.table.moveColumnRight | S-right, M-right | Move column right |
⚠️ Moving a Single Cell
Move just the cell at the cursor, swapping it with the cell it displaces. The cursor follows the cell, so you can repeat the key to walk a value across the table.
| Command | Key Binding | Action |
|---|---|---|
| scimax.table.moveCellUp | C-M-up | Move cell up |
| scimax.table.moveCellDown | C-M-down | Move cell down |
| scimax.table.moveCellLeft | C-M-left | Move cell left |
| scimax.table.moveCellRight | C-M-right | Move cell right |
Starting with the cursor on 15.00, C-M-up gives:
| Item | Price | | Item | Price |
|----------+-------| |----------+-------|
| Widget A | 10.00 | → | Widget A | 15.00 |
| Widget B | 15.00 | | Widget B | 10.00 |
Notes:
Vertical moves step over separator lines, so a cell can move into or out of a header row.
The move stops at the table edges - it never wraps around.
The table is realigned after each move, so column widths follow the content.
Rows with fewer cells than the rest of the table are padded with empty cells so the swap lands in the right column.
✅ Separator Lines
Insert horizontal separator lines to divide table sections:
| Key | Action | ||
|---|---|---|---|
| C-c - | Insert separator line ( | ---+--- | ) |
Example with separators:
| Item | Price |
|----------+-------|
| Widget A | 10.00 |
| Widget B | 15.00 |
|----------+-------|
| Total | 25.00 |
✅ Table Alignment
✅ Automatic Alignment
Tables auto-align when you press Tab. Column widths adjust to fit content.
✅ Column Width Specification
Specify fixed column widths using
| Long text you don't want showing all of | Short |
| More long | More |
| <5> | |
| Long text you don't want showing all of | Short |
| More long | More |
Text exceeding the width is truncated in display (but preserved internally).
✅ Horizontal Alignment
Specify alignment using
| Left aligned | Center text | Right aligned |
| More left | Centered | More right |
| Marker | Alignment |
|---|---|
| Left | |
| Center | |
| Right |
Combine with width:
✅ Table Formulas
Tables can include formulas for calculations, similar to spreadsheets.
Formula Line
Formulas are defined in a #+TBLFM: line below the table:
| Item | Qty | Price | Total |
|---|---|---|---|
| Apples | 10 | 1.50 | 15 |
| Oranges | 5 | 2.00 | 10 |
| Sum | 25 |
Cell References
Column References
| Reference | Meaning |
|---|---|
| $1 | First column |
| $2 | Second column |
| $N | Nth column |
| $0 | Current column |
| $+1 | Next column (relative) |
| $-2 | Two columns back (relative) |
| $< | First column |
| $> | Last column |
| $# | Total number of columns |
Row References
| Reference | Meaning |
|---|---|
| @1 | First row |
| @2 | Second row |
| @N | Nth row |
| @0 | Current row |
| @+1 | Next row (relative) |
| @-1 | Previous row (relative) |
| @< | First row |
| @> | Last row |
| @I | First hline |
| @II | Second hline |
| @III | Third hline |
| @# | Total number of data rows |
Combined References
| Reference | Meaning |
|---|---|
| @2$3 | Row 2, column 3 |
| @3$> | Row 3, last column |
| @>$4 | Last row, column 4 |
| @0$0 | Current cell |
| @0$3 | Current row, column 3 |
| @2$0 | Row 2, current column |
| @+1$-1 | Relative reference |
Ranges
| Reference | Meaning |
|---|---|
| @2\(1..@5\)1 | Column 1, rows 2 through 5 |
| @2\(1..@2\)4 | Row 2, columns 1 through 4 |
| @2\(1..@5\)4 | Rectangle from @2\(1 to @5\)4 |
| $2..$5 | Columns 2-5 in current row |
Formula Syntax
Formulas use the syntax: targetexpression=
,#+TBLFM: $4=$2*$3
This sets column 4 to the product of columns 2 and 3.
Multiple formulas separated by :::
,#+TBLFM: $4=$2*$3::@>$4=vsum(@2$4..@-1$4)
Built-in Functions
| Function | Description |
|---|---|
| vsum | Sum of values in range |
| vmean | Average of values |
| vmin | Minimum value |
| vmax | Maximum value |
| vcount | Count of values |
| vprod | Product of values |
| sdev | Standard deviation |
Example:
| Value |
|---|
| 10 |
| 20 |
| 30 |
| 60 |
Recalculating Formulas
| Key/Command | Action |
|---|---|
| C-c C-c (on TBLFM) | Recalculate all formulas |
| scimax.table.recalculate | Recalculate table |
Place your cursor on the #+TBLFM: line and press C-c C-c to apply all formulas.
Formula Examples
Row Formula
Calculate total for each row:
| Item | Q1 | Q2 | Q3 | Q4 | Total |
|---|---|---|---|---|---|
| Sales | 10 | 20 | 30 | 40 | 100 |
| Costs | 5 | 8 | 12 | 15 | 40 |
Column Formula
Sum a column:
| Month | Revenue |
|---|---|
| Jan | 10000 |
| Feb | 12000 |
| Mar | 15000 |
| Total | 37000 |
✅ Percentage Calculation
| Category | Amount | Percent |
|---|---|---|
| A | 500 | 50% |
| B | 300 | 30% |
| C | 200 | 20% |
| Total | 1000 | 100 |
✅ Named Parameters and Constants
Named parameters let you use meaningful names instead of cell references.
Table Parameters ($ rows)
Define parameters directly in the table using a row where cells contain =$name=value= assignments:
| $tax=0.08 | $discount=0.10 |
|---|---|
| Price | 0 |
| 100 | 108 |
| 200 | 216 |
The $tax and $discount values are extracted from the first row and can
be used as $tax and $discount in formulas.
Document Constants (#+CONSTANTS:)
Define constants at the document level using the #+CONSTANTS: keyword:
,#+CONSTANTS: pi=3.14159 e=2.71828 tax_rate=0.075
Then use them in any table formula in the document:
| Radius | Area |
|---|---|
| 5 | 78.54 |
| 10 | 314.16 |
Multiple #+CONSTANTS: lines can be used; all constants are combined.
Column Names
Header row values can be used as column references. Given:
| Price | Quantity | Total |
|---|---|---|
| 10 | 5 | 50 |
| 20 | 3 | 60 |
Column names are case-insensitive.
✅ Duration and Time Calculations
Tables can calculate with time/duration values in HH:MM or HH:MM:SS format.
✅ Duration Format Flags
| Flag | Output Format | Example |
|---|---|---|
| ;T | HH:MM:SS | 2:30:00 |
| ;U | HH:MM (no seconds) | 2:30 |
| ;t | Decimal hours | 2.50 |
✅ Duration Calculation Example
| Task | Start | End | Duration |
|---|---|---|---|
| Coding | 9:00 | 12:30 | 3:30 |
| Meeting | 13:00 | 14:15 | 1:15 |
| Review | 14:30 | 16:00 | 1:30 |
| Total | 42:45 |
Duration values are automatically parsed when the T, U, or t flag is
present. They are converted to seconds for calculation, then formatted
according to the flag.
✅ Time Tracking Example
| Date | Hours |
|---|---|
| 2026-01-20 | 8:30 |
| 2026-01-21 | 7:45 |
| 2026-01-22 | 9:00 |
| Total | 25:15 |
| Avg | 8.42 |
✅ Remote Table References
Reference cells from other named tables in the document:
| Region | Rate |
|---|---|
| US | 0.10 |
| EU | 0.20 |
| Region | Revenue | Tax |
|---|---|---|
| US | 1000 | 100 |
| EU | 2000 | 400 |
The remote(tablename, reference) function retrieves a value from another
table named with #+NAME:.
✅ Formula Highlighting
Toggle formula highlighting to visualize which cells are affected by formulas:
| Command | Description |
|---|---|
| scimax.table.toggleFormulaHighlight | Toggle formula cell highlighting |
When enabled:
Green highlight: Cells that are targets of formulas (will be calculated)
Blue highlight: Cells that are referenced in formulas (source values)
Yellow highlight: The #+TBLFM line itself
✅ Format Specifiers
Control how formula results are displayed:
| Specifier | Description | Example Result |
|---|---|---|
| ;%.2f | 2 decimal places | 3.14 |
| ;%d | Integer | 3 |
| ;%.0f%% | Percentage | 50% |
| ;%e | Scientific notation | 3.14e+00 |
| ;T | Duration as HH:MM:SS | 1:30:00 |
| ;U | Duration as HH:MM | 1:30 |
| ;t | Duration as decimal hrs | 1.50 |
✅ Table Import/Export
✅ Importing Tables
Import data from CSV files:
| Command | Description |
|---|---|
| scimax.table.import | Import table from file |
The import command will prompt for the file path and delimiter.
Exporting Tables
| Key/Command | Description |
|---|---|
| C-c C-e t | Export table |
| scimax.table.export | Export table to file |
Export formats:
CSV (comma-separated values)
TSV (tab-separated values)
Other delimited formats
✅ Column Operations
Perform quick calculations on columns:
| Command | Description |
|---|---|
| scimax.table.sumColumn | Sum values in current column |
| scimax.table.averageColumn | Average of current column |
✅ Sorting
| Key/Command | Description |
|---|---|
| C-c ^ | Sort table by current column |
| scimax.table.sortByColumn | Sort by column |
Sorting options:
Alphabetic (A-Z or Z-A)
Numeric (ascending or descending)
| Category | Amount |
|---|---|
| Supplies | 5000 |
| Travel | 10000 |
| Salaries | 50000 |
✅ Named Tables
Give tables names for reference:
| Category | Amount |
|---|---|
| Salaries | 50000 |
| Supplies | 5000 |
| Travel | 10000 |
Named tables can be:
Referenced in other source blocks
Jumped to with `scimax.table.gotoNamed'
Used as input for calculations
✅ Table Appearance in Export
✅ HTML Export
Tables export as HTML <table> elements with proper styling.
✅ LaTeX Export
Tables export as LaTeX tabular environments:
\begin{tabular}{llr}
Name & Age & City \\
\hline
Alice & 30 & New York \\
Bob & 25 & Boston \\
\end{tabular}
✅ Markdown Export
Tables export in GitHub-flavored Markdown format:
| Name | Age | City |
|-------|-----|----------|
| Alice | 30 | New York |
| Bob | 25 | Boston |
✅ Best Practices
✅ Table Design
Use headers - Always include a header row with column names
Add separators - Use
|---|lines to separate headers from dataAlign numbers right - Numeric columns are easier to read right-aligned
Keep columns focused - One type of data per column
✅ Formula Organization
Comment complex formulas - Add explanations for non-obvious calculations
Build incrementally - Test formulas one at a time
Use named tables - For tables referenced elsewhere
✅ Large Tables
For large datasets:
Consider using source blocks with pandas/R for complex analysis
Import data rather than typing manually
Export results to tables for presentation
✅ Quick Reference
Keybindings
| Key | Action |
|---|---|
| C-c \vert{} | Create table |
| Next cell / align | |
| S- | Previous cell |
| C-c - | Insert separator |
| M- | Insert row below |
| M-S-Right | Insert column right |
| M-S-Backspace | Delete row |
| C-c ^ | Sort by column |
| C-c C-c | Recalculate (on TBLFM) |
| C-c C-e t | Export table |
Commands
| Command | Description |
|---|---|
| scimax.table.create | Create new table |
| scimax.table.insertRowAbove | Insert row above |
| scimax.table.insertRowBelow | Insert row below |
| scimax.table.deleteRow | Delete current row |
| scimax.table.insertColumnRight | Insert column right |
| scimax.table.deleteColumn | Delete current column |
| scimax.table.moveRowUp | Move row up |
| scimax.table.moveRowDown | Move row down |
| scimax.table.moveColumnLeft | Move column left |
| scimax.table.moveColumnRight | Move column right |
| scimax.table.moveCellUp | Move cell up |
| scimax.table.moveCellDown | Move cell down |
| scimax.table.moveCellLeft | Move cell left |
| scimax.table.moveCellRight | Move cell right |
| scimax.table.recalculate | Recalculate formulas |
| scimax.table.sumColumn | Sum current column |
| scimax.table.averageColumn | Average current column |
| scimax.table.sortByColumn | Sort by current column |
| scimax.table.export | Export table |
| scimax.table.import | Import table |
| scimax.table.gotoNamed | Go to named table |
| scimax.table.insertColumnFormula | Insert column formula |
| scimax.table.insertFieldFormula | Insert field formula |
| scimax.table.formulaHelp | Show formula reference |
| scimax.table.toggleFormulaHighlight | Toggle formula highlighting |