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 アクセント・修飾子 →

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 poweredAIでLaTeXを書く

最高のAI LaTeXエディタ、Overleaf代替

Octreeは15以上の大学の研究者がAIを使って論文をより速く書くのを支援

  • AIで美しいTikZダイアグラムを生成
  • 画像をアップロードしてシームレスにLaTeXに変換
  • 論文の執筆とフォーマットに即座にサポートを取得