I want to put an equation in a frame box. Is it the same that if I create a framed text box environment first then put the equation inside or use the environment `\boxed{}`

?

```
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\begin{document}
\framebox{$a^2+b^2=c^2$}
$\boxed{a^2+b^2=c^2}$
\end{document}
```

## Best Answer

Package

`amsmath`

defines`\boxed`

:`\framebox`

and`\fbox`

are just different interfaces for the same internal`\@frameb@x`

, which actually makes the box.`\framebox`

has more options.Thus, the main difference between

`\framebox{$...$}`

and`$\boxed{...}$`

is that`\boxed`

sets`\displaystyle`

, whereas it had to be done manually in the former variant:`\framebox{$\displaystyle ...$}`

.Another difference appears, if

`\mathsurround`

is not zero. This space is set, when TeX enters and leaves inline math mode. It is intended as separation of math from the surrounding text. Inside the box it does not make sense and`\boxed`

removes it by setting`\mathsurround`

to zero by`\m@th`

.A test file, which illustrates the differences:

A simulation of

`\boxed`

would be: