Columns Manipulation Help
Name:Columns Manipulation
Version:2.2
Last update:2019-11-27 14:12:48





Introduction

The Columns Manipulation package is a feature which allows you to manipulate the columns of any tabulated block of text, i-e a series of lines in which items are separated by a specific symbol. By default, the field separator is a tabulation but one can specify any other character (like a colon, a semicolon, a comma, an endash etc. or even the space character).
Once the package is activated, it adds a submenu called Columns to the Text menu. The items of this submenu are explained below. Basic manipulations are copying, inserting, appending, twiddling, deleting, sorting, numbering, equalizing and justifying columns.

Activation

To activate the Columns Manipulation feature, go to Alpha ↣ Global Setup ↣ Features and select the Columns Manipulation checkbox.

Basics

Columns selection

To select one or several columns, you must hilite a region going from the first cell you want to select to the last one by mouse dragging. The start and end positions may be anywhere in a cell, the entire cell will be considered anyway. This is illustrated by the following image:
region selection
In this example, the first cell is (1,2) (first row, second cell) and the last one is (3,3) (third row, third cell) so any column manipulation will act on columns 2 to 3. No matter what is actually hilited, the package will consider only the columns located between the start and end positions.
You can also use rectangular selection, i-e drag the mouse while pressing the Option () key. This is illustrated by the following image:
rectangular selection
This selects the exact same columns as before. In both cases, you have selected:
cd ef
kl mn
st uv
Here is another example (from Romeo and Juliet). We suppose here that each word is separated by a tabulation (any single character can be chosen as a separator, even the space character; see below):
Gallopapace,youfiery-footedsteeds,
TowardsPhoebus'lodging;suchawaggoner
AsPhaethonwouldwhipyoutothewest,
Andbringincloudynightimmediately.
Put the cursor in the word 'you' (first row, third word), press the mouse button and, without releasing it, go to the word 'whip' in the third row, then release: you have selected the following region
    you	fiery-footed
    lodging;	such
    would	whip
even though all the words from 'you' to 'whip' are hilited. We have thus selected columns 3-4 and rows 1-3.

Columns separator

It must NECESSARILY be a SINGLE character. The default is the tabulation character \t. To change the current separator symbol, use the Columns Separator command in the Columns Utilities submenu.
For instance, when working in Latex mode, you might want to choose '&' as a separator for \array or \table environments:
     \begin{tabular}{|c|c|c|}
 	\hline
     you & fiery-footed \\
     lodging; & such \\
     would & whip \\
 	\hline
     \end{tabular}
You can even use the 'space' character as a separator.

Caveat

More examples

You can now select a region and experiment: here are some examples applied to the previous selection. Deleting
Gallop apace, steeds,
TowardsPhoebus'a waggoner
As Phaethonyou to the west,
And bring in cloudy night immediately.
Copying, selecting the first two lines and appending
Gallop apace, you fiery-footedsteeds,you fiery-footed
TowardsPhoebus'lodging;such a waggoner lodging; such
As Phaethonwould whip you to the west,
And bring in cloudy night immediately.
Copying, selecting the second column and inserting
Gallop you fiery-footedapace, you fiery-footedsteeds,
Towardslodging;such Phoebus'lodging;such a waggoner
As would whip Phaethonwould whip you to thewest,
And bring in cloudy night immediately.
Twiddling
Gallop apace, fiery-footedyou steeds,
TowardsPhoebus'such lodging;a waggoner
As Phaethonwhip would you to thewest,
And bring in cloudy night immediately.
Sorting Columns
Gallop apace, lodging;such steeds,
TowardsPhoebus'would whip a waggoner
As Phaethonyou fiery-footedyou to thewest,
And bring in cloudy night immediately.
Selecting the first two lines and reverse sorting rows
you steeds, apace, Gallop fiery-footed
waggoner Towards such Phoebus' lodging; a
As Phaethonwould whip you to thewest,
And bring in cloudy night immediately.
Selecting all four lines and inserting rows numbers
1Gallop apace, you fiery-footedsteeds,
2TowardsPhoebus'lodging;such a waggoner
3As Phaethonwould whip you to thewest,
4And bring in cloudy night immediately.
etc. etc.

Menu Items

All manipulation commands assume that you have already selected columns as explained before.

Main columns menu

