3

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?

6
  • 1
    you'd need \protect\rsetminus Sep 25, 2014 at 22:44
  • 2
    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, 2014 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. Sep 26, 2014 at 12:48
  • Hello Barbara -- Sep 26, 2014 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 Sep 26, 2014 at 18:00

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .