I want a vertical bar but in mathematical mode it appears too big. I just want a small | at the same height as the letters.

  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Heiko Oberdiek May 1 '14 at 22:02
  • Welcome to TeX.SX! You seem to be asking two unrelated questions, here. On TeX.SX, we try to keep unrelated questions on separate pages. If you have multiple questions that are unrelated to one another, you should ask each in a separate TeX.SX "question". You'll stand a better chance of getting a satisfactory answer to each of your questions. – jub0bs May 1 '14 at 22:06
  • The answer to your question about listings is to use moreemph, which appends to the identifiers to highlight to the existing list, whereas emph overwrites the existing list (if any) with the new one. For more details, see section 4.6 in the listings documentation. – jub0bs May 1 '14 at 22:10

You can use \rule{.4pt}{1ex} which will sit on the baseline and be 1ex high. Of course, adjust 1ex to suit your "small" requirement. Here's a small example showing the use case via a macro \vertrule[<len>] where <len> defaults to 1ex.

enter image description here

You can use \vertrule{} (compared to $|$) which will sit on the baseline and be \verb|1ex| high. 
Of course, adjust \verb|1ex| to suit your "small" requirement using \vertrule[1.5ex].
  • Of course, you can also use \usepackage{xspace} \newcommand{\vertrule}[1][1ex]{\rule{.4pt}{#1}\xspace} and avoid having to use \vertrule{} when you want to use the default height, but see Drawbacks of xspace. It depends on your use-case. – Werner May 1 '14 at 22:39
  • 1
    Since \vert is a math rule, its endcaps are rounded, and not flat like a \rule. If a substitute for \vert is in the offing, consider using roundrule.sty and the \roundrule[]{}{} macro, found at tex.stackexchange.com/questions/161297/… – Steven B. Segletes May 2 '14 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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