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 want a vertical bar but in mathematical mode it appears too big. I just want a small | at the same height as the letters.

share|improve this question
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 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. –  Jubobs May 1 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. –  Jubobs May 1 at 22:10
    
ok will remove one question. Thank you –  user50931 May 1 at 22:14

1 Answer 1

up vote 3 down vote accepted

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

\documentclass{article}
\newcommand{\vertrule}[1][1ex]{\rule{.4pt}{#1}}
\begin{document}
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].
\end{document}
share|improve this answer
    
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 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 at 0:36

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.