在方程式周围画一个框

在方程式周围画一个框

我有一个在对齐环境中编写的方程式摘要。我想在它周围做一个框,但不知道如何有效地做到这一点。这是一个 MWE

\documentclass{article}
\usepackage[fleqn]{amsmath}

\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
\begin{align*}
&\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{align*}

\end{document}

答案1

我看到你使用了amsmath,它有一个很好的\boxed命令。唯一的缺点是你应该在里面使用aligned而不是:align*

\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}

在此处输入图片描述

答案2

这是另一种解决方案,它允许跨页面拆分带框的方程式。我定义了一个mathframed环境,源自framed,并使用flalign*来在左边距对齐。使用shortintertext命令可以mathtools简化代码:

\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} 

在此处输入图片描述

答案3

您可以定义自己的环境;可能tcolorbox更适合这个目的,但是对于这种简单的情况,我们可以不用它。

这样,语法就更加自然,并且您可以保留fleqn为整个文档选择的设置。

\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}

bm包及其\bm命令优于\boldsymbol提供的功能amsmath

在此处输入图片描述

相关内容