# \caption versus a new setminus

I'm using the following as an improvement to the look of `\setminus`:

``````\newcommand\rsetminus{\mathbin{\mathpalette\rsetminusaux\relax}}
\newcommand\rsetminusaux[2]{\mspace{-4mu}
\raisebox{\rsmraise{#1}\depth}{\rotatebox[origin=c]{-20}{\$#1\smallsetminus\$}}
\mspace{-4mu}
}
\newcommand\rsmraise[1]{%
\ifx#1\displaystyle .8\else
\ifx#1\textstyle .8\else
\ifx#1\scriptstyle .6\else
.45%
\fi
\fi
\fi}
``````

`\rsetminus` works fine in math mode, but inside a figure caption in math mode it produces an error that the "argument of `\@caption` has an extra `}`".

I added \protect before the \rotatebox. No effect. I have another command that uses `\raisebox` to move the Greek letter chi up to the normal line. It has a `\protect` before the `\raisebox` and works fine inside a figure caption in math mode.

I also tried with `\ensuremath` before the `\protect`. Advice?

• you'd need `\protect\rsetminus` – David Carlisle Sep 25 '14 at 22:44
• Welcome to TeX.SX! The simplest is to say `\protect\rsetminus` in the caption, if you need it only once. Or just change `\newcommand\rsetminus` into `\DeclareRobustCommand\rsetminus`. – egreg Sep 25 '14 at 22:44
• as a matter of curiosity, why are you raising the `\smallsetminus`? it's a binary operator, and as such, it is, by design, centered vertically on the math axis. your raising it puts it almost at a superscript position. – barbara beeton Sep 26 '14 at 12:48
• Hello Barbara -- – Charles Pugh Sep 26 '14 at 17:45
• Hello barbara. I copied a previous answer for improving the look of setminus. It does not resemble longhand. It comes out OK in pdf with the raisebox. But I'll try it plain too if this DeclareRobustCommand from egreg works. (Just adding \protect did not work.) I don't like they way chi and gamma are below the normal line, even though that's how real Greek is. Math greek can be how we want it. If you have the characteristic function of a set S you want chi sub S. Without raising chi it looks wrong mathematically. Thanks for your comment and inquiry. Charles Pugh – Charles Pugh Sep 26 '14 at 18:00

An error such as

``````argument of \@caption has an extra }
``````

usually means “you have a fragile command in the argument to `\caption`. As `\mathbin` is not fragile, the culprit must be `\mathpalette` or `\rsetminusaux` and indeed this one uses `\raisebox` which is fragile.

Solution:

``````\DeclareRobustCommand\rsetminus{\mathbin{\mathpalette\rsetminusaux\relax}}
``````

instead of `\newcommand`.