Tab
|
This article is about the use of the term Tab in computing. For other uses, see Tab (disambiguation).
Contents |
Typewriters
When a typist (or typewriter as they were known in the early days) wanted to type a table, there was a lot of time consuming and repetitive use of the space bar and backspace key. To simplify this a bar was placed in the mechanism with a moveable lever for every position across the page. Initially these were set by hand, but later a "tab set" and "tab clear" keys were added. When the tab key was depressed the carriage advanced to the next "tab stop". These were set to correspond to the particular column locations of the table (hence "tab") being worked on. The tab mechanism also came into its own as a rapid and consistent way of uniformly indenting the first line of each paragraph.
ASCII and EBCDIC
Several tab characters are included as ASCII control characters, used for text alignment. The most known and common tab is a horizontal tab (HT), which in ASCII has the decimal character code of 9. There is also a vertical tab (VT) which in ASCII has decimal character code 11. (The EBCDIC code for HT is 5. The VT is 11 or Hex B the same as ASCII.) The horizontal tab is usually generated by the tab key on a standard keyboard. The horizontal tab was often used as a form of data compression; file sizes could be reduced by using a single horizontal tab character in place of up to eight space characters.
ISO 8859 also includes the codes 136 HTS Horizontal Tabulation Set, 137 HTJ Horizontal Tabulation with Justification and 138 VTS Vertical Tabulation Set.
Tabs are almost always rendered as a form of whitespace larger than a single space, while some text editors mark tabs with special graphics to facilitate distinguishing tabs and whitespaces. In word processor applications, the tab key typically moves the cursor to the next tab stop. In most other graphical applications, the tab key will shift the focus to the next control or widget.
A UNIX program, expand
expands a tab to a number of spaces and unexpand
does the opposite.
Text divided into fields delimited by tabs can be pasted into a word processor and formatted into a table with a single command.
Tabs in HTML
HTML represents the horizontal tab as 	 . The vertical tab is  but is not allowed in SGML, XML and including HTML.
Tabs in programming
In computer programming, the use of tabs for code formatting and indentation is an ongoing debate. Programmers are generally divided into two camps - those who use hard tabs in their code, and those who configure their editors to insert actual space characters when they press the tab key. When tabs are replaced to spaces in this way they are referred to as soft tabs.
There are many arguments for and against using hard tabs in code. What can be said without doubt is that one early benefit of tabs, i.e. compression (see above), is now less relevant as storage is so cheap, and sophisticated compression algorithms can provide much greater benefits.
External links
- Tabs versus Spaces:An Eternal Holy War by Jamie Zawinski (http://www.jwz.org/doc/tabs-vs-spaces.html)
- Why I prefer no tabs in source code by Adam Spiers (http://adamspiers.org/computing/why_no_tabs.html)
- Why I love having tabs in source code (http://www.derkarl.org/why_to_tabs.html)