7

The commands

$\mathcal{\mbox{$M$}}$

and

\mbox{$\mathcal{M}$}

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?

1
  • 4
    Welcome to TeX.SX! Can you give us a good use case? Commented Nov 9, 2014 at 16:50

2 Answers 2

8

Please always post complete documents:

\documentclass{article}
\usepackage{amsfonts}
\begin{document}
$\mathcal{\count0=\fam\mbox{$\fam=\count0 M$}}$
\end{document}
6
  • 1
    That works perfectly; thank you. I'll post complete documents in the future. Commented Nov 9, 2014 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} Commented Nov 9, 2014 at 20:35
  • I am trying to make a version of \overline and \underline that looks right on slanted characters. Commented Nov 9, 2014 at 20:40
  • 1
    @JonathanWise Have you seen: What does “XY Problem” mean? Commented Nov 9, 2014 at 21:48
  • 1
    @JonathanWise it does, but it doesn't matter as that is a local setting, it can not interfere with the page number as used, unless you want to print the page number inside the \mathcal Commented Nov 19, 2014 at 15:32
7

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

1
  • 3
    If I have understood the OP correctly, he wants to have \mathcal{M} as result, but \mathcal{\mathmbox{M}} gives the other M. Commented Jul 4, 2015 at 5:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.