The vertical bar

WinDerek
1 min readSep 1, 2018

--

When I want to type a vertical bar in LaTeX, I found that I could not find a proper command to display it. Then I realized the problem was not so simple.

What is a vertical bar

The following definition was copied and pasted from Vertical bar — Wikipedia.

The vertical bar(|) is a computer character and glyph with various uses in mathematics, computing, and typography. It has many names, often related to particular meanings: Sheffer stroke(in logic), verti-bar, vbar, stick, vertical line, vertical slash, bar, obelisk, pike, or pipe, and several variants on these names. It is occasionally considered an allograph of broken bar.

How to use it in LaTeX

In LaTeX, the vertical bar can be used as delimiter in mathematical mode. The sequence \| creates a double vertical line(a | b \| c is set as abc). This has different spacing from \mid and \parallel, which are relational operators: a \mid b \parallel c is set as abc. In LaTeX text mode, the vertical bar produces an em dash(—). The \textbar command can be used to produce a vertical bar.

A tip

If you use \textbar LaTeX text mode, then you may find there is no space between the vertical bar and the following content, like |following. In this situation, just add a pair of curly brackets to solve this problem: \textbar{} following.

References

--

--

WinDerek
WinDerek

Written by WinDerek

Advanced Mobile Development@Alipay of Ant Group. CS@ShanghaiTech University. Software Engineering@Tongji University.

No responses yet