I'm having trouble producing a boxed equation in the same line as some other formulae. For example: $$ \frac{2}{4} =\[\boxed{ \frac{1}{2} }\] $$

I'd like to be able to show some calculations, followed by a boxed final answer. Any ideas?


The standard LaTeX command for boxing something is \fbox. Its argument is in text mode; to switch to display format mathematics you need to issue

\fbox{$\displaystyle  ... $}

Thus your example becomes



\[ \frac{2}{4} =\fbox{$\displaystyle \frac{1}{2}$} \]



Sample output

If you are using amsmath then its \boxed command (thanks daleif for the link) already takes care of switching to maths and display style, so you just write the code for the math object directly between the braces {...}




\[ \frac{2}{4} = \boxed{\frac{1}{2}} \]


In other words in the argument to \boxed you do not need math mode switching commands such as \[..\].

  • The boxed command the op is already using should be fine, it already sets the contents in math mode. The math syntax the op is using is just messed up – daleif Nov 30 '15 at 7:06
  • @daleif \boxed needs some package - which? – Andrew Swann Nov 30 '15 at 8:58
  • Standard part of amsmath – daleif Nov 30 '15 at 9:08

A simple trick is as follow:

   $$\frac{1}{1+ \text{\boxed{$$\frac{1}{1+x}$$}}}$$

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.