3

I wish to center the 3 vertical dots and align this equation but am not able to do so in the below code.
How shall I do it?

\begin{multline}
%\begin{center}
\dot{x}=x_1 \\
\dot{x_1}=x_2 \\
\vdots \\
\dot{x_n}= -\frac{f_0}{f_n}x_1  -\frac{f_1}{f_n}x_2- \cdots -\frac{f_{n-1}}{f_n}x_n
%\end{center}
\end{multline}
  • Can you please give the complete code how to do it – ShiS Mar 21 '18 at 12:39
2

mathtools (an extension to amsmath) provides a macro for this:

\documentclass[12pt]{article}

\usepackage{mathtools} % loads amsmath

\begin{document}

\begin{align*}
\dot{x} &= x_1 \\
\dot{x}_1 & =x_2 \\
&\vdotswithin{=} \\
\MTFlushSpaceAbove
\dot{x}_n& = -\frac{f_0}{f_n} x_1  -\frac{f_1}{f_n}x_2- \cdots -\frac{f_{n-1}}{f_n}x_n
\end{align*}

\end{document}

enter image description here

The tweak with \MTFlushSpaceAbove is needed because of the fractions in the last line. Note furthermore that I replaced \dot{x_1} by \dot{x}_1.

  • 2
    Just use & \shortvdotswithin{=} with no \\ at the end, then it uses even less space – daleif Mar 21 '18 at 18:44
  • @daleif I had tried it, but it felt too tight to me. But I can add it out of completeness. – campa Mar 22 '18 at 8:09
  • I upvote you also for my previous errors :-)+1. – Sebastiano Mar 24 '18 at 20:41
3

A tabular stack could work here, in lieu of aligned.

\documentclass{article}
\usepackage{tabstackengine}
\TABstackMath
\begin{document}
\begin{equation}
\setstacktabulargap{0pt}% Horz. gap between columns
\setstackgap{L}{1.2\baselineskip}% Vert. baselineskip between rows
\TABbinary% apply {} before and after each cell to set proper = spacing
\tabularCenterstack{rcl}{
\dot{x}&=&x_1 \\
\dot{x_1}&=&x_2 \\
&\vdots&}
\end{equation}
\end{document}

enter image description here

1

enter image description here

Use the array environment:

\begin{equation}
    \begin{array}{c @{\thickspace}c @{\thickspace}c l}
        \dot{x} &= & x_{1} & \\
        \dot{x}_{1} &= & x_{2} & \\
        &\vdots& \\
        \dot{x}_n &= & - & \hspace{-3mm} \frac{f_0}{f_n} x_1  -\frac{f_1}{f_n}x_2- \cdots -\frac{f_{n-1}}{f_n}x_n
    \end{array}
\end{equation}
  • Thanks for the suggestion. Now it is handling appropriately by doing further customizations to the columns. – Al-Motasem Aldaoudeyeh Mar 21 '18 at 13:04
  • the first minus sign in the last line should be a unary minus. you can tidy that up by wrapping that minus in braces. – barbara beeton Mar 21 '18 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.