[Tex/LaTex] How to make a slanted vertical bar

charactersitalicslanted

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. 🙂

Best Answer

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