TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use \middle| inside of brackets like this.


  \left\{\frac{1}{n} \middle| n>0\right\}



But this examples lacks space before and after the mid |. I don't want to write every time:

left\{\frac{1}{n} \;\middle|\; n>0\right\}

How can I redefine the \middle| command to mean \;\middle|\;? I tried




but neither works. What is the difference between both commands and why do they not work with \middle?

share|improve this question
Maybe you just want \mid? Though, that won't scale vertically. – morbusg Jul 23 '14 at 16:28
I want the middle command to scale vertically like \middle| does. – Marco Breitig Jul 23 '14 at 16:31
See tex.stackexchange.com/q/5502 to get \middle| to behave exactly as \mid – Philippe Goutet Jul 23 '14 at 16:48
Thx for hint, I used your suggestion. – Marco Breitig Jul 24 '14 at 7:52
up vote 9 down vote accepted

The symbol needs to come after the \middle so


Although redefining primitives always breaks something, somewhere so I would suggest instead


and use \xmiddle (or any other name you wish)

share|improve this answer
Wow thx, that was fast! I tried to play around with a parameter but somehow did not manage to get things right. – Marco Breitig Jul 23 '14 at 16:33
Just out of curiosity, do you know how would one do that with a \(U)delcode or \(U)delimiter? (i.e., without \middle?) – morbusg Jul 23 '14 at 16:35
@morbusg If I understand your comment correctly, I don't think you can – David Carlisle Jul 23 '14 at 16:36
@morbusg \bigm|? – Manuel Jul 23 '14 at 16:45
\newcommand{\relmiddle}{\nonscript\;\middle\nonscript\;} – egreg Jul 23 '14 at 17:29

Your Answer


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.