多行方程

多行方程

我正在使用以下代码来生成第二个图形。

\begin{equation}
\begin{array}{c}
\displaystyle \min_{W, S}J(W,S)=\frac{\sum^n_{i,j=1}\norm{W^{T}(x_{i}-x_{j})}^2S_{ij}}{\sum^n_{i=1}\norm{W^Tx_{i}}^2}+\mu\norm{S}^2 \\ \\
\displaystyle \text{s.t.} \; W^TW=I \\
\displaystyle \sum^n_{j=1}S_{ij}=1, i = 1, \dots, n
\displaystyle \\S_{ij}\geq0, i,j = 1, \dots, n
\end{array} 
\label{piel2}
\end{equation}

但实际上,我希望得到第一个图形,其中“st”位于所有约束之前。我该如何得到它?

图1

图 2

答案1

\documentclass[12pt,a4paper,bothsides]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{mathtools}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}


\begin{document}

\begin{align*}
\min_{W, S}J(W,S) & =\frac{\sum^n_{i,j=1}\norm{W^{T}(x_{i}-x_{j})}^2 S_{ij}}{\sum^n_{i=1}\norm{W^Tx_{i}}^2}+μ \norm{S}^2 \\
\text{s.t.} &\\
   &{}W^TW=I \\
&{}\sum^n_{j=1}S_{ij}=1, & \hphantom{,j} i  = 1, \dots, n \\
&{}S_{ij}\geq 0,  & i,j = 1, \dots, n
\end{align*}


\end{document}

在此处输入图片描述

或者

\documentclass[12pt,a4paper,bothsides]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{mathtools}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\usepackage{calc}

\begin{document}

\begin{align*}
\min_{W, S}J(W,S) & =\frac{\sum^n_{i,j=1}\norm{W^{T}(x_{i}-x_{j})}^2 S_{ij}}{\sum^n_{i=1}\norm{W^Tx_{i}}^2}+μ \norm{S}^2 \\
& \text{s.t.\qquad}  
\begin{aligned}[t]
W^TW=I \\
\sum^n_{j=1}S_{ij}=1, & \hphantom{,j} i  = 1, \dots, n \\
S_{ij}\geq 0,  \,\quad & i,j = 1, \dots, n
\end{aligned}
\end{align*}


\end{document}

在此处输入图片描述

答案2

这似乎可以满足您的要求:

    \documentclass[12pt,a4paper,bothsides]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[showframe, nomarginpar]{geometry}
    \usepackage{mathtools}
    \DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

    \begin{document}

    \begin{align*}
    \min_{W, S}J(W,S) & =\frac{\sum^n_{i,j=1}\norm{W^{T}(x_{i}-x_{j})}^2 S_{ij}}{\sum^n_{i=1}\norm{W^Tx_{i}}^2}+μ \norm{S}^2 \\
    & \text{s.t.} \begin{cases}
       W^TW=I \\
    \sum^n_{j=1}S_{ij}=1, & \hphantom{,j} i  = 1, \dots, n \\
    S_{ij}\geq 0,  & i,j = 1, \dots, n
    \end{cases}
    \end{align*}


    \end{document} 

在此处输入图片描述

答案3

\begin{eqnarray}
\min_{W, S}J(W,S)=\frac{\sum^n_{i,j=1} \rVert{W^{T}(x_{i}-x_{j})\rVert}^2S_{ij}}{\sum^n_{i=1}\rVert{W^Tx_{i}}\rVert^2}+\mu \rVert{S}\rVert^2 \nonumber
\end{eqnarray}
\hspace{50mm}such that,
\begin{eqnarray}
W^TW=I  \nonumber \\
\sum^n_{j=1}S_{ij}=1, i = 1, \dots, n\nonumber\\
S_{ij}\geq0, i,j = 1, \dots, n \nonumber
\end{eqnarray}

在此处输入图片描述

相关内容