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

font-encodingssymbols

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

I have tried this sample with pdflatex tmp.tex

\documentclass{extarticle}
\begin{document}
\textpipe
\end{document}

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
(./tmp.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/extsizes/extarticle.cls
Document Class: extarticle 1996/10/08 v1.0 Non Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)
(/usr/share/texmf-texlive/tex/latex/base/exscale.sty))
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:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
Pipe sign: |
\end{document}

Output:

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