Making a box around an equation

I see you use amsmath, which has a nice \boxed command. The only catch is you should use aligned instead of align* inside it:

\documentclass{article}
\usepackage[fleqn]{amsmath}
\thispagestyle{empty}
\setlength\mathindent{1cm}
\linespread{1.3}

\begin{document}

\textbf{\Large Solution.} Here is a summary of what we obtained in class for the case of periodic distribution of eigen-strain

\boxed{\begin{aligned}
&\text{Given the system of PDEs} \\
&C_{ijkl}u_{k,lj} = C_{ijkl} \varepsilon^*_{kl,j} \\
&\text{with a periodic distribution of eigen-strain} \\
&\varepsilon^*_{kl}(\mathbf{x},\boldsymbol{\xi})=\bar{\varepsilon}^*_{kl}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
&\text{the general solution can be obtained as} \\
&K_{ik} = C_{ijkl}\xi_l\xi_j \\
&D(\boldsymbol{\xi}) = \epsilon_{mnl} K_{m1} K_{n2} K_{l3} \\
&N_{ij}(\boldsymbol{\xi}) = \frac{1}{2} \epsilon_{ikl}\epsilon_{jmn} K_{km} K_{ln} \\
&u_i(\mathbf{x},\boldsymbol{\xi}) = -\mathrm{i}\,C_{jlmn} \bar{\varepsilon}^*_{mn} \xi_l N_{ij}(\boldsymbol{\xi}) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
&\varepsilon_{ij}(\mathbf{x},\boldsymbol{\xi}) = C_{klmn} \bar{\varepsilon}^*_{mn} \xi_l ( \xi_j N_{ik}(\boldsymbol{\xi}) + \xi_i N_{jk}(\boldsymbol{\xi})) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
&\sigma_{ij}(\mathbf{x},\boldsymbol{\xi}) = C_{ijkl} ( C_{pqmn} \bar{\varepsilon}^*_{mn} \xi_q \xi_l N_{kp}(\boldsymbol{\xi}) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x})-\varepsilon^*_{kl}(\mathbf{x}))
\end{aligned}}

\end{document}

enter image description here


Here is another solution, which allows for breaking boxed equations across pages. I defined a mathframed environment, derived from framed, and use flalign* to align at the left margin. Using the shortintertext command from mathtools simplifies the code:

\documentclass{article}
\usepackage[fleqn]{mathtools}
\usepackage{framed}
\newenvironment{mathframed}{\framed%
\allowdisplaybreaks
\vspace*{-\abovedisplayskip}\noindent}{%
\vspace*{-\dimexpr\baselineskip+\topsep}\endframed}

\linespread{1.3}

\begin{document}
\vspace*{13cm}
\textbf{\Large Solution.} Here is a summary of what we obtained in class for the case of periodic distribution of eigen-strain
\begin{mathframed}
\begin{flalign*}
\shortintertext{Given the system of PDEs}
   & C_{ijkl}u_{k,lj} = C_{ijkl} \varepsilon^*_{kl,j} & & \\
\shortintertext{with a periodic distribution of eigen-strain}
 &\varepsilon^*_{kl}(\mathbf{x},\boldsymbol{\xi})=\bar{\varepsilon}^*_{kl}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
\shortintertext{the general solution can be obtained as}
 & K_{ik} = C_{ijkl}\xi_l\xi_j \\
 & D(\boldsymbol{\xi}) = \epsilon_{mnl} K_{m1} K_{n2} K_{l3} \\
 & N_{ij}(\boldsymbol{\xi}) = \frac{1}{2} \epsilon_{ikl}\epsilon_{jmn} K_{km} K_{ln} \\
 & u_i(\mathbf{x},\boldsymbol{\xi}) = -\mathrm{i}\,C_{jlmn} \bar{\varepsilon}^*_{mn} \xi_l N_{ij}(\boldsymbol{\xi}) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
 & \varepsilon_{ij}(\mathbf{x},\boldsymbol{\xi}) = C_{klmn} \bar{\varepsilon}^*_{mn} \xi_l ( \xi_j N_{ik}(\boldsymbol{\xi}) + \xi_i N_{jk}(\boldsymbol{\xi})) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x}) \\
 & \sigma_{ij}(\mathbf{x},\boldsymbol{\xi}) = C_{ijkl} ( C_{pqmn} \bar{\varepsilon}^*_{mn} \xi_q \xi_l N_{kp}(\boldsymbol{\xi}) D^{-1}(\boldsymbol{\xi})\exp(\mathrm{i}\,\boldsymbol{\xi}\cdot\mathbf{x})-\varepsilon^*_{kl}(\mathbf{x}))
