Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm stumped on this. I would like to make a slanted (and italic) vertical bar in the middle of some regular text.

If I use $|$, it comes out literally vertical regardless of style, since it's a math operator.

For reasons I don't understand, | is accepted by TeX but comes out as an em-dash rather than a vertical bar.

Using \char124 works fine for the typewriter font, but I need this for Computer Modern Roman Slant & Italic.

I only need this so that I can see the exact slope of slanted and italic text visually; it's temporary for lining some things up. I can get by for now with [ and ]—which do display correctly in slanted and italic shapes—but now I've become very curious about how to make the vertical bar work, because I don't like it when I don't understand things. :)

share|improve this question
    
Use T1 font encoding to get the vertical bar in text mode: \usepackage[T1]{fontenc}. –  Stefan Kottwitz Feb 2 '12 at 18:36
    
\usepackage[T1]{fontenc} allows you to use | in normal text, and \textit{|} allows you to see the slanted version. However if you are visually lining things up, you should think again. There are better way to do that. –  Peter Grill Feb 2 '12 at 18:36
add comment

1 Answer

up vote 3 down vote accepted

Use T1 font encoding for that, as the default OT1 encoding doesn't support the vertical bar in text mode:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
\textit{Text | Text}

\textsl{Text | Text}
\end{document}

italic and slanted vertical bar

share|improve this answer
    
Aha!! I thought I had that working at one point long ago. I was beginning to wonder if I'd gone insane. This is the problem (for me) with constructing new macros inside a simplified environment instead of inside the normal templates I use. Thanks, Stefan! –  Todd Lehman Feb 2 '12 at 19:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.