The vertical bar

Dick Derek
Sep 1, 2018 · 1 min read

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

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade