1

In my thesis I use \linespread{1.3} to set 1.5 line space for the entire document. However, as the following screenshot shows, the two paragraphs have different line space. Is this because of the matrix there? Or is there any other reason. FYI, this is the only place I get such ugly change of line space. Is there a way to fix it, please? For example, how can I enforce the line spacing regardless of whatever else happens. Thank you!

Update:

I tried the methods in comments. They worked but not in the way I want because all parts are affected and there appeared more unpleasant white gaps. As I showed in the picture, the rest of the document looks fine. It is only that one bit looking funny. I tried to remove the matrix and it became normal after that. But I need to keep the matrix. If it helps, I paste my entire settings below.

  \documentclass[a4paper, twoside, hidelinks, 11pt]{book}

  \usepackage{etex}
  \reserveinserts{28}

  % needed to remove headers and page numbers on blank pages at the end of chapters
  \newcommand{\blanknonumber}{\newpage\thispagestyle{empty}}

  % needed for add graphics
  \usepackage{graphicx}

  % header and footer  
  \usepackage{fancyhdr}
  \fancyhead[ro, le]{}
  \fancyhead[lo]{\slshape\nouppercase{\rightmark}}
  \fancyhead[re]{\slshape\nouppercase{\leftmark}}
  \pagestyle{fancy} % Change page style to fancy
  \renewcommand{\headrulewidth}{1pt}
  \renewcommand{\footrulewidth}{0pt}

  % font
  \usepackage[T1]{fontenc}

  % chapter titles
  \usepackage[Sonny]{fncychap}
  \ChNameVar{\centering\Large\bfseries}
  \ChTitleVar{\centering\Large\bfseries}

  % author-date reference
  \usepackage[round]{natbib}

  % enumeration
  \usepackage{enumitem}

  % needed for chapter toc
  \usepackage[nohints]{minitoc}

  % needed for bold upright greek letter
  \usepackage{bm, upgreek}

  % needed for shade color
  \usepackage[usenames, dvipsnames, svgnames, table]{xcolor}
  \usepackage{framed}
  \colorlet{shadecolor}{yellow!30}

  % needed for change section title font size
  \usepackage{titlesec}
  \titleformat*{\section}{\large \bfseries}

  % needed for LaTeX graph from R
  \usepackage{tikz}

  % needed for better looking tables
  \usepackage{booktabs}
  \usepackage{multirow}

  % needed for making index
  \usepackage{imakeidx}
  \makeindex[intoc]

  \usepackage{amssymb}
  \usepackage{latexsym}
  \usepackage{amsfonts}
  \usepackage{amsthm}
  \usepackage{amsmath}

  % needed to change qed symbol
  \renewcommand{\qedsymbol}{}

  % needed for dropdown capital font
  \usepackage{type1cm}
  \usepackage{lettrine}

  % needed to add footnote in tables
  \usepackage{footnote}

  % needed to put table title before table
  \usepackage{floatrow}
  \floatsetup[table]{capposition=top}

  % needed to change footnote marker when number is misleading
  \makeatletter
  \def\@xfootnote[#1]{
    \protected@xdef\@thefnmark{#1}
    \@footnotemark\@footnotetext}
  \makeatother

  % needed for 1.5 line spacing
  \linespread{1.3} 

  % needed for bold caption
  \usepackage[labelfont=bf]{caption}

  % needed to change footnote colour
  \renewcommand\thefootnote{\textcolor{red}}

  % remove header and footer in empty pages
  \usepackage{emptypage}

  % needed to reduce gap between figure and caption
  \usepackage[skip=0pt]{caption}

  % needed to remove 1.5 line space in verbatim
  % \usepackage{fancyvrb}

  % needed to remove indentation in footnotes
  \usepackage[hang, flushmargin]{footmisc} 

  \makeatletter
  \newcommand*\mytabalign{%
      \edef\sk@align{\ifodd\c@page l\else r\fi}
      \makebox[\textwidth][\sk@align]}
  \makeatother

  % needed to add more layers in TOC
  \setcounter{tocdepth}{5}

  % needed to number subsubsections
  \setcounter{secnumdepth}{5}

  % needed to add more than 1 label
  \usepackage[capitalise]{cleveref}  

  % needed to add dots and list of figures to TOC
  \usepackage{tocbibind}
  \usepackage[titles]{tocloft}
  \renewcommand \cftchapdotsep{4.5}

  % needed to corss reference of un-numbered chapter
  \usepackage{nameref}

  % needed to add R codes
  \usepackage{listings}
  \lstset{language=R, basicstyle=\ttfamily\footnotesize, breaklines=true, backgroundcolor=\color{yellow!30}, morecomment=[l]{//}}

  % hyper links
  \usepackage{hyperref}

\begin{document}

  % set page numbers to roman and suppress chapter numbers
  \frontmatter

  % set page numbers to arabic, reset to 1
  \mainmatter

\noindent As that graph shows, the asymptotic variance decreases more rapidly when $\xi_0$ is positive so that almost every other $ \widehat \sigma_{MOP, \alpha}$ except those whose $\alpha$ is close to $\alpha_{op}$ has larger variance. Consequently, including all possible $\alpha$'s in fact inflates the variance. {\em These observations suggest that superficially using all data points is not necessarily the best way to utilise all the information contained in a sample. It might well be possible that using data in the wrong way can actually make things worse.}

\begin{table}[h]
\centering
\caption{$ \widehat \sigma_{MOP, \alpha_{op}}$ versus $ \widehat \sigma_{MOP, \alpha s}$ with $\sigma=1$ and $N=1000$.}
\label{table: MOPextension}
\begin{tabular}{rccc}
\toprule
$\xi_0$ & $\widehat \sigma_{MOP, \alpha_{op}}$ & $\widehat \sigma_{MOP, \alpha s}$ & $\widehat \sigma_{MOP, \alpha_1, \alpha_2, \alpha_3}$ \\ \midrule
-0.4    & (0.9015, 1.0985) & (0.9158, 1.0845) & (0.9045, 1.0955) \\
-0.3    & (0.9064, 1.0936) & (0.9195, 1.0804) & (0.9092, 1.0908) \\
-0.2    & (0.9116, 1.0884) & (0.9226, 1.0757) & (0.9145, 1.0855) \\
-0.1    & (0.9171, 1.0829) & (0.9254, 1.0728) & (0.9202, 1.0798) \\
0.1     & (0.9294, 1.0706) & (0.9316, 1.0659) & (0.9332, 1.0668) \\
0.2     & (0.9365, 1.0635) & (0.9346, 1.0628) & (0.9412, 1.0588) \\
0.3     & (0.9445, 1.0555) & (0.9376, 1.0601) & (0.9481, 1.0519) \\
0.4     & (0.9541, 1.0459) & (0.9401, 1.0584) & (0.9575, 1.0425) \\ \bottomrule
\end{tabular}
\end{table}

\noindent The previous discussion prompts our suggestion of only picking a few, say, three, equally spaced percentiles which are approximately centred at the $\alpha_{op}$ as listed in Table~\ref{table: 3alphas}. We can consider this an adaptive method in which we pick different $\alpha$-triples depending on the value of $\xi_0$. To see how this works, first note that for given $\alpha_1, \alpha_2$ and $\alpha_3$, the corresponding sample percentiles $\left( x_{\alpha_1N :N}, x_{\alpha_2N :N}, x_{\alpha_3N :N} \right)^T$ asymptotically follow a three-dimensional normal distribution with mean vector $\left( x_{\alpha_1}, x_{\alpha_2}, x_{\alpha_3} \right)^T$ and variance-covariance matrix $\bm\Sigma_{\alpha_1, \alpha_2, \alpha_3}$ equal to
{\footnotesize
\begin{align*}
\frac{\sigma^2}{N}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1}                    & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1}                    & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\end{align*}
\par}


% APPENDICES

  % change chapter name and counters (eg Chapter 1 -> Appendix A)
  \appendix

  % assuming there are files appendix1.tex etc...

  \include{appendix1}
  %\include{appendix3}

  \backmatter

% BIBLIOGRAPHY

  % add Bibliography to table of contents
  \bibliographystyle{biometrika}
  \bibliography{reference}

\end{document}

enter image description here

LaTeXFan
  • 1,573
  • 2
    Have you tried any other method of line streching such as \usepackage{setspace} and \setstretch{1.5} instead ? – HcN Oct 30 '15 at 02:53
  • 1
    Better to use the setspace package. It at least takes some basic precautions. On the other hand, for all we know, you're using an incompatible class, a class which does its own thing or not using LaTeX at all. I mean, really, how are we supposed to guess at the problem just from seeing the output? – cfr Oct 30 '15 at 02:54
  • 1
    \linespread{<factor>} is functionally equal to \renewcommand\baselinestretch{<factor>}; both take effect only when followed by \selectfont. I assume something in the code is "resetting" things (you'd be surprised how often some of these commands get called behind the scenes), but it is hard to say when we don't have any code to look at.... – jon Oct 30 '15 at 03:53
  • may be linespacing is set bigger inside remark environment. – touhami Oct 30 '15 at 05:53
  • @jon I have added my full settings to the question. – LaTeXFan Oct 30 '15 at 05:57
  • @cfr I have added my full settings to the question. – LaTeXFan Oct 30 '15 at 05:59
  • You need to give us code we can use to reproduce the problem. The code you've posted cannot be compiled because it calls a bunch of external files we don't have, and the code for the bit you want to change isn't included. Also, you don't say why setspace didn't work for you. – cfr Oct 30 '15 at 12:47
  • hyperref.sty should be loaded late, by the way. Either last or near-to-last if something else needs to be even later. If your distribution of TeX is current, you don't need etex. Look at the console output: if your installation is up to date, they'll be a warning telling you the code isn't being used. – cfr Oct 30 '15 at 12:50
  • consulting my crystal ball ... did you perhaps wrap the display in something like {\small ...} ? although the setting of the type size is local, the baselines persist, and the baselines of a paragraph are not "frozen" until the end of the paragraph -- and the display, in that context, is treated as part of the paragraph since there is no explicit paragraph break preceding it (by design, to prohibit a page break at that point). with an example showing your actual content, a workaround can be suggested. – barbara beeton Oct 30 '15 at 14:02
  • @barbarabeeton I think you are on it. I used {\footnotesize ...} in order to squeeze in the matrix. I have added all the codes necessary to reproduce the output. By the way, I just need to change this one bit. All other parts are fine. But using setspace would result in unexpected ugliness. – LaTeXFan Oct 30 '15 at 23:04
  • @cfr I added more codes for your consideration. By the way, etex is necessary on my MacBook, otherwise the compiling will stop in the middle and I need to hit return to continue. Is there any fix for that? (My TeXShop is up to date). Also why should I put hyper ref.sty last? – LaTeXFan Oct 30 '15 at 23:07
  • Don't use \em: that's for TeX, not LaTeX. Note also that \em calls \itshape, and \itshape calls \selectfont. So what happens in your example when you remove the \em? Also fontsize-changing commands (e.g., \footnotesize) call \@setfontsize, which calls \selectfont. Basically, your example shows why you should use the setspace package rather than try to use \linespread directly (this advice to use setspace is also in the latex2e documentation). – jon Oct 31 '15 at 02:05
  • @LaTeXFan TeXShop is just an editor. Is MacTeX up to date? Presumably not. hyperref needs to be loaded last for various reasons. Have a search for questions on this for more detail. – cfr Oct 31 '15 at 04:25
  • @cfr Yes, you are right. I updated MacTeX and the error is gone. Thanks. – LaTeXFan Oct 31 '15 at 09:21
  • @jon I think what Barbara said above is right. So long as I separate {\footnotesize ...} with the paragraph, it becomes normal. – LaTeXFan Oct 31 '15 at 09:23
  • Yes, but I was trying to explain why, and to point out how the \selectfont command is getting called behind the scenes, which is still why you should not use \linespread directly unless you know what you're doing. And, again, don't use \em: it's a deprecated command that should not be used in LaTeX (same for \it, \sf, \rm) --- especially by someone named LaTeXFan. See, e.g., this question and this question. – jon Oct 31 '15 at 17:10
  • @jon Thanks for pointing that out. I used to think TeX and LaTeX were the same thing. Sorry. – LaTeXFan Oct 31 '15 at 22:14

1 Answers1

3

tex does not apply the \baselineskip until a paragraph is completed. a math display does not automatically end a paragraph, and since you have used \footnotesize for the display, even though that is inside a local group and does not persist beyond the display, it still applies to the "unfinished" paragraph that precedes it.

to repair this, you will need to end the paragraph before the display. i suggest doing this as follows:

... equal to%
\par\nobreak
\vspace{-\abovedisplayskip}
{\footnotesize
 \begin{align*}
...

the % at the end of the text is to avoid a space that, if the line is close to the full page width, could (if you have very bad luck) result in an extra blank line. \par is self-explanatory. \nobreak is an attempt to keep the display from splitting to a new page. and the reversal of the \abovedisplayskip is to avoid the extra space that isn't needed since your baselines are already expanded.