What is a vertical tab?
Asked Answered
M

10

306

What was the original historical use of the vertical tab character (\v in the C language, ASCII 11)?

Did it ever have a key on a keyboard? How did someone generate it?

Is there any language or system still in use today where the vertical tab character does something interesting and useful?

Madrepore answered 1/8, 2010 at 2:41 Comment(3)
Great explanation here: en.wikipedia.org/wiki/Tab_keySegarra
I've been using it in .vsv files so I don't have to think about how to quote textual data in my fields.Bushtit
If you're considering such a thing for delimiter-separated values like CSV & TSV, take a look at ASCII's four information separator characters, designed for four levels of hierarchy: 0x1c (file separator ^\), 0x1d (group separator ^]), 0x1e (record separator ^^), and 0x1f (unit separator ^_). I think these didn't get better adoption because they're non-printing, but \v (0x0b, ^K) might render as \n\t and be even worse. Vim shows vertical tabs and information separators by their control codes.Demakis
S
279

Vertical tab was used to speed up printer vertical movement. Some printers used special tab belts with various tab spots. This helped align content on forms. VT to header space, fill in header, VT to body area, fill in lines, VT to form footer. Generally it was coded in the program as a character constant. From the keyboard, it would be CTRL-K.

I don't believe anyone would have a reason to use it any more. Most forms are generated in a printer control language like postscript.

@Talvi Wilson noted it used in python '\v'.

print("hello\vworld")

Output:

hello
     world

The above output appears to result in the default vertical size being one line. I have tested with perl "\013" and the same output occurs. This could be used to do line feed without a carriage return on devices with convert linefeed to carriage-return + linefeed.

Silvio answered 1/8, 2010 at 2:50 Comment(11)
It could also be use to scroll the screen quickly. Useful in the days of 300 Baud.Stadtholder
And some data providers like TechData use it in CSV files to replace \n.Lepley
@BillThor: Great, but what was the exact specification of VT? What did it actually do? I assume, based on your description, that it moved the imaginary "cursor" vertically down to the next "vertical tab" position. But did it also return the cursor to the beginning of the line? Or did it keep the X position of the cursor unchanged?Eva
@AnderyT I believe the specification was to advance to the next tab stop down. Any horizontal movement would depend on the device. Line-feed was specified to advance to the next line, some devices would perform a carriage return as well, others would just advance the line and continue printing at the next character position. The stty onlret option provided consistent behavior by adding a carriage return to any line feeds.Silvio
"I don't believe anyone would have a reason to use it any more." - one of the most important protocols in health-care HL7 uses <VT> to signal a starting message :-) Probably because this character will never occure in load-data.Perrotta
@ValentinHeinitz Interesting re-purposing of the <VT>. There are control characters that are meant for that purpose such as <SOH> (start of heading), <SOT> (start of text) and the separator characters <FS>, <GS>, <RS>, and <FS>, all of which may be more obscure than <VT>.Silvio
@Silvio Those control characters are great for storing user entered data since you don't need to worry about escaping characters since there are not valid for the input.Charest
@ArtB: I can enter SOH and some others just fine, e.g. using copy+paste. What next? Forbid copy+paste? I can automatically enter stuff just fine without copy+paste, e.g. using KeePass. Never, never, never, never assume the user is not able to enter something.And
@ArtB: Not wanting to provoke you, but I hope you don't spread such dangerous false wisdom in the company you work for as a tech lead?And
@SebastianMach what is dangerous about it? We only allowed (and validated) alphanumeric, punctuation, and space characters. As such, we knew our user input never contained them. Therefore, when storing data, we were free to use the to limit string to structure the data. Thus we avoided all the problems of having to quote or escape string contents. The code was cleaner and simpler. These characters were intended for such use in binary formats. I haven't used them in over 10 years, but it's still on the table for the right situation. As always, choose carefully, consider everything.Charest
@ArtB: These specs were missing in your previous comment, which read like "if we use those as separators, no further work to ensure input consistency is required". Personally, when it comes to input, I am the whitelist kind of programmer: Everything forbidden, unless explicitly permitted.And
P
78

