2

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. :)

2
  • Use T1 font encoding to get the vertical bar in text mode: \usepackage[T1]{fontenc}.
    – Stefan Kottwitz
    Feb 2, 2012 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. Feb 2, 2012 at 18:36

1 Answer 1

3

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

1
  • 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! Feb 2, 2012 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .