World Library  
Flag as Inappropriate
Email this Article

Tab character

Article Id: WHEBN0003080045
Reproduction Date:

Title: Tab character  
Author: World Heritage Encyclopedia
Language: English
Subject: Whitespace (programming language), Tab, Java syntax
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Tab character

Tab key (abbreviation of tabulator key[1] or tabular key[2]) on a keyboard is used to advance the cursor to the next tab stop.

The word tab derives from the word tabulate, which means "to arrange data in a tabular, or table, form." When a person wanted to type a table (of numbers or text) on a typewriter, there was a lot of time-consuming and repetitive use of the space bar and backspace key. To simplify this, a horizontal bar was placed in the mechanism with a moveable lever stop for every position across the page. Initially these were set by hand, but later 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.

In many programming languages the escape code \t can be used to insert a tab character.

Usage

In word processor applications, the Tab key typically moves the cursor to the next tab stop, and inserts an ASCII tab character. When filling out a computerized form, pressing Tab will move the cursor to the next field (and Shift-Tab will move the cursor to the previous field), eliminating the need to use a mouse to click in an adjacent field. In most other graphical applications, the Tab key will shift the focus to the next control or widget. Tab may be used to complete a partially-typed piece of text. For example, in some command-line interfaces, you may type the first few characters of a command or filename, then press Tab. If there is no ambiguity about your intent, the rest of the characters will appear automatically.

Tab characters

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, and may be referred to as control+I or ^I. A vertical tab (VT) also exists and has ASCII decimal character code 11 (control+K or ^K). In EBCDIC the code for HT is 5, and VT is 11 (the same as in ASCII). The horizontal tab is usually generated by the Tab key on a standard keyboard.

Originally, printer mechanisms 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 up to match the preprinted forms that were loaded into the printer. Later, the intention was to have the machine be pre-programmed, by using other control characters to set and clear the stops: ISO 6429 includes the codes 136 (Horizontal Tabulation Set), 137 (Horizontal Tabulation with Justification) and 138 (Vertical Tabulation Set).

In practice, settable tab stops were rather quickly replaced with fixed tab stops, de facto standardized at every multiple of 8 characters horizontally, and every 6 lines vertically (typically one inch vertically). A printing program could easily send the necessary spaces or line feeds to move to any position wanted on a form, and this was far more reliable than the modal and non-standard methods of setting tab stops. Tab characters simply became a form of data compression.

A common horizontal tab size of eight characters evolved, despite five characters being half an inch and the typical paragraph indentation of the time, because as a power of two it was easier to calculate in binary for the limited digital electronics available.

Tab-separated values (TSV)

Tab-separated values (TSV) are a common de facto standard for exporting and importing database or spreadsheet field values. Text divided into fields delimited by tabs can often be pasted into a word processor and formatted into a table with a single command.[further explanation needed]

The TSV convention for exporting data may be compared to the alternative comma-separated values (CSV) convention.

Gopher menus use tab-separated values to indicate selectors.

Tabs in HTML

HTML represents the horizontal tab as [3] but as with all whitespace characters this does not allow actual insertion of tabs into the page except inside

 tags or elements with CSS attribute white-space set to pre.

Here is an example showing the use of in HTML using

 tags:

These 2 lines are tabbed:
2009	This line uses a tab.
	This line also uses a tab.
This line does not use a tab.

The result would be something like this:

These 2 lines are tabbed:
2009	This line uses a tab.
	This line also uses a tab.
This line does not use a tab.

The vertical tab is but is not allowed in SGML, including HTML and XML 1.0.

CSS

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 multiples of 8 times the width of a space (U+0020) rendered in the block's font from the block's starting content edge.

CSS 3 defines tab-size property, which adjusts the default number of spaces for the tab character.[4] The latest version of WebKit supports it. The Opera web browser supports the -o-tab-size CSS property, the Firefox web browser supports the -moz-tab-size CSS property with the same meaning.[5]

JavaScript

In Javascript, tabs can be represented using escape characters as in \t or \x09.[6]

Unicode

Unicode characters that represent the tab key (as symbols) include:[7]

  • U+21B9 leftwards arrow to bar over rightwards arrow to bar ("tab with shift tab")
  • U+21C6 leftwards arrow over rightwards arrow
  • U+21E4 leftwards arrow to bar ("leftward tab")
  • U+21E5 rightwards arrow to bar ("rightward tab")

See also

References

External links

  • by Jamie Zawinski
  • by Adam Spiers
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 



Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.