Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 1 down vote accepted

\ifinner is what you want:

\newcommand*\mymathspace{%
    \mskip\ifinner6\else18\fi mu
}
share|improve this answer
    
Great! Thanks. –  Stufazi Hoqckt Apr 28 '11 at 5:26
add comment

Your Answer

 
discard

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.