The question about function restrictions didn't solve my problem, nor did the related questions about bigger parenthesis larger than Bigg.
I'd like to typeset a function restriction, with the vertical bar a bit lowered. f_{\big|W} results in something close to what I want:
To perfect it, the bar would be cut off where it reaches the baseline of the subscript symbol (in this case W). So that it doesn't reach below it.
How can I accomplish that?


\restr{f}{W}or\restr{W}{f}and let the macro output the style you want. That way you have clearer code, and much easier to tweak in the whole document. – Manuel Jan 29 '17 at 14:33