Tabs in text editors and word processors

Tabs may be mapped to a varying amount of spaces. This is usually a value between 2 and 8 and is straight forward. Sometimes confusion results when tabs and spaces are mixed, how much does the tab 'move' the text over? Answer: no more than the original mapping of spaces to tabs (including the number of spaces). In the examples '.' = space character,    '->'    = tab character. The actual data will be a single star '*' and 1 tab is mapped to 6 spaces (1 tab "pushes over" the text an equivalent of 6 spaces.

Example 1: 1 Tab entered before the start '*'

1 tab

123456789  # These numbers are just used to label the column numbers

    ->*    # Tab 'pushes' the star over by 6 spaces because 1 tab = 6 spaces

 

Example 2: 2 spaces, 1 tab

123456789

..   ->*  

# Tab 'pushes' the star over by 4 spaces because the pair of spaces have already moved the text by 2, the text is supposed to move 6 so 4 space equivalents are needed

 

Example 3: 6 spaces, 1 tab

123456789ABCD

......    ->*

# The first set of spaces are already equivalent to one tab (recall it's a 6:1 ratio). The leading spaces have no effect on the tab because the number of spaces matches the ratio of spaces to tabs. Consequently the tab 'pushes' over the star by the full amount (6 spaces)