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.
6 Answers
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}
.
How about \newcommand\restr[2]{\ensuremath{\left.#1\right|_{#2}}}
, which can be used like this: $\restr{f}{A}$
?
(Warning, haven't tested...)
I use the following:
\def\restrict#1{\raise-.5ex\hbox{\ensuremath|}_{#1}}
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.
-
11Since it's LaTeX, it should be
\newcommand\restrict[1]{\raisebox{-.5ex}{$|$}_{#1}}
– egregNov 17, 2015 at 10:08
I had that problem recently and I looked it up here, but since then I usually type $f_{\big|A}$
I would prefer $f\arrowvert_A$
to the above-mentioned suggested commands.
-
2
-
3
\restriction
,\usepackage{amssymb}
.