
我正在嘗試寫一些對齊的方程,但結果有很大差距。這是我的例子:
\usepackage{amsmath}
\begin{document}
\begin{align}
\mathbf{x}(0)&=\mathbf{x}_0; && \mathbf{v}_x(0) &=\mathbf{v}_{x0}; && \dot{\mathbf{v}}_x(0)&=\omega_c\mathbf{v}_{y0}; \\
\mathbf{y}(0)&=\mathbf{y}_0; && \mathbf{v}_y(0) &=\mathbf{v}_{y0}; && \dot{\mathbf{v}}_y(0)&=-\omega_c\mathbf{v}_{x0}; \\
\mathbf{z}(0)&=\mathbf{z}_0; && \mathbf{v}_z(0) &=\mathbf{v}_{z0}; && \dot{\mathbf{v}}_z(0)&=0.
\label{eq1}
\end{align}
\end{document}
這是輸出:
如何去除第二行的空間?
答案1
環境中align
有成對的右對齊和左對齊的列;自動計算的空間將這些列對分開。要從一列轉到下一列,請使用&
.
因此你的程式碼應該是
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\mathbf{x}(0)&=\mathbf{x}_0; & \mathbf{v}_x(0) &=\mathbf{v}_{x0}; & \dot{\mathbf{v}}_x(0)&=\omega_c\mathbf{v}_{y0}; \\
\mathbf{y}(0)&=\mathbf{y}_0; & \mathbf{v}_y(0) &=\mathbf{v}_{y0}; & \dot{\mathbf{v}}_y(0)&=-\omega_c\mathbf{v}_{x0}; \\
\mathbf{z}(0)&=\mathbf{z}_0; & \mathbf{v}_z(0) &=\mathbf{v}_{z0}; & \dot{\mathbf{v}}_z(0)&=0.
\label{eq1}
\end{align}
\end{document}
然而,從您設定的單一標籤來看,您似乎只想用一個數字來標記它,因此您可能希望aligned
嵌套在equation
.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}\label{eq1}
\begin{aligned}
\mathbf{x}(0)&=\mathbf{x}_0; & \mathbf{v}_x(0) &=\mathbf{v}_{x0}; & \dot{\mathbf{v}}_x(0)&=\omega_c\mathbf{v}_{y0}; \\
\mathbf{y}(0)&=\mathbf{y}_0; & \mathbf{v}_y(0) &=\mathbf{v}_{y0}; & \dot{\mathbf{v}}_y(0)&=-\omega_c\mathbf{v}_{x0}; \\
\mathbf{z}(0)&=\mathbf{z}_0; & \mathbf{v}_z(0) &=\mathbf{v}_{z0}; & \dot{\mathbf{v}}_z(0)&=0.
\end{aligned}
\end{equation}
\end{document}