GeneralHelp adding a vertical line '|'

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
absvalue
Posts: 2
Joined: Thu Sep 17, 2009 12:57 am

Help adding a vertical line '|'

Post by absvalue »

Hello,

I'm trying to add a vertical line to my file in TeXnicCenter, but when I build the file it gets interpreted as a long dash. Does anyone know a way around this? Is there an escape character I could use?

Thanks,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Help adding a vertical line '|'

Post by Stefan Kottwitz »

Hi,

what code do you use? You could use \rule to get a vertical line.

Stefan
LaTeX.org admin
absvalue
Posts: 2
Joined: Thu Sep 17, 2009 12:57 am

Re: Help adding a vertical line '|'

Post by absvalue »

Basically, I'm trying to say:

If a|b and a|c ...

But, in place of |, I'm getting a long dash. I just tried \rule, but it doesn't display anything. Am I doing something wrong?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Help adding a vertical line '|'

Post by Stefan Kottwitz »

Use inline math mode:

Code: Select all

If $a|b$ and $a|c$ ...
Stefan
LaTeX.org admin
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Re: Help adding a vertical line '|'

Post by lalop »

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Help adding a vertical line '|'

Post by frabjous »

You might also use either \textbar or $\vert$. (The latter is a little thicker.)
Last edited by cgnieder on Tue Feb 19, 2013 9:28 pm, edited 1 time in total.
edmundocayo
Posts: 1
Joined: Tue Feb 19, 2013 7:55 pm

Help adding a vertical line '|'

Post by edmundocayo »

frabjous wrote:You might also use either \textbar or $\vert$. (The latter is a little thicker.)
Thank you frabjous, I was having the same issue, thanks to you I've solved it! :D
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Help adding a vertical line '|'

Post by Stefan Kottwitz »

That's a problem with the standard OT1 encoding and that character. Simply switch to T1 encoding and you can directly use that symbol. See:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
Vertical line: |
\end{document}
Stefan
LaTeX.org admin
Post Reply