The commands




produce different output. I would like a replacement for \mbox that creates a box preserving all features of the current font in math mode. How can I do this?

  • 4
    Welcome to TeX.SX! Can you give us a good use case? – Andrew Swann Nov 9 '14 at 16:50

Please always post complete documents:

$\mathcal{\count0=\fam\mbox{$\fam=\count0 M$}}$
  • That works perfectly; thank you. I'll post complete documents in the future. – Jonathan Wise Nov 9 '14 at 19:27
  • 2
    @JonathanWise why do you want this by the way? hard to think of any time it would be useful compared to just using \mathcal{M} – David Carlisle Nov 9 '14 at 20:35
  • I am trying to make a version of \overline and \underline that looks right on slanted characters. – Jonathan Wise Nov 9 '14 at 20:40
  • @JonathanWise Have you seen: What does “XY Problem” mean? – yo' Nov 9 '14 at 21:48
  • I discovered today that \count0 also stores the page number, so I used \count@ instead. – Jonathan Wise Nov 19 '14 at 15:30

You can use the similar commands \mathmbox or \mathmakebox provided by the mathtools package.

  • 2
    If I have understood the OP correctly, he wants to have \mathcal{M} as result, but \mathcal{\mathmbox{M}} gives the other M. – Heiko Oberdiek Jul 4 '15 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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