Tab key
From Wikipedia, the free encyclopedia
Tab key (abbreviation of tabulator key) on a keyboard is used to advance the cursor to the next tab stop.
Contents |
[edit] Origin
When a typist 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.
[edit] 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, which in ASCII has the decimal character code of 9. A vertical tab also exists and has ASCII decimal character code 11. The EBCDIC code for HT is 5. The VT is 11 or hex 0B, the same as ASCII. The horizontal tab is usually generated by the tab key on a standard keyboard.
Originally printers used mechanical tab stops to indicate where the tabs went. This was done horizontally with movable metal prongs in a row and vertically with a loop of mylar or other tape the length of a page with holes punched in it to indicate the tab stops. Initially these were manually set to match the preprinted forms the printer was going to print. The intention was to have the machine be programmed with other control characters to set and clear the stops but it is unclear if any popular printers implemented this. Instead it was rather quickly replaced with fixed tab stops, at every multiple of 8 characters horizontally and every 6 lines vertically, so they simply became a form of data compression, since a printing program could easily add the necessary spaces to move to any position wanted on a form. The vertical size was chosen to be 1 inch. It is unclear why the 8-character horizontal size was chosen, as 5 characters, half inch in a typical printer at that time, was much more popular at that time as a paragraph indentation. It may have been chosen to match early Fortran conventions for where the statement text started after the line number and continuation character. Or it may have been chosen as the smallest size that would fit numbers typically printed in a table.
ISO 8859 also includes the codes 136 Horizontal Tabulation Set, 137 Horizontal Tabulation with Justification and 138 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.
[edit] Tabs in HTML
HTML represents the horizontal tab as but as with all whitespace characters this does not allow actual insertion of tabs into the page except inside <pre></pre> tags.
Here is an example showing the use of with <pre></pre> tags. If you write in HTML: <source lang="html4strict">
These 2 lines are tabbed: 2005 This line uses a tab space. This line also uses a tab space. This line does not use a tab space.
</source>
The result would be something like this:
These 2 lines are tabbed: 2005 This line uses a Tab space. This line also uses a Tab space. This line does not use a Tab space.
The vertical tab is  but is not allowed in SGML, including HTML and XML 1.0.
The issue is of concern in the use of CSS, which asserts that in an element where white space is to be preserved:
... 2. All tabs (U+0009) are rendered as a horizontal shift that lines up the start edge of the next glyph with the next tab stop. Tab stops occur at points that are mutiples of 8 times the width of a space (U+0020) rendered in the block's font from the block's starting content edge.
[edit] Tabs in programming
In computer programming, the use of tabs for code formatting and indentation is an ongoing debate. The vast majority of code is written as plain ASCII, lacking the extra formatting information more elaborate markups and proprietary file formats provide. Some programmers consider the use of 8 spaces per tab to be excessive, such as when viewing very deeply nested and therefore very deeply indented, lines of code. Programmers who favor wide tabs often point out that deeply indented code is a bad thing in itself.[1][2]
Programmer's editors usually default to having the tab key generate hard tabs, that is actual HT characters but some editors expand them to space (SP) characters instead, often referred to as soft tabs. Most programmer's editors can be configured to perform either.
There are many arguments for and against using hard tabs in code. The most incompatibility and conversion issues ensue when the tab key generates HT characters and the editor is configured for tab stops spaced anything but the de facto standard, which for Unix, Unix-derived systems and older systems is every 8 characters and for Windows programming, every 4 characters. Interesting possibilities include 2 and even 3. When deviating from the system's de facto standard, then inevitably some lines will be formatted with spaces, others with tabs or even both. As soon as the code ends up on someone else's screen it will look different and usually jumbled and untidy if their editor's tabstop width is set differently.
One early benefit of tabs, ie: compression is now considered less relevant as desktop storage has become cheaper and sophisticated compression algorithms can provide much greater benefits, albeit at the cost of greater complexity.
[edit] Notable advocates
[edit] Against
- Linus Torvalds: Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3. (From Documentation/CodingStyle of Linux)
[edit] External links
- Tabs versus Spaces: An Eternal Holy War by Jamie Zawinski
- Why I prefer no tabs in source code by Adam Spiers
- Why I love having tabs in source code
- Elastic tabstops - the solution to the tabs-versus-spaces issue
| Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | PtSc | ScLk | Brk | |||||||||
| <imagemap>
Image:KB United States.svg|450px desc none
rect 0 0 60 30 Tilde rect 60 0 120 30 Exclamation mark rect 120 0 180 30 At sign rect 180 0 240 30 Number sign rect 240 0 300 30 Dollar sign rect 300 0 360 30 Percent sign rect 360 0 420 30 Caret rect 420 0 480 30 Ampersand rect 480 0 540 30 Asterisk rect 540 0 600 30 Bracket rect 600 0 660 30 Bracket rect 660 0 720 30 Underscore rect 720 0 780 30 Plus and minus signs rect 780 0 900 30 Backspace
rect 0 0 60 60 Grave accent rect 60 0 120 60 1 (number) rect 120 0 180 60 2 (number) rect 180 0 240 60 3 (number) rect 240 0 300 60 4 (number) rect 300 0 360 60 5 (number) rect 360 0 420 60 6 (number) rect 420 0 480 60 7 (number) rect 480 0 540 60 8 (number) rect 540 0 600 60 9 (number) rect 600 0 660 60 0 (number) rect 660 0 720 60 Hyphen rect 720 0 780 60 Equals sign rect 780 0 900 60 Backspace
rect 0 61 90 90 Tab key rect 90 61 150 90 Q rect 150 61 210 90 W rect 210 61 270 90 E rect 270 61 330 90 R rect 330 61 390 90 T rect 390 61 450 90 Y rect 450 61 510 90 U rect 510 61 570 90 I rect 570 61 630 90 O rect 630 61 690 90 P rect 690 61 750 90 Bracket rect 750 61 810 90 Bracket rect 810 61 900 90 Vertical bar
rect 0 61 90 120 Tab key rect 90 61 150 120 Q rect 150 61 210 120 W rect 210 61 270 120 E rect 270 61 330 120 R rect 330 61 390 120 T rect 390 61 450 120 Y rect 450 61 510 120 U rect 510 61 570 120 I rect 570 61 630 120 O rect 630 61 690 120 P rect 690 61 750 120 Bracket rect 750 61 810 120 Bracket rect 810 61 900 120 Backslash
rect 0 121 105 150 Caps lock rect 105 121 165 150 A rect 165 121 225 150 S rect 225 121 285 150 D rect 285 121 345 150 F rect 345 121 405 150 G rect 405 121 465 150 H rect 465 121 525 150 J rect 525 121 585 150 K rect 585 121 645 150 L rect 645 121 705 150 Colon (punctuation) rect 705 121 765 150 Quotation mark rect 765 121 900 150 Enter key
rect 0 121 105 180 Caps lock rect 105 121 165 180 A rect 165 121 225 180 S rect 225 121 285 180 D rect 285 121 345 180 F rect 345 121 405 180 G rect 405 121 465 180 H rect 465 121 525 180 J rect 525 121 585 180 K rect 585 121 645 180 L rect 645 121 705 180 Semicolon rect 705 121 765 180 Apostrophe rect 765 121 900 180 Enter key
rect 0 181 135 210 Shift key rect 135 181 195 210 Z rect 195 181 255 210 X rect 255 181 315 210 C rect 315 181 375 210 V rect 375 181 435 210 B rect 435 181 495 210 N rect 495 181 555 210 M rect 555 181 615 210 Bracket rect 615 181 675 210 Bracket rect 675 181 735 210 Question mark rect 735 181 900 210 Shift key
rect 0 181 135 240 Shift key rect 135 181 195 240 Z rect 195 181 255 240 X rect 255 181 315 240 C rect 315 181 375 240 V rect 375 181 435 240 B rect 435 181 495 240 N rect 495 181 555 240 M rect 555 181 615 240 Comma (punctuation) rect 615 181 675 240 Full stop rect 675 181 735 240 Slash (punctuation) rect 735 181 900 240 Shift key
rect 0 241 90 300 Control key rect 90 241 150 300 Windows key rect 150 241 240 300 Alt key rect 240 241 600 300 Space bar rect 600 241 690 300 AltGr key rect 690 241 750 300 Windows key rect 750 241 810 300 Menu key rect 810 241 900 300 Control key </imagemap> | Ins | Home | PgUp | Num | / | * | - | |||||||||||||||||
| Del | End | PgDn | 7 | 8 | 9 | + | ||||||||||||||||||
| 4 | 5 | 6 | ||||||||||||||||||||||
| ↑ | 1 | 2 | 3 | Ent | ||||||||||||||||||||
| ← | ↓ | → | 0 | . | ||||||||||||||||||||
Keyboard keys | |
|---|---|
| Dead keys | Compose |
| Modifier keys | Control · Shift · Alt/Option (Apple) · AltGr · Command/Meta (Apple/MIT/Sun keyboards) · Windows/Super · Fn (compact keyboards) |
| Lock keys | Scroll lock · Num lock · Caps lock |
| Navigation | Arrow · Page Up/Page Down · Home/End |
| Editing | Return/Enter · Backspace · Insert · Delete · Tab · Space bar |
| Misc. | System request/Print screen · Break/Pause · Escape · Menu · Numeric keypad · Function · Power management (Power, Sleep, Wake) · Language input · Any key |
de:Tabulator fr:Touche tabulation ja:タブ nl:Tab pl:Tab (klawisz) ru:Табуляция sl:Tabulator uk:Табуляція