\end{flalign*}
\end{mathframed}

\end{document} 

enter image description here


You can define your own environment; probably tcolorbox is better for the purpose, but we can do without it for such a simple situation.

This way the syntax is more natural and you can preserve the fleqn setting you chose for the whole document.

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{bm}% recommended

\newenvironment{boxedmaterial}
  {\begin{flushleft}% this produces some space around
   \hspace*{-\fboxsep}\hspace*{-\fboxrule}%
   \begin{lrbox}{\boxedmaterialbox}\begin{minipage}{\textwidth}}
  {\end{minipage}\end{lrbox}%
   \fbox{\usebox{\boxedmaterialbox}}%
   \hspace*{-\fboxsep}\hspace*{-\fboxrule}\hspace*{0pt}%
   \end{flushleft}}
\newsavebox{\boxedmaterialbox}

\setlength\mathindent{1cm}
\linespread{1.3}

\begin{document}

\textbf{Solution.} Here is a summary of what we obtained in class 
for the case of periodic distribution of eigen-strain
\begin{boxedmaterial}
Given the system of PDEs
\begin{equation*}
C_{ijkl}u_{k,lj} = C_{ijkl} \varepsilon^*_{kl,j}
\end{equation*}
with a periodic distribution of eigen-strain
\begin{equation*}
\varepsilon^*_{kl}(\mathbf{x},\bm{\xi})=
\bar{\varepsilon}^*_{kl}(\bm{\xi})\exp(\mathrm{i}\,\bm{\xi}\cdot\mathbf{x})
\end{equation*}
the general solution can be obtained as
\begin{align*}
K_{ik} &= C_{ijkl}\xi_l\xi_j \\
D(\bm{\xi}) &= \epsilon_{mnl} K_{m1} K_{n2} K_{l3} \\
N_{ij}(\bm{\xi}) &= \frac{1}{2} \epsilon_{ikl}\epsilon_{jmn} K_{km} K_{ln} \\
u_i(\mathbf{x},\bm{\xi}) &= 
  -\mathrm{i}\,C_{jlmn} \bar{\varepsilon}^*_{mn} \xi_l N_{ij}(\bm{\xi})
  D^{-1}(\bm{\xi})\exp(\mathrm{i}\,\bm{\xi}\cdot\mathbf{x}) \\
\varepsilon_{ij}(\mathbf{x},\bm{\xi}) &=
  C_{klmn} \bar{\varepsilon}^*_{mn} \xi_l ( \xi_j N_{ik}(\bm{\xi}) + 
  \xi_i N_{jk}(\bm{\xi})) D^{-1}(\bm{\xi})\exp(\mathrm{i}\,\bm{\xi}\cdot\mathbf{x}) \\
\sigma_{ij}(\mathbf{x},\bm{\xi}) &=
  C_{ijkl} ( C_{pqmn} \bar{\varepsilon}^*_{mn} \xi_q \xi_l N_{kp}(\bm{\xi})
  D^{-1}(\bm{\xi})\exp(\mathrm{i}\,\bm{\xi}\cdot\mathbf{x})-\varepsilon^*_{kl}(\mathbf{x}))
\end{align*}
\end{boxedmaterial}

\end{document}

The bm package with its \bm command is superior to the \boldsymbol feature provided by amsmath.

enter image description here

Tags:

Boxes

Align