[Tex/LaTex] How to draw a box around this

alignatboxes

MWE:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[margin=3cm]{geometry}
\begin{document}
\paragraph*{Problem 1}
This problem can be modelled as a clamped-free cantilever with a point load at the end. Thus, the following boundary conditions can be assigned:
\begin{alignat}{2}
\underline{\emph{Clamped end:}}& &\underline{\emph{Free end:}}&\nonumber \\
w(0) &= 0\quad\textnormal{(no deflection)}\quad\quad\quad & w''(L) &= 0\quad\textnormal{(no moment)}\nonumber \\
w'(0) &= 0\quad\textnormal{(no slope)}\quad\quad\quad & w'''(L) &= 0\quad\textnormal{(no shear force)}\nonumber
\end{alignat}
The boundary condition concerning the shear force at $ x=L $ is a matter of taste, since there is a discontinuity in the shear force in this point.
\end{document}

Producing this:
I want a box surrounding the boundary conditions

I would like a box similar to the one produced by \boxed{} around all the boundary conditions stated (including the underlined text). I've looked around on similar questions but it always seems like a special solution for that particular problem – what's the easiest way to do this?

Best Answer

It's a simple application of empheq

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath,empheq}
\usepackage[margin=3cm]{geometry}
\begin{document}
\paragraph*{Problem 1}
This problem can be modelled as a clamped-free cantilever with a point load at the end. Thus, the following boundary conditions can be assigned:
\begin{empheq}[box=\fbox]{alignat=2}
\underline{\emph{Clamped end:}}& &\underline{\emph{Free end:}}&\nonumber \\
w(0) &= 0\quad\textnormal{(no deflection)}\quad\quad\quad & w''(L) &= 0\quad\textnormal{(no moment)}\nonumber \\
w'(0) &= 0\quad\textnormal{(no slope)}\quad\quad\quad & w'''(L) &= 0\quad\textnormal{(no shear force)}\nonumber
\end{empheq}
The boundary condition concerning the shear force at $ x=L $ is a matter of taste, since there is a discontinuity in the shear force in this point.
\end{document}

enter image description here