# Vertical Spacing and Alignment for Equations [closed]

How can I set the vertical spacing for all equations at once? And how can I align them to the left without use \usepackage[fleqn]{amsmath} in preambule?

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{standalone}
\usepackage{txfonts}
\usepackage{wallpaper}

\usepackage{indentfirst}
\setlength\parindent{1.25cm}

\usepackage{graphicx}

\usepackage{titletoc}

\usepackage{setspace}
\singlespacing

\usepackage[fleqn]{amsmath}
\makeatletter
\setlength\abovedisplayskip{0mm}
\setlength\belowdisplayskip{5mm}
\setlength\abovedisplayshortskip{0mm}
\setlength\belowdisplayshortskip{0mm}
}
\makeatother

\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage{titling}
\usepackage{titlesec}

\begin{document}
$$y(t) = \sqrt{y_{0}^{2} + \bigg(\frac{v_{0}}{\omega} \bigg)^{2}} \ sin(\omega t + \alpha) \ = \ \sqrt{y_{0}^{2} + \bigg(\frac{v_{0}}{\omega} \bigg)^{2}} \ cos(\omega t - \beta)$$
\end{document}

## closed as off-topic by Mico, lockstep, Mensch, yo', moeweOct 4 '15 at 17:26

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• fleqn option is the way to align all equations to the left (there is essentially no other way, although you could look at the code that runs and run it "by hand" why? and the settings that you show for \abovedisplay skip are the settings to set, but also \abovedisplayshortskip and \belowdisplayshortskip – David Carlisle Oct 4 '15 at 10:01
• your comment to the answer, citing error messages from amsmath shows that you haven't given all the relevant information in your sample. please provide a compilable example that prospective testers can experiment with. then you are more likely to get a fully working answer. – barbara beeton Oct 4 '15 at 13:49
• I'm asking what's the purpose of removing vertical space above displays, but leaving huge space below. – egreg Oct 4 '15 at 15:34
• I'm voting to close this question as off-topic because the one of the two questions posed by the OP is based on a mis-understanding, viz., that the txfonts package doesn't load macros that conflict with those in the amsmath package. – Mico Oct 4 '15 at 15:45

Your posting contains two separate queries.

How can I set the vertical spacing for all equations at once?

The four relevant length parameters are \abovedisplayskip, \abovedisplayshortskip, \belowdisplayskip, and \belowdisplayshortskip. Set them to whatever values you like.

And, how can I align them to the left without [writing] \usepackage[fleqn]{amsmath} in [the preamble]?

To answer a question with a question: Why would you not want to use this approach? As David Carlisle has already pointed in a comment, this approach is the preferred method for having left-aligned (as opposed to centered) displayed equations. Please state what's wrong -- in your view -- with this method.

• The vertical spacing problem was solved. But, amsmath give me a lot of "errors", as seen on this image: [link] (pt-br.tinypic.com/r/k0r05s/8). There's another package that works in the same way? – Pedro Felipe Oliveira Oct 4 '15 at 11:59
• @PedroFelipeOliveira - Which other math-related packages do you load? And, have you tried changing the order in which amsmath and any other math-related packages are loaded in the preamble? – Mico Oct 4 '15 at 12:04
• amsmath is the only math-related package that I'm using. – Pedro Felipe Oliveira Oct 4 '15 at 14:33
• @PedroFelipeOliveira - Actually, the txfonts package loads lots of math-related macros! The simple solution is to load amsmath before txfonts. – Mico Oct 4 '15 at 15:20

The \usepackage{txfonts} should be loaded after \usepackage[fleqn]{amsmath}. The example based on reduced your code:

\documentclass[a4paper,12pt]{article}
\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage[utf8]{inputenc}

\usepackage{standalone}
\usepackage[fleqn]{amsmath}% should be before txfonts
\makeatletter
$$y(t) = \sqrt{y_{0}^{2} + \bigg(\frac{v_{0}}{\omega} \bigg)^{2}} \ sin(\omega t + \alpha) \ = \ \sqrt{y_{0}^{2} + \bigg(\frac{v_{0}}{\omega} \bigg)^{2}} \ cos(\omega t - \beta)$$