[Tex/LaTex] How to insert pipe symbol in (La)TeX


How to insert pipe symbol | in TeX (LaTeX)?

I have tried this sample with pdflatex tmp.tex


And it give undefined control sequence error

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
Document Class: extarticle 1996/10/08 v1.0 Non Standard LaTeX document class
No file tmp.aux.
! Undefined control sequence.
l.3 \textpipe

Best Answer

The pipe symbol may be used directly in the input and will produce the desired output if you use T1 font encoding. For example:

Pipe sign: |


enter image description here

Compare these tables to see the difference between the two font encodings: OT1 (Standard encoding) vs. T1 (Cork encoding). The OT1 table doesn't contain the pipe symbol, but it can be found in the T1 table. It's position is 7C. With OT1 7C means a wide dash, that's why we get a wide dash instead of the pipe symbol in standard encoding.

See Special LaTeX characters for some more information.

For using the command \textpipe loading a package like tipa or t4phonet is necessary.

Related Question