The tab
character does not insert spaces. It is a single character that is interpreted by the editor.
The purpose of the tab character is to help writing data in tabular format, i.e. in table format. Since the rows are already provided by the lines of text, the tab
character helps creating columns.
The editors interpret the tab
character as moving the cursor to the right not one position (as it happens with the space
character) but until it reaches the next tabulator stop.
In computer software, the tabulator stops are usually set at each 8 or 4 columns. This means either columns 1
, 9
, 17
a.s.o. or 1
, 5
, 9
, 13
etc. In your picture (and from the description in your question) it seems the "size" of your tab you are using is 4
columns (this is the mostly used value nowadays).
Because the tab
character sends the cursor to a fixed position, its perceived "size" is not fixed, it depends of the cursor column before the tab
character.
In your image, the first column of data has 12 characters (it is displayed on columns 1-12
in the editor). Then, the tab
character sends the cursor to the next tabulator that is on column 17
. The next value (INR0564
, 7
characters) is displayed in columns 17-23
. The next tab
character is "shorter", it covers only 1
column; it sends the cursor to column 25
where is displayed D
. The next one makes the cursor jump to column 29
(3
columns) where nothing is displayed. Then there is another tab
that spans 4
characters until the next tabulator (in column 33
) where the 2.0SEp Salary
value starts.
The columns, the tabulators anb and your data are depicted below:
1 5 9 13 17 21 21 25 29 33 ...
v v v v v v v v v v ...
056665554531 INR0564 D 2.0Sep Salary
. | .|. | |
+-->| >|+->+-->|
In the above drawing, a dot (.
) marks the position of the cursor after each column of data and a pipe (|
) marks its position after the tab
character was displayed. The "arrows" on the last line depict how the cursor jumped over multiple columns because of the tab
characters, to reach the next tabulator.