NoobixCube
- 154
- 0
How do you put a box around a numbered equation?
This discussion provides a comprehensive guide on how to box a numbered equation in LaTeX using the amsmath package. The user can utilize the \texttt{\textbackslash boxed} command for individual equations or nest boxes for the entire line, including the equation number. A custom command \texttt{\textbackslash boxeqn} is defined to streamline the process, ensuring proper alignment of equation numbers. The discussion emphasizes the importance of spacing when modifying the command to maintain formatting integrity.
PREREQUISITESLaTeX users, mathematicians, educators, and anyone involved in typesetting mathematical documents who seeks to enhance the presentation of equations.
NoobixCube said:How do you put a box around a numbered equation?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
some text
\begin{equation}
\boxed{
x^2+y^2 = z^2
}
\end{equation}
more text
\end{document}
\documentclass{article}
\newcommand{\boxeqn}[1]{
\[
\fbox{
\addtolength{\linewidth}{-2\fboxsep}%
\addtolength{\linewidth}{-2\fboxrule}%
\begin{minipage}{\linewidth}
\begin{equation}
#1
\end{equation}
\end{minipage}
}
\]
}
\begin{document}
some text
\begin{equation}
x^2 + y^2 = z^2
\end{equation}
more text
\boxeqn{
a^2 + b^2 = c^2
}
more text
\boxeqn{
\oint \vec B\cdot d\vec A =0
}
\end{document}