[Tex/LaTex] How to put vertical line among the words

linevertical

I want to put a vertical line among some words in order to separate them, for example I want this:

Website | Email | Address

But I cannot produce these vertical line perfectly. What should I do? (I do not want to use tabular environment)

Best Answer

Note that | does not work with default OT1 font encoding (it comes out as an em dash). Comment out my \usepackage[T1]{fontenc}, recompile, and see.

The most versatile would be \mybar, which you define as a \rule of specified dimensions in the preamble.

The math versions include \vert, |, and \mid.

Lastly, variants can be applied to \vert and | in the form of \big, \bigg, \Big, and \Bigg; however, this will mess up line spacing when used inline.

\documentclass{article}
\usepackage[T1]{fontenc}
\newcommand\mybar{\kern1pt\rule[-\dp\strutbox]{.8pt}{\baselineskip}\kern1pt}
\begin{document}
Website%
$\vert$Email%
$\mid$Email%
$|$Email%
\mybar Email%
|Email
\end{document}

enter image description here

For comparison, here is using a few "big" variants, as well as OT1 encoding.

\documentclass{article}
%\usepackage[T1]{fontenc}
\newcommand\mybar{\kern1pt\rule[-\dp\strutbox]{1pt}{\baselineskip}\kern1pt}
\begin{document}
Website%
$\bigg\vert$Email%
$\mid$Email%
$\Big|$Email%
\mybar Email%
|Email
\end{document}

enter image description here