Microsoft Word uses VT as a line separator in order to distinguish it from the normal new line function, which is used as a paragraph separator.

Playgoer answered 2/8, 2010 at 5:8 Comment(5)
So, this is shift-enter?Ladyfinger
@dan04: Can you please update the link to the Microsoft Wordk KB article?Floorboard
This does also apply to OneNote (and probably every other MS Office Product with Word-like input). And contrary to @PraveenKumar, it does this when hitting Shift+Enter, not Ctrl+Enter. The latter does nothing, at least in my case.Croce
@paulroho in Word, yes, in OneNote, no. I'm afraid that my previous statement about "probably every other MS Office Product with Word-like input" is not correct, as OneNote's input is not really an MS Office integration but rather a lookalike ... nevertheless, my second statement should still be valid: Shift+Enter inserts VT, not Ctrl+Enter (which inserts page break in Word and nothing in OneNote).Croce
In Google Docs/Sheets/Slides/etc., the same thing holds true. The keyboard shortcut is Shift+Enter.Transpicuous
D
23

In the medical industry, VT is used as the start of frame character in the MLLP/LLP/HLLP protocols that are used to frame HL-7 data, which has been a standard for medical exchange since the late 80s and is still in wide use.

Deppy answered 6/4, 2015 at 20:32 Comment(0)
F
17

It was used during the typewriter era to move down a page to the next vertical stop, typically spaced 6 lines apart (much the same way horizontal tabs move along a line by 8 characters).

In modern day settings, the vt is of very little, if any, significance.

Floorboard answered 1/8, 2010 at 3:18 Comment(0)
L
15

The ASCII vertical tab (\x0B)is still used in some databases and file formats as a new line WITHIN a field. For example:

Lothar answered 29/8, 2014 at 9:55 Comment(0)
P
6

I have found that the VT char is used in pptx text boxes at the end of each line shown in the box in oder to adjust the text to the size of the box. It seems to be automatically generated by powerpoint (not introduced by the user) in order to move the text to the next line and fix the complete text block to the text box. In the example below, in the position of §:

"This is a text §
inside a text box"
Padrone answered 7/5, 2015 at 13:8 Comment(0)
L
3

A vertical tab was the opposite of a line feed i.e. it went upwards by one line. It had nothing to do with tab positions. If you want to prove this, try it on an RS232 terminal.

Larina answered 4/3, 2015 at 15:8 Comment(1)
I had hoped to have used the vertical tab in Python to navigate the console screen in Microsoft Windows console. But library msvcrt.putch(b'\v') does not operate so.Reams
M
2

I believe it's still being used, not sure exactly. There might be even a key combination of it.

As English is written Left to Right, Arabic Right to Left, there are languages in world that are also written top to bottom. In that case a vertical tab might be useful same as the horizontal tab is used for English text.

I tried searching, but couldn't find anything useful yet.

Massey answered 20/5, 2013 at 8:19 Comment(1)
I thought of this, but then dismissed it because in vertical languages a normal tab would be semantically appropriate.Sunstone
C
2

Similar to R0byn's experience (answer now hidden), I was experimenting with a Powerpoint slide presentation and dumped out the main body of text on the slide, finding that all the places where one would typically find carriage return (ASCII 13/0x0d/^M) or line feed/new line (ASCII 10/0x0a/^J) characters, it uses vertical tab (ASCII 11/0x0b/^K) instead, presumably for the exact reason that dan04 described above for Word: to serve as a "newline" while staying within the same paragraph. Good question though as I totally thought this character would be as useless as a teletype terminal today.

Chart answered 28/8, 2013 at 5:34 Comment(0)
F
0

I tried this code:

print("hello\vbanana")

on the Python 3.10.11 IDLE and got:

hellobanana

Then, I tried the same code in the command prompt and got:

hello
banana

So in some places, it renders as a weird character and on others it renders exactly like a newline. Note that I ran this on a Windows 11 computer.

Fancyfree answered 18/7, 2023 at 7:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.