2

I am trying to write some aligned equations, but a get a big gap in the result. Here is my example:

   \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}

And this is the output:

enter image description here

How can I get rid of the space in the second row?

Anthill
  • 25

1 Answers1

4

In the align environment there are pairs of right and left aligned columns; automatically computed space separates those pairs of columns. To go from a column to the next one you use &.

Thus your code should be

\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}

enter image description here

However, you seem to want to label this with just one number, judging from the single label you set, so you probably want aligned nested in 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}

enter image description here

egreg
  • 1,121,712