Latex 中左對齊三列

Latex 中左對齊三列

我有一個多行方程式。我想將三列中的方程式左對齊。我怎樣才能在乳膠中做到這一點?

我目前正在使用

\begin{equation}
\begin{aligned}
&Column1& &Column2&  &Column3 \\
&Column1& &Column2&  &Column3 \\
&Column1& &Column2&  &Column3 \\
\end{equation} 
\end{aligned}

然而,對於上面的表達式,第三列是右對齊的,而不是左對齊的。

這是一個例子:

\begin{equation}\label{formula:QPQC} \begin{aligned} &\underset{x}{\textbf{Maximize} }& &x^TFx+2f^Tx & & \\ &\textbf{Subject to} & &p_i^Tx+p_{i0}\geq 0 &i=1,\ldots,I \\ & & &v_m^Tx+v_{m0}=0 &m=1,\ldots,M \\ & & & x^TQ_zx+2q_z^Tx+q_{z0}=0 &z=1,\ldots,Z , \end{aligned} \end{equation}

答案1

您缺少&第二列和第三列之間的一個。

以下是一些避免錯誤和改進輸出的建議:

  1. 彼此相鄰成對給出&&並保持輸入中的對齊

  2. 定義「最大化」與「服從」的宏

  3. 使用\dots而不是\ldots.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Maximize}[1]{\underset{#1}{\mathbf{Maximize}}}
\newcommand{\Subjto}{\mathbf{Subject\ to}}

\begin{document}

\begin{equation}\label{formula:QPQC}
\begin{aligned}
&\Maximize{x} && x^TFx+2f^Tx &            &&             \\
&\Subjto      && p_i^Tx+p_{i0}\geq 0      && i=1,\dots,I \\
&             && v_m^Tx+v_{m0}=0          && m=1,\dots,M \\
&             && x^TQ_zx+2q_z^Tx+q_{z0}=0 && z=1,\dots,Z,
\end{aligned}
\end{equation}

\end{document}

在此輸入影像描述

相關內容