So I have been trying to make a command to display my very particular notation for restriction, but I believe parts of it involve text commands and other parts involve math commands, I thought I had properly considered each but I still get errors about the parameters not being in math mode:
The command:
\usepackage{amssymb}
\usepackage{graphics}
\DeclareRobustCommand{\rest}[1]{\text{\raisebox{-5.8pt}{\scalebox{1}[2.6]{$\upharpoonright$}_{\ensuremath{#1}}}\hspace{-7pt}}}
Would work but I still get error messages about lacking the $ $ in the arguments (even if I do put them in there).
The result that I wanted to get from this command was to be the same as if I wrote:
$$\pi\raisebox{-5.8pt}{\scalebox{1}[2.6]{$\upharpoonright$}}_{H}\hspace{-7pt}(a)$$
when i write
$$\pi\rest{H}(a)$$
And that should look like:


\textin that definition of\rest? – daleif May 09 '23 at 07:55\scalebox{1}[2.6]{$\upharpoonright$}_{has_in text, the whole of scalebox shoud be in$...$and do not use\enuremathhere – David Carlisle May 09 '23 at 08:08$you will be in math so no need to use\ensuremathto test for math. Note also you should not use$$in latex – David Carlisle May 09 '23 at 08:16$in\scaleboxnot just in\text– David Carlisle May 09 '23 at 08:17$$has never been documented as latex syntax, https://tex.stackexchange.com/questions/503/why-is-preferable-to/69854#69854 or more recently https://tex.stackexchange.com/a/684210/1090 – David Carlisle May 09 '23 at 08:24\scaleboxand\raiseboxcan be used everywhere, it is just that it always typesets its argument as text – daleif May 09 '23 at 08:56