Boxed Formula in LaTeX (\boxed{x})

x\boxed{x}
LaTeX command
\boxed{x}
Package
Add to your preamble:\usepackage{amsmath}
Mode
Text and math mode

Where it is used

Draws a rectangular frame around a math expression, often to highlight a final result.

Students box final answers and authors highlight key identities with \boxed{E = mc^2}. The command works inside math mode, keeping the content in display or text style as appropriate, unlike \fbox, which switches to text mode and needs $...$ inside it. In align environments, put \boxed around one side or a whole line's content but not across the & alignment point. The padding and rule thickness follow \fboxsep and \fboxrule, so you can adjust them locally. For colored frames, \fcolorbox wrapped around inline math is the usual next step.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

x=−b±b2−4ac2a\boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Boxed Formula: $\boxed{x}$

\[ \boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}} \]
\end{document}

Related symbols

All Aksen & Pengubah →

Frequently asked questions

How do I write Boxed Formula in LaTeX?
Type \boxed{x} in math mode, for example $\boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \boxed{x}?
\boxed{x} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \boxed{x} in text mode, or only in math mode?
Both. \boxed{x} compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI

  • Jana diagram TikZ yang cantik menggunakan AI
  • Muat naik imej dan tukar ke LaTeX dengan lancar
  • Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan