Fixing run-on columns

From DPWiki
Jump to: navigation, search

Does this sound familiar?

 sorry, but the columns on page 254 are run
 together and I don't know how to split them
 up without massive re-typing.

DPWiki offers, for general educational purposes, the following technique as being much less onerous than the massive re-typing you were contemplating. This doesn't mean you have to do this page, though, if you don't want to. :)

When we start, we have text from column A and text from column B on each line, just like in the printed image.

AAAA1 BBBB1
AAAA2 BBBB2
AAAA3 BBBB3

We want to transform this to the text from column A followed by the text of column B with the minimum amount of effort. That is, we want to produce

AAAA1
AAAA2
AAAA3
BBBB1
BBBB2
BBBB3

Here's one way to do this fairly quickly.

First thing we do is copy all of the text and paste the copy below the original:

AAAA1 BBBB1
AAAA2 BBBB2
AAAA3 BBBB3
AAAA1 BBBB1
AAAA2 BBBB2
AAAA3 BBBB3

Now delete the column B text from the first half, line by line...

AAAA1
AAAA2
AAAA3
AAAA1 BBBB1
AAAA2 BBBB2
AAAA3 BBBB3

and then delete the column A text from the second half, line by line.

AAAA1
AAAA2
AAAA3
BBBB1
BBBB2
BBBB3

Done!

This might still be a non-trivial amount of work, but can be done considerably faster than, say, cutting and pasting the B text line by line, or deleting it and retyping it (yuck!). It uses only the same few keys (arrows or mouse and delete or backspace) over and over, and there's less risk of accidentally introducing new typos.

Of course, if you feel more comfortable using your own method, e.g.: Pressing "Enter" at the beginning of each of the right columns, then marking the line, and moving it to the end of the page -- repeating this process down the lines as you proof them -- Feel free to use it!

Mac OS X Keyboard Shortcut

If you are editing on a Mac in an application that uses the standard text editing GUI, you can place the cursor somewhere on the line and press SHIFT+CMD+RIGHT ARROW, or SHIFT+CTRL+e to select the rest of the text on that line then DELETE. It works the other way too, just use SHIFT+CMD+LEFT ARROW or SHIFT+CTRL+a instead.

The CMD-RIGHT/LEFT ARROW are cursor movement keyboard shortcuts inherited from 'classic' Mac OS, and the CTRL-a/e cursor movement come from Mac OS X's NeXTSTEP heritage, and was inspired by the Emacs text editor. The SHIFT key turns the cursor movement into a 'select-from-current-point-to-wherever you were going to move to. Further standard keyboard shortcuts can be found here

At least since Mac OS X 10.4, you can select rectangular areas (still might not work exactly the way you wish, but it's pretty cool!) by holding down the Option key and then click-drag over the area. Edit this post to see how it might work ;)

Or, use a smarter editor...

You can also copy the text out to an external editor that's a little bit smarter.

Many word processing and programming programs offer "block select". (For instance: Microsoft Word, Visual Studio, Textpad, Notepad++). Press and hold the Alt key, then click and drag a selection. You should see a rectangle of text selected. You can then use the usual copy/paste shortcut keys (Ctrl/Cmd X, C, V) to move the selection.

Alternately, if you use Emacs, you could move your cursor to the beginning of the second column (first B on line 1), press Ctrl-Space to set the mark, move your cursor to the end of the second column (last 3 on line 3), and press C-x r k (that's Ctrl-x followed by r followed by k) to KILL the rectangle. Now move the cursor down to a blank line, and type C-x r y (that's Ctrl-x followed by r followed by y) to YANK the rectangle. Tada, separated columns!