我的代码是这样的:
\begin{center}
\begin{align*}
& \min_{w,b,\xi,\xi'}\ \ \ \ \frac{1}{2}\boldsymbol{w}^T\boldsymbol{w} + C\sum_{i=1}^l (\xi_i + \xi'_i) \\
& subject\ to \\
& \boldsymbol{w}^t\phi(\boldsymbol{x_i}) + b - y_i \leq \epsilon + \xi_i \\
& y_i - \boldsymbol{w}^T\phi(\boldsymbol{x_i}) - b \leq \epsilon + \xi'_i \\
& \xi_i, \xi'_i \geq 0,\ \ i = 1,\dots, l \\
\end{align*}
\end{center}
我希望“受制于”下的内容居中,位于第一行下方,而不是左对齐。我尝试将它们放在\begin{center}
...内,\end{center}
但它给了我很多错误
答案1
使用聚集
\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe} % just for the example
\begin{document}
\begin{gather*}
% \begin{align}
\min_{w,b,\xi,\xi'}\ \ \ \ \frac{1}{2}\boldsymbol{w}^T\boldsymbol{w} +
C\sum_{i=1}^l (\xi_i + \xi'_i) \\
subject\ to \\
\boldsymbol{w}^t\phi(\boldsymbol{x_i}) + b - y_i \leq \epsilon + \xi_i \\
y_i - \boldsymbol{w}^T\phi(\boldsymbol{x_i}) - b \leq \epsilon + \xi'_i \\
\xi_i, \xi'_i \geq 0,\ \ i = 1,\dots, l
% \end{align}
\end{gather*}
\end{document}
答案2
我建议使用专用包进行布局,optidef
::
\documentclass{article}
\usepackage{optidef}
\begin{document}
\begin{mini*}|s|
{w,b,\xi,\xi'}{\frac{1}{2}\boldsymbol{w}^T\boldsymbol{w} + C\sum_{i=1}^l (\xi_i + \xi'_i)}
{}{}
\addConstraint{\boldsymbol{w}^t\phi(\boldsymbol{x_i}) + b - y_i}{\leq \epsilon + \xi_i}
\addConstraint{y_i - \boldsymbol{w}^T\phi(\boldsymbol{x_i}) - b}{\leq \epsilon + \xi’_i}
\addConstraint{ \xi_i, \xi'_i}{\geq 0,}{\quad i = 1,\dots, l}
\end{mini*}
\end{document}