Copy Columns
Copy the selected columns in the MacOS system pasteboard. Note that if no region has been selected or hilited, the entire line containing the cursor will be copied.
Insert Columns
Insert columns from the pasteboard BEFORE the first selected column.
Append Columns
Append columns contained in the pasteboard to the right of the selected lines. The procedure will append as much as it can: if you have selected a region with less rows than the material contained in the pasteboard, it will ignore the remaining lines.
Cut Columns
Delete the selected columns and send a copy to the pasteboard so that they may be pasted, inserted, appended elsewhere. All the columns to the right of the selection will be shifted left.
Delete Columns
Delete the selected columns.
Twiddle Columns
Exchange the leftmost and right most columns of your selection. Note that there must be enough elements on each row to allow twiddling: if not, the procedure will fail and send an alert. This can easily been solved by using the Complete Rows item.
Transpose Columns
Swap columns and rows (as in matrix transposition). For instance:
ab    cd    ef
gh    ij    kl
becomes
ab    gh
cd    ij
ef    kl
All rows must have the same number of cells. The entire row is transposed even if you select only a portion.

Columns formatting submenu

Equalize Columns
This command calculates the maximum length of each of the selected columns and appends the necessary amount of blank space so that each column has a unique width. This allows a perfect vertical alignment to make selections easier. Equalizing columns makes it very easy to use rectangular hiliting: select a region with the mouse holding the Option () key down.
Unequalize Columns
This does the opposite of the previous command: any leading or trailing blank spaces in the cells will be trimed.
Complete Rows
In case all the rows do not have the same "length" (i-e number of cells), this procedure will add empty cells to the incomplete rows.
Right Justify
To right justify the selected columns.
Center
To center the selected columns.
Left Justify
To left justify the selected columns.
Insert Rows Numbers
Insert the row number at the beginning of the selected lines. Numbering starts at 1. Numbers are separated by the current separator and constitute a separate column.
Insert Numbers From...
Same as the previous command except that you are prompted to choose the starting number. The last number reached in a previous numbering is proposed as a default choice.

Columns sorting submenu

Sort Columns
Sort the selected columns in increasing order, using dictionary comparison (1 before 11 before 2). Sorting is case insensitive. If several columns are included in the selected region, sorting applies to the left one.
Reverse Sort Columns
Sort the selected columns in decreasing order, using dictionary comparison. Sorting is case insensitive. If several columns are included in the selected region, sorting applies to the left one.
Num Sort Columns
Sort the selected columns in increasing order, using numerical comparison (1 before 2 before 11). If several columns are included in the selected region, sorting applies to the left one.
Reverse Num Sort Columns
Sort the selected columns in decreasing order, using numerical comparison. If several columns are included in the selected region, sorting applies to the left one.
Sort Rows
Sort the selected rows in increasing dictionary order
Reverse Sort Rows
Sort the selected rows in decreasing dictionary order
Num Sort Rows
Sort the selected rows in increasing numerical order
Reverse Num Sort Rows
Sort the selected rows in decreasing numerical order

Columns utilities submenu

Columns Separator
Change the character considered as columns separator. It has to be a SINGLE character. It is by default the tabulation character represented by \t. This menu item allows to do temporary changes (as long as you do not quit Alpha). To change the columns separator permanently go to the Columns Manipulation Preferences.
Show Preferences…
Display the preferences dialog.
Display Bindings
Brings a window with information about the key bindings available when the Columns Manipulation package is active. See below.
Columns Tutorial
Brings a window with a tutorial file.

Key Bindings

All the key bindings use a Ctrl-C (c for columns !) prefix. Hit ⌃C, release, then hit a letter as indicated in the following table:
ctrl-C Aappend columns
ctrl-C Bdisplay bindings info
ctrl-C Ccopy columns
ctrl-C Ddelete columns
ctrl-C Eequalize columns (left justified)
ctrl-C Finsert rows numbers from a given value
ctrl-C Iinsert columns
ctrl-C Mcenter columns (m for middle)
ctrl-C Nnumber rows
ctrl-C Osort columns in increasing order
ctrl-C Pcomplete rows
ctrl-C Rright justify columns
ctrl-C Schange the columns separator
ctrl-C Ttranspose columns and rows
ctrl-C Uunequalize columns
ctrl-C Wtwiddle columns
ctrl-C Xextract columns and copy to the scrap
If you'd like another prefix than C, see the Prefix Binding Char preference.

Preferences

The Text ↣ Columns ↣ Columns Utilities ↣ Show Preferences… item displays a dialog that allows you to set some preferences:

Known problems

Please report any problem or bug you encounter to Alpha's Bug Tracker.

License and Disclaimer

Copyright (c) 2000-2019, Bernard Desgraupes.
All rights reserved.
The Columns Manipulation package is free software and distributed under the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BERNARD DESGRAUPES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.