我正在为两栏科学论文写一个优化问题。问题是我使用以下代码来生成方程,但输出的美观度不佳,因为它在列的左侧留下了很多空间。有没有比使用下面提到的代码更好的方法(除了子方程)来编写这些方程。此外,我想在一行中编写一个方程(约束),其中包含所有变量(如果可能)。有什么方法可以实现这两个目标?以下是我工作的 MWE。
\documentclass[conference]{IEEEtran}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{alignat}{2}
& \textbf{P2}\ \min_{\textbf{X}} &\qquad& f(\textbf{X})\label{eq:OF2}\\
&\text{subject to} & & Tr(\mathbf{\Psi}_{P,k}^\varphi \textbf{X}) + P_{l_k}^\kappa = 0, \nonumber\\
& & & \hspace{5em}\forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \label{eq:PBL2}\\
& & & Tr(\mathbf{\Psi}_{Q,k}^\varphi \textbf{X}) + Q_{l_k}^\kappa-y_{c_k}^\kappa Tr(\mathbf{\Psi}_{V,k}^\varphi \textbf{X}) = 0,\nonumber\\
& & & \hspace{5em} \forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \label{eq:QBL2}\\
& & & \underline{P}_{g_i} \leq Tr(\mathbf{\Psi}_{P,i}^\varphi \textbf{X}) + P_{l_i}^\kappa \leq \overline{P}_{g_i}, \nonumber \\
& & & \hspace{5em} \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:PBG2}\\
& & & \underline{Q}_{g_i} \leq Tr(\mathbf{\Psi}_{Q,i}^\varphi \textbf{X}) + Q_{l_i}^\kappa \leq \overline{Q}_{g_i},\nonumber\\
& & & \hspace{5em} \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:QBG2}\\
& & & (\underline{V}_k)^2 \leq Tr(\mathbf{\Psi}_{V,k}^\varphi \textbf{X}) \leq (\overline{V_k})^2,\nonumber \\
& & &\hspace{5em}\forall \varphi \in \eta_{k}, k \in N^+,\label{eq:Vol2}\\
& & & [\textbf{X}]_{\phi_{0}\times \phi_{0}} = \textbf{v}_0\textbf{v}_0^\textit{H}\\
& & & \textbf{X}\succeq 0,\\
& & & rank(\textbf{X})=1 \label{rank_con}
\end{alignat}
\end{subequations}
\end{document}
答案1
这是一个选项,但是列宽对于您的某个限制来说太窄了:
- 使用
\DeclareMathOperator
forTr
和rank
; - 使用
\mathbf
代替 来\textbf
表示b
旧的f
acemath
内容。或者,有\boldsymbol
或\bm
(来自bm
(英文): - 用于
{+}
消除常规操作符周围的间距...在紧要关头; - 写出问题描述以打破对齐链接,从而在空间方面提供更多的灵活性
\documentclass[conference]{IEEEtran}
\usepackage{amsmath}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\rank}{rank}
\newcommand{\tightermath}{%
\setlength{\thickmuskip}{.3\thickmuskip}
\setlength{\medmuskip}{.3\medmuskip}
\setlength{\thinmuskip}{.3\thinmuskip}
}
\begin{document}
\begin{subequations}
\begin{alignat}{2}
& \textbf{P2}\ \min_{\textbf{X}} &\qquad& f(\textbf{X}) \\
&\text{subject to} & & \Tr(\mathbf{\Psi}_{P,k}^\varphi \textbf{X}) + P_{l_k}^\kappa = 0, \nonumber\\
& & & \hspace{5em}\forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \\
& & & \Tr(\mathbf{\Psi}_{Q,k}^\varphi \textbf{X}) + Q_{l_k}^\kappa-y_{c_k}^\kappa \Tr(\mathbf{\Psi}_{V,k}^\varphi \textbf{X}) = 0, \nonumber\\
& & & \hspace{5em} \forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \\
& & & \underline{P}_{g_i} \leq \Tr(\mathbf{\Psi}_{P,i}^\varphi \textbf{X}) + P_{l_i}^\kappa \leq \overline{P}_{g_i}, \nonumber \\
& & & \hspace{5em} \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \\
& & & \underline{Q}_{g_i} \leq \Tr(\mathbf{\Psi}_{Q,i}^\varphi \textbf{X}) + Q_{l_i}^\kappa \leq \overline{Q}_{g_i}, \nonumber\\
& & & \hspace{5em} \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \\
& & & (\underline{V}_k)^2 \leq \Tr(\mathbf{\Psi}_{V,k}^\varphi \textbf{X}) \leq (\overline{V_k})^2, \nonumber \\
& & &\hspace{5em}\forall \varphi \in \eta_{k}, k \in N^+, \\
& & & [\textbf{X}]_{\phi_{0}\times \phi_{0}} = \textbf{v}_0\textbf{v}_0^\textit{H}\\
& & & \textbf{X}\succeq 0,\\
& & & \rank(\textbf{X})=1 \label{rank_con}
\end{alignat}
\end{subequations}
\newpage
Consider the optimisation \textbf{P2} with the objective to
\begin{subequations}
\begin{equation}
\underset{\mathbf{X}}{\text{minimize}}\ f(\mathbf{X})
\end{equation}
subject to
\begin{flalign}
& \Tr(\mathbf{\Psi}_{P,k}^\varphi \mathbf{X}) + P_{l_k}^\kappa = 0,
\forall \varphi \in \phi_k, \kappa \in \psi_k, k \in N \setminus G \\
& \Tr(\mathbf{\Psi}_{Q,k}^\varphi \mathbf{X}) + Q_{l_k}^\kappa-y_{c_k}^\kappa Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) = 0, \nonumber \\
& \hspace{5em} \forall \varphi \in \phi_k, \kappa \in \psi_k, k \in N \setminus G \\
& \underline{P}_{g_i} \leq \Tr(\mathbf{\Psi}_{P,i}^\varphi \mathbf{X}) {+} P_{l_i}^\kappa \leq \overline{P}_{g_i},
\forall \varphi \in \phi_i, \kappa \in \psi_i, i \in G \\
& \underline{Q}_{g_i} \leq \Tr(\mathbf{\Psi}_{Q,i}^\varphi \mathbf{X}) {+} Q_{l_i}^\kappa \leq \overline{Q}_{g_i},
\forall \varphi \in \phi_i, \kappa \in \psi_i, i \in G \\
& (\underline{V}_k)^2 \leq \Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) \leq (\overline{V_k})^2,
\forall \varphi \in \eta_k, k \in N^+, \\
& [\mathbf{X}]_{\phi_0 \times \phi_0} = \mathbf{v}_0 \mathbf{v}_0^H \\
& \mathbf{X} \succeq 0, \\
& \rank(\mathbf{X}) = 1
\end{flalign}
\end{subequations}
\end{document}
答案2
您可以使用该optdef
包:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{amsmath}
\DeclareMathOperator\Tr{Tr}
\DeclareMathOperator\rank{rank}
\usepackage{optidef}
\begin{document}
\begin{mini!}|l|[0]
{\mathbf{X}}{f(\mathbf{X})}
{}
{\label{eq:OF2}}{}
\addConstraint{}{ \Tr(\mathbf{\Psi}_{P,k}^\varphi \textbf{X}) + P_{l_k}^\kappa = 0,}{\quad\forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\setminus G \label{eq:PBL2}}
\addConstraint{}{\Tr(\mathbf{\Psi}_{Q,k}^\varphi \mathbf{X}) + Q_{l_k}^\kappa-y_{c_k}^\kappa Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) = 0,}{ \quad\forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\setminus G\label{eq:QBL2}}
\addConstraint{}{\:\underline{P\!}_{\mkern1mu g_i} \leq \Tr(\mathbf{\Psi}_{P,i}^\varphi \mathbf{X}) + P_{l_i}^\kappa \leq \overline{P}_{g_i},} {\quad \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:PBG2}}
\addConstraint{}{\, \underline{Q}_{g_i} \leq Tr(\mathbf{\Psi}_{Q,i}^\varphi \mathbf{X}) + Q_{l_i}^\kappa \leq \overline{Q}_{g_i},} {\quad \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:QBG2}}
\addConstraint{}{\,\underline{V}_k)^2 \leq \Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) \leq (\overline{V_k})^2,} {\quad\forall \varphi \in \eta_{k}, k \in N^+\label{eq:Vol2}}
\addConstraint{}{\mkern1.5mu[\mathbf{X}]_{\phi_{0}\times \phi_{0}} = \mathbf{v}_0\mathbf{v}_0^\mathit{H}}
\addConstraint{}{\mkern1.5mu[\mathbf{X}]\succeq 0}
\addConstraint{}{\rank(\mathbf{X})=1 \label{rank_con}}
\end{mini!}
\end{document}
答案3
找到合适的东西非常困难,但也许
\documentclass[conference]{IEEEtran}
\usepackage{amsmath}
\DeclareMathOperator\Tr{Tr}
\DeclareMathOperator\rank{rank}
\begin{document}
\begin{subequations}
\begin{equation}
\mathbf{P2}\; \min_{\mathbf{X}} \qquad f(\mathbf{X})\label{eq:OF2}\\
\end{equation}
subject to
\begin{flalign}
&\scriptstyle\Tr(\mathbf{\Psi}_{P,k}^\varphi \mathbf{X}) + P_{l_k}^\kappa = 0,
\quad \forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \hfill X\label{eq:PBL2}\\
&\scriptstyle\Tr(\mathbf{\Psi}_{Q,k}^\varphi \mathbf{X}) + Q_{l_k}^\kappa-y_{c_k}^\kappa \Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) = 0,
\quad \forall \varphi \in \phi_{k}, \kappa \in \psi_{k}, k \in N\backslash G \label{eq:QBL2}\\
&\scriptstyle\underline{P}_{g_i} \leq \Tr(\mathbf{\Psi}_{P,i}^\varphi \mathbf{X}) + P_{l_i}^\kappa \leq \overline{P}_{g_i},
\quad \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:PBG2}\\
&\scriptstyle\underline{Q}_{g_i} \leq \Tr(\mathbf{\Psi}_{Q,i}^\varphi \mathbf{X}) + Q_{l_i}^\kappa \leq \overline{Q}_{g_i},
\quad \forall \varphi \in \phi_{i}, \kappa \in \psi_{i}, i \in G \label{eq:QBG2}\\
&\scriptstyle(\underline{V}_k)^2 \leq \Tr(\mathbf{\Psi}_{V,k}^\varphi \mathbf{X}) \leq (\overline{V_k})^2,
\quad\forall \varphi \in \eta_{k}, k \in N^+,\label{eq:Vol2}\\
&\scriptstyle [\mathbf{X}]_{\phi_{0}\times \phi_{0}} = \mathbf{v}_0\mathbf{v}_0^\mathit{H}\\
&\scriptstyle\mathbf{X}\succeq 0,\\
&\scriptstyle\rank(\mathbf{X})=1 \label{rank_con}
\end{flalign}
\end{subequations}
\end{document}
请注意,除了对齐之外, \mathbf
不要\textbf
使用数学粗体字母,也不要对 rank 或 Tr 等运算符使用数学斜体,字体的设计目的是使相邻的字母看起来不像一个单词,而像单字母变量的乘积。