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 wonder how to typeset the restriction of a function to some subdomain, a la $f|_A$ or $f\restriction_A$ , but with the vertical bar being as big as possible.

share|improve this question
It seems that one can just use \big| or \Big|. But is there something which chooses the optimal size (or can there not be such a thing)? – Michael Jul 4 '11 at 7:50
And welcome to TeX.SE! – ℝaphink Jul 4 '11 at 8:33
For \restriction, \usepackage{amssymb}. – Evgeni Sergeev Nov 22 '13 at 6:18
@EvgeniSergeev Your answer is the best - why don't you make it one? – Ari Brodsky Sep 9 '14 at 6:47
@AriBrodsky It doesn't actually answer the OP's question (though it might be useful for folks like me who came to the page looking to answer the question restricted to its title :) – Evgeni Sergeev Sep 10 '14 at 1:56

If you want the vertical bar to be at least \big, the following doesn't have the spacing issues of Ulrich's solution:

\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
  \left.\kern-\nulldelimiterspace % automatically resize the bar with \right
  #1 % the function
  \vphantom{\big|} % pretend it's a little taller at normal size
  \right|_{#2} % this is the delimiter

If you don't need the extra height for normal size symbols, comment the \vphantom line.

Use it as \restr{f}{A}.

share|improve this answer

Does $\left.f\right|_A$ provide what you are looking for?

share|improve this answer

I use the following:


because normally the vertical bar must be lowered (and not centered on the math axis as other symbols). And it doesn't need to be very big, it is the fact that it goes lower than the rest that shows that it is a restriction and not an absolute value or a divides symbol.

share|improve this answer
Since it's LaTeX, it should be \newcommand\restrict[1]{\raisebox{-.5ex}{$|$}_{#1}} – egreg Nov 17 '15 at 10:08

How about \newcommand\restr[2]{\ensuremath{\left.#1\right|_{#2}}}, which can be used like this: $\restr{f}{A}$?

(Warning, haven't tested...)

share|improve this answer

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.