如何在分布多行的方程式周围放置一个框?

如何在分布多行的方程式周围放置一个框?

我想在一个多行方程周围放置一个方框。最小工作示例:

 \documentclass{article}
 \usepackage[utf8]{inputenc}
 %\usepackage{amsmath}
 \usepackage{comment}
 \usepackage{mathtools, cuted}
 %\usepackage{natbib}
 \usepackage{amssymb}
 \usepackage{breqn}
 %\usepackage{amsthm}
 \usepackage{hyperref}
 %\bibliographystyle{plain}
 %\newtheorem{thm}{Theorem}[section]
 %\newtheorem{lem}[thm]{Lemma}
 %\newtheorem{cor}[thm]{Corollary}
 \newtheorem{rmk}{Remark}
 %\newtheorem{def}[rmk]{Definition}
 %\newtheorem*{proof}{Proof}
 \usepackage{amsmath}
 \usepackage{mathtools}
 \usepackage{enumitem}

  %\usepackage[dvips]{epsfig}    % or this line, depending on which
                           % you prefer.
  \makeatletter
  \DeclareRobustCommand{\qed}{%
  \ifmmode % if math mode, assume display: omit penalty etc.
  \else \leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
  \fi
  \quad\hbox{\qedsymbol}}
  \newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
  \newcommand{\qedsymbol}{\openbox}
  \newenvironment{proof}[1][\proofname]{\par
  \normalfont
  \topsep6\p@\@plus6\p@ \trivlist
  \item[\hskip\labelsep\itshape
  #1.]\ignorespaces
   }{%
  \qed\endtrivlist
  }
   \newcommand{\proofname}{Proof}
   \makeatother

   \begin{document}
   \begin{align}
    &\frac{1}{\min_i \sum_j e^{c(i,j)}p(j|i)}\sum_{i,j=1}^s                                      e^{c(i,j)}p(j|i)x_i y_j \left[c(i,j) + \ln p(j|i)-\ln \sqrt{\pi_i} - 
   \ln\phi^{k(i)}(i) -\ln\left(\sum_{l=1}^s \phi^{k(i)}(l)\pi_la_{lj}         \right)+\ln \sqrt{\pi_j}+ \right. \nonumber \\
   & \left. \ln\left(\sum_{m=1}^s{\phi^{k(i)}(m)}^2\pi_m\right)\right]        \label{first}.
   \end{align}
   \end{document} 

答案1

像这样吗?

在此处输入图片描述

 \documentclass{article}

\usepackage[margin=0.5in]{geometry}
\usepackage{empheq}


   \begin{document}
   \begin{empheq}[box=\fbox]{align}
    &\frac{1}{\min_i \sum_j e^{c(i,j)}p(j|i)}\sum_{i,j=1}^s                                      e^{c(i,j)}p(j|i)x_i y_j \left[c(i,j) + \ln p(j|i)-\ln \sqrt{\pi_i} - 
   \ln\phi^{k(i)}(i) -\ln\left(\sum_{l=1}^s \phi^{k(i)}(l)\pi_la_{lj}         \right)+\ln \sqrt{\pi_j}+ \right. \nonumber \\
   & \left. \ln\left(\sum_{m=1}^s{\phi^{k(i)}(m)}^2\pi_m\right)\right]        \label{first}.
   \end{empheq}
   \end{document}

相关内容