4

I'm using a Latex template. They provide the following command for double space

%% To produce output with the desired line spacing, the argument of
%% \spacing should be multiplied by 5/6 = 0.8333, so that 1 1/2 spaced
%% corresponds to \spacing{1.5} and double spaced is \spacing{1.66}.
\def\normalspacing{1.25} % default line spacing

I've tried to use their command but it is not working. I've decided to use \usepackage{setspace} and use

\begin{spacing}{1.5}
...
\end{spacing}

Now the double space works but I have noticed too much space before and after align. As you can see from the following picture how much space between the blocks.

enter image description here

How to control the vertical space for align mode?

This is a sample that mimics my work

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{blindtext}

\begin{document}

\begin{spacing}{1.5}


hhs haha ahaha ha aha ahahaha ha ahaha aha 
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah  ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha 

\begin{align}
x = 
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}

hhs haha ahaha ha aha ahahaha ha ahaha aha 
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah

\begin{align}
x = 
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}
\blindtext


\end{spacing}

\end{document}
  • 2
    Dont' leave blank line before and after align. – user11232 Mar 19 '15 at 4:14
  • @HarishKumar, you are right but this is really hard to read the code. – CroCo Mar 19 '15 at 4:16
  • You can put a % instead of blank line. – user11232 Mar 19 '15 at 4:17
4

Never leave empty lines before and after align, equation etc environments. If you want put a % instead of blank lines. Then spacing will be alright.

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{blindtext}

\begin{document}

\onehalfspacing
hhs haha ahaha ha aha ahahaha ha ahaha aha
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah  ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha
%
\begin{align}
x =
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}
%
hhs haha ahaha ha aha ahahaha ha ahaha aha
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah
%
\begin{align}
x =
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}
%
\blindtext


\end{document}

enter image description here

| improve this answer | |
4

If you want blank lines before align in your code, you can insert

\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}

inside your spacing environment

MWE:

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{blindtext}

\begin{document}

\begin{spacing}{1.5}
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}


hhs haha ahaha ha aha ahahaha ha ahaha aha
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah  ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha

\begin{align}
x =
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}

hhs haha ahaha ha aha ahahaha ha ahaha aha
ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha  ahahah ahaha ahahahaha ahah ah hhs haha ahaha ha aha ahahaha ha ahaha aha ahahah ahaha ahahahaha ahah ah

\begin{align}
x =
\begin{bmatrix}
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss \\
ss & ss & ss & ss
\end{bmatrix}
\end{align}
\blindtext


\end{spacing}

\end{document} 

enter image description here

| improve this answer | |

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.