Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Tab key
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Tab characters == The most known and common tab is a ''horizontal tabulation'' (HT) or ''character tabulation'', which in [[ASCII]] has the decimal character code of 9, and may be referred to as {{key press|Ctrl|I}} or {{mono|^I}}. In [[C (programming language)|C]] and many other [[programming language]]s the [[escape sequence]] {{code|\t}} can be used to put this character into a [[string literal]]. The horizontal tab is usually inserted when the Tab key on a standard keyboard is pressed. A ''vertical tabulation'' (VT) also exists and has ASCII decimal character code 11 ({{key press|Ctrl|K}} or {{mono|^K}}), escape character {{code|\v}}. In [[EBCDIC]] the code for HT is 5. VT is 11 (coincidentally the same as in ASCII). 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 [[carriage control tape|loop of mylar or other tape the length of a page with holes punched in it]] to indicate the tab stops. These were manually set to match the pre-printed forms that were loaded into the printer. In practice, settable tab stops were rather quickly replaced with fixed tab stops, ''de facto'' standardized at every multiple of eight characters horizontally, and every six lines vertically. A printing program could send zero or more tabs to get to the closest tab stop above and left of where it wanted to print, then send line feeds and spaces to get to the final location. Tab characters simply became a form of data compression. Despite the fact that five characters were the typical paragraph indentation on typewriters at that time, the horizontal tab size of eight evolved because as a power of two it was easier to calculate with the limited digital electronics available.{{citation needed|date=December 2023}} Using this size tab to indent code results in much white space on the left, so most text editors for code, such as [[integrated development environment|IDE]]s, allow the size of the tab to be changed, and some (in particular on Windows) default to four instead of eight. Disagreements between programmers about [[indentation style|what size tabs are correct]], and whether to use tabs at all, are common.<ref>{{Cite web|title=Tabs versus Spaces|url=https://www.jwz.org/doc/tabs-vs-spaces.html|access-date=2020-06-02|website=www.jwz.org}}</ref> Modern text editors usually have the Tab key insert the user-defined indentation and may use heuristics to adapt this behavior to existing files. [[ISO 6429]] includes the codes 136 (Horizontal Tabulation Set), 137 (Horizontal Tabulation with Justification) and 138 (Vertical Tabulation Set) that were intended to allow the program to set and clear tab stops.{{dubious|editor's confusion about HTS|date=April 2024}} This is rarely used or supported. === Tab-separated values === [[Tab-separated values]] (TSV) are used 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. For example, in Microsoft Word 2010, Insert > Table > Convert Text to Table... is the necessary command, producing a dialog where the user selects further details. The TSV convention for exporting data may be compared to the alternative [[comma-separated values]] (CSV) convention (that may be using semicolons instead of commas), and both are easily converted into each other. [[Gopher (protocol)|Gopher menus]] use tab-separated values to indicate selectors. TSV has also been cited in a modern approach to solving the programming debate regarding the use of tabs and spaces for code alignment called [[elastic tabstops]].<ref>{{cite web|url=http://nickgravgaard.com/elastic-tabstops/|title=Elastic tabstops - a better way to indent and align code|first=Nick|last=Gravgaard|website=nickgravgaard.com|access-date=23 March 2018}}</ref> This idea uses a scheme called tab-separated columns (TSC) rather than the similar tab-separated values (TSV). === HTML === In [[HTML]] the horizontal tab is coded using {{code|	}} or {{code|	}}<ref>See [[Character encodings in HTML#HTML character references]]</ref><ref name="W3CCharacterRef">{{cite web|url=http://dev.w3.org/html5/html-author/charref|title=Character Entity Reference Chart|website=dev.w3.org|access-date=23 March 2018}}</ref> but as with all whitespace characters in HTML, this will be displayed as a single space except inside {{tag|pre|open}}, {{tag|code|open}} tags (or other elements with [[Cascading Style Sheets|CSS]] attribute {{code|white-space}} set to {{code|pre}}). Here is an example: <blockquote> ;HTML: <syntaxhighlight lang="html"> 	This line begins with a single tab. Here	are	some	more	tab	characters	! T.......T.......T.......T.......T.......T.......T.......T </syntaxhighlight> ;Inside {{tag|pre|open}}: <pre> 	This line begins with a single tab. Here	are	some	more	tab	characters	! T.......T.......T.......T.......T.......T.......T.......T </pre> ;Outside {{tag|pre|open}}: <div style="font-family: monospace, monospace;"> 	This line begins with a single tab. Here	are	some	more	tab	characters	! T.......T.......T.......T.......T.......T.......T.......T </div></blockquote> Notice that the tab at the start of a line is removed outside {{tag|pre|open}}, the eight-character spacing, and how a tab stop is skipped if there are more than eight characters since last one. CSS3 defines {{code|tab-size}} property, which adjusts the number of spaces for the tab character from the default of eight.<ref>{{cite web|url=http://dev.w3.org/csswg/css3-text/#tab-size-property|title=CSS 3 tab-size property W3 specification}}</ref> The latest version of [[WebKit]] supports the {{code|tab-size}} property. The [[Opera (web browser)|Opera]] web browser supports the {{code|-o-tab-size}} CSS property, the [[Firefox]] web browser supports the {{code|-moz-tab-size}} CSS property with the same meaning.<ref>{{cite web|url=https://developer.mozilla.org/en-US/docs/CSS/tab-size|title=CSS tab-size property on Mozilla Developer Network|date=21 February 2023 }}</ref> The vertical tab is {{code|}} but is not allowed in [[SGML]]{{Citation needed|date=March 2013}}; this includes [[XML]] 1.0<ref>{{cite web|title=Extensible Markup Language (XML) 1.0|edition=5th|publisher=[[W3C]]|date=26 November 2008|url=https://www.w3.org/TR/xml/#charsets|at=sec. "Charsets"}}</ref> and HTML. === Unicode === The [[Unicode]] code points for the (horizontal) tab character, and the more rarely used vertical tab character are copied from [[ASCII]]:<ref>{{cite web| title = C0 Controls and Basic Latin | url = https://www.unicode.org/charts/PDF/U0000.pdf| access-date = 2013-12-13}}</ref> * <big>{{unichar|0009|CHARACTER TABULATION}}</big> (CHARACTER TABULATION, horizontal tabulation (HT), tab) * <big>{{unichar|000B|LINE TABULATION}}</big> (LINE TABULATION, vertical tabulation (VT)) The tab characters can be graphically represented by [[Control Pictures|special symbols]]: * <big>{{unichar|2409|SYMBOL FOR HORIZONTAL TABULATION}}</big> * <big>{{unichar|240B|SYMBOL FOR VERTICAL TABULATION}}</big> Unicode also has characters for the symbols to represent or be printed on the tab key:<ref name="Unicode Arrows">{{cite web| title = Arrows β Unicode| url = https://www.unicode.org/charts/PDF/U2190.pdf| access-date = 2013-12-13}}</ref> * <big>{{unichar|21B9|LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR}}</big> (tab with shift tab) * <big>{{unichar|21C6|LEFTWARDS ARROW OVER RIGHTWARDS ARROW}}</big> * <big>{{unichar|21E4|LEFTWARDS ARROW TO BAR}}</big> (leftward tab) * <big>{{unichar|21E5|RIGHTWARDS ARROW TO BAR}}</big> (rightward tab) Unicode provides additional characters for tab symbols with triangle-headed arrow:<ref name="Unicode Miscellaneous Symbols and Arrows">{{cite web| title = Miscellaneous Symbols and Arrows β Unicode| url = https://www.unicode.org/charts/PDF/U2B00.pdf| access-date = 2023-08-31}}</ref> * <big>{{unichar|2B70|LEFTWARDS TRIANGLE-HEADED ARROW TO BAR}}</big> (left tab) * <big>{{unichar|2B71|UPWARDS TRIANGLE-HEADED ARROW TO BAR}}</big> (up tab) * <big>{{unichar|2B72|RIGHTWARDS TRIANGLE-HEADED ARROW TO BAR}}</big> (right tab) * <big>{{unichar|2B73|DOWNWARDS TRIANGLE-HEADED ARROW TO BAR}}</big> (down tab) * <big>{{unichar|2B7E|HORIZONTAL TAB KEY}}</big> * <big>{{unichar|2B7F|VERTICAL TAB KEY}}</big>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)