TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a length macro, named \mymathspace, which is changeable in inline math (including \text command) and display math. For example,

Text mode $inline\ math\vert\mymathspace\vert{}inline\ math$

get a space 6mu between the \verts; and

\[display\ math\vert\mymathspace\vert{}display\ math\]

get a space 18mu between the \verts; while

\[display\ math\text{Text mode $math\ in\ text\ command
\vert\mymathspace\vert$}display\ math\]

get a space 6mu between the \verts. But I can't obtain this by \if@display and \ifmmode.

share|improve this question
up vote 1 down vote accepted

\ifinner is what you want:

    \mskip\ifinner6\else18\fi mu
share|improve this answer
Great! Thanks. – Stufazi Hoqckt Apr 28 '11 at 5:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.