Tab-Indented List Tutorial
Tab-Indented List Basics
A Tab-Indented List is a list that uses tab-stop indentations to display list hierarchy. It is a method of showing a 'parent > child' hierarchy that can easily be understood by human and by machine. A list may contain multiple levels of hierarchy. Each additional level is represented by one additional tab-stop. The image below shows a simple tab-indented list with the characters that are normally hidden or invisible (such tabs, spaces, and carriage-returns) on show to make the list easier to understand. TAB is indicated by the little '>>' symbol. SPACE is indicated by a dot or period. CARRIAGE RETURN/LINE FEED is indicated by a backwards-P at the end of each line. (Its called a 'Pilcrow'.)
The parent word 'Mammal' has a child word 'Pets'. We can see that 'Pets' is a child of 'Mammal' because it is indented to the right by one tab more than 'Mammal'. The word 'Pets' also has two lower levels of hierarchy that contain its child 'Dog', and its grandchild 'Fox Terrier'. The word 'Fox Terrier' is therefore a great-grandchild of 'Mammal'. This hierarchy can also be represented as 'Mammal > Pets > Dog > Fox Terrier'.
The parent word 'Mammal' has three more children: 'Primate', 'Rodent', and 'Tapirs'. We can see that this is the case as they are all on the same level of indentation as 'Pets'. The fact that 'Pets' has some extra entries below it before the word 'Primate' is encountered doesn't stop 'Primate' from being a child of 'Mammal'. The same rule equally applies to 'Rodent', and 'Tapirs'.
To find the parent of any word in the list, simply look to the left, and then follow the lines up until a word is encountered. This will be the word's parent. Move one step more to the left and follow the lines up to find the grand-parent, and so on. Try that for the entry 'Lowland Tapir', and you should see that its hierarchy can be represented as 'Mammal > Tapirs > Lowland Tapir'.
Adding Tab Indents to a Tab-Indented List
Sometimes we need to change the indentations of a Tab-Indented List on a global level, adding a tab to each line to indent it one more tab-stop to the right, or removing a tab on each line to re-position the list one more tab-stop to the left.
An example of this is when we wish to add an additional list, such as one of my many free Specialist Lists, to your copy of the Hierarchical Image Keyword Catalog. The Hierarchical Image Keyword Catalog has a special section provided for you to add your own data, called '[7 - SPECIALIST]'. You can see this at the bottom of the list on the 'Categories' page. To add an additional list below the 'SPECIALIST' category, you will need to add one extra indentation before appending it.
The quickest and most accurate way to do this is to use your Text Editor program's 'Search and Replace' tool. As before, my suggestion for a suitable Text Editor program is 'PSPad'. Its free to download and use, (though they do ask for a donation), and is just the thing when working with Tab-Indented Lists.
NB: When you start PSPad for the first time, click 'Settings > Program Settings > Editor (part 2)'. You should then check the box marked 'Real Tabs', and set the 'Tab Width' to 6 or more. I'd also recommend that you click 'Format > Font' and choose a fixed-width font, like Courier New.
As an example, lets say you want to add my 'Reptiles of the World' list to your copy of the Lightroom Keyword List. If we open the list of reptiles in PSPad, the first few lines will look like this:
However, to position all entries to act as children of the category '[7 - SPECIALIST]' we need to indent them to the right by one tab-stop, so that the list looks like this:
With a small list, it is easy just to type an extra tab-stop by hand, but for a list with many thousands of lines, this would take a long time. The 'Search and Replace' function of PSPad is easy to use, once you know how.
- Start the PSPad program and click 'File > Open' to open the list you wish to append to your main list.
- Click 'Search > Replace' or 'Control + H' to open the 'Replace' window.
- Click the '?' to the right of the 'Find' box, and choose 'start of line'. A caret '^' symbol will be added to the 'Find' box.
- Click the '?' to the right of the 'Replace' box, and choose 'tab'. The characters '\t' will be added to the 'Replace' box.
- Notice how the 'Regular Expressions' option has checked itself. Leave it like that, and make sure that 'Entire Scope' is chosen for the 'Direction' choice.
- Click 'OK' and each line in the entire list will have an extra tab added to the left of the line.
The image below shows PSPad's 'Replace' window as it looks with the settings needed to add an extra tab-stop.
Removing Tab Indents from a Tab-Indented List
Removing a complete column of tab-indentations from a Tab-Indented List is just as easy as adding them if you are using a text-editor such as 'PSPad'. In this example, we will use its 'Search and Replace' tool to do the task automatically. Here's how:
- Start the PSPad program and click 'File > Open' to open the list you wish to adjust.
- Click 'Search > Replace' or 'Control + H' to open the 'Replace' window.
- Click the '?' to the right of the 'Find' box, and choose 'start of line'. A caret '^' symbol will be added to the 'Find' box.
- Click the same '?' a second time, and choose 'tab'. The characters '\t' will be added after the caret.
- The 'Replace' box should be left empty. It is programer's logic that explains this: We wish to replace a tab with nothing, i.e. we wish to delete it.
- Notice how the 'Regular Expressions' option has checked itself. Leave it like that, and make sure that 'Entire Scope' is chosen for the 'Direction' choice.
- Click 'OK' and each line in the entire list will have its left-most column of tabs deleted.
Advanced Indent Management
A text-editor is fine to start with, but what happens if you want to manage indents automatically? You might like to be able to cut, copy, or paste and get the correct indents added or removed without you having to think about it as well. You might also want to sort your list, spot errors, identify duplicates, search and replace, visualize the list, and other functions? Surprisingly, there are remarkably few programs designed to work with tab-indented lists. I used to create my own tools to build my own lists, as there was nothing else that did what I needed. Eventually I put all of the tools together, added a raft of new features, and now sell the program from this website - see my Tab-List Tools page.