# Too much vertical space when displaying formulas in LyX

When I display formulas in LyX, it leaves way too much space between the text. The commands I have used are Insert -> Math -> Display Formula and Insert -> Math -> AMS multline Environment. However, the PDF looks exactly the same:

Is there a way to display formulas while not going beyond "double spaced"? Are there any packages to add which will avoid this problem?

EDIT: Problematic portion exported to Latex (plain)

{\large \par}


\begin{multline*} K_{0}(\theta)=\lbrace\langle m;b_{1},b_{2},\ldots\rangle_{\theta}:b_{j}\,\text{is eventually even and }\lim_{j\to\infty}b_{j}n_{j}\Vert n_{j}\theta\Vert=0\rbrace,\ K_{1}(\theta)=\lbrace\langle m;b_{1},b_{2},\ldots\rangle_{\theta}:\sum_{j=1}^{\infty}|b_{j}|n_{j}||n_{j}\theta||<\infty\rbrace. \end{multline*}

-
The cause of excessive vertical space in this sort of situation is usually consecutive display math equations, or blank lines before or after a display math equation. But, without seeing the code it is hard to say for sure. –  Peter Grill Mar 30 '13 at 6:08
I didn't enter any codes. Do you want to see what it looks like on LyX? –  The Substitute Mar 30 '13 at 6:14
Ok, you may not be entering the code directly but you are "telling" LyX what code to enter. Sorry, probably better to wait for someone who uses LyX to help you, but that is one reason why I really would recommend not using things like LyX. They attempt to make things simpler by hiding all the details, but then it is difficult to figure out what went wrong. –  Peter Grill Mar 30 '13 at 6:20
The display is too wide to fit on the line, which might also be a cause for vertical spacing... –  Werner Mar 30 '13 at 7:04
If you hit enter before you add the math environment, LyX will insert an empty line in the code. To avoid this, don't hit enter before you go into math mode. –  Torbjørn T. Mar 30 '13 at 7:28

This picture is slightly different to the OP's one. The suggestions given below are used. The LaTeX code generated by LyX (with a few lines deleted) is:

\documentclass[12pt]{article}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\doublespacing
\begin{document}
each $j$. Given any integer $m$, $\left\langle m;b_{1},b_{2},\ldots\right\rangle _{\theta}:=\left(m\theta+\sum_{j=1}^{\infty}b_{j}n_{j}\theta\right)\mod1$
defines a point of $X$. Veech {[}4{]} defines
\begin{multline*}
K_{0}(\theta)=\left\{ \langle m;b_{1},b_{2},\ldots\rangle_{\theta}:b_{j}\,\text{is eventually even and }\lim_{j\to\infty}b_{j}n_{j}\left\Vert n_{j}\theta\right\Vert =0\right\} ,\\
K_{1}(\theta)=\left\{ \langle m;b_{1},b_{2},\ldots\rangle_{\theta}:\sum_{j=1}^{\infty}|b_{j}|n_{j}\left\Vert n_{j}\theta\right\Vert <\infty\right\} .
\end{multline*}
We have, corresponding to our elements of $K_{0}(\theta)$, a subset
of $\mathbb{R}$ which is a generalization of the Cantor set construction.
Define
\end{document}


First, looking at your LaTeX code, as Torbjørn T. and David Carlisle mentioned, the increased vertical space between the line containing "Veech [4]" and the multiline environment comes from a new line. In LyX you can make end of paragraphs visible under "Tools > Look & Feel > Display" otherwise the new line is invisible. Anyway, put the cursor directly after the s in "Veech [4] defines" and press Delete once to delete the new line. Note (or messure) that the distance between the baselines of "Veech [4]" and "K_0(\theta)" is the same as the distance between "K_1(\theta)" and "We have, corresponding...".

Second, looking into my crystal ball I tend to see

1. that the LaTeX code and the picture do not match, that is, for the picture the new lines in front of and after the multiline environment were removed;

2. that the font size is set to "Large" for parts of your document (or your entire document?) (font size "Large" in LyX corresponds to \large in LaTeX, as "Larger" corresponds to \Large ...);

3. that the line spacing is set to "Double".

4. that matching parentheses / delimiters were forgotten.

Not sure whether all points are true; just my guess. My suggestions are

1. (In LyX, there is also "View Source" to see the generated LaTeX code.) If there were a mismatch, maybe update the question.

2. Instead of using "Large" font size, "Reset" the font size to use "Normal" font and change "Fonts > Base Size" under "Document > Settings..." to 12pt. The default size corresponds usually to 10pt. Hence, the font size will not change ("10pt + \large = 12pt", see also here) but the width of the document will be adjusted differently for 12pt.

3. There are several rules in typography to make a text look better, although one might object to them at first. LaTeX (well, LyX is generating LaTeX code) knows about them and thinks some space around display math (e.g. multiline environment) looks better. This could also be a reason.

4. You have operators like "sum" in the formulas. Instead of using ( and ) you should consider using delimiters in math mode. (Use "Insert > Math > Delimiters" or simple the short cuts Alt+M ( or Alt+M < ...). Then the parentheses will be scaled and also some (a tiny) space will be inserted. Especially, this should be done with the ||norm||. Otherwise how to read your formula: this way | b |n| |n\theta| | or that way |b| n ||n\theta||??

-
I've edited the source code above. For future reference, is there a way to take a source code (such as yours above) and enter it into LyX? –  The Substitute Mar 30 '13 at 20:01
@TheSubstitute Some more white spaces are needed to get the mark up of the code in the question right. –  e-birk Mar 31 '13 at 23:19
@TheSubstitute You can import LaTeX code by "File > Import > LaTeX (plain)..." into LyX although this does not work so well always. Sometimes LyX oversees to convert environments that it already knows into proper styles. Then these environments end up as TeX code/ERT. Of course, you can manually adjust this... –  e-birk Mar 31 '13 at 23:21
{\large \par}

{\large
\begin{multline*}


math displays should not be separated from the surrounding paragraph by a blank line or \par and you have both here. I don't use lyx but you need to configure it not to insert these paragraph breaks.

-