0

I have a definition in which there is some mathematical text being used. The spacing between the lines is proving to be too much for my liking and my editor also lists this as a badbox. The LaTeX code that I am using is:

\begin{defn} An \emph{affine combination} of points $x_1, x_2, \ldots, x_k$ is given by $\sum\limits_{i=1}^k \lambda_{i}x_{i}$, where $\lambda_1,\ldots, \lambda_k \ \in \mathbb{R}$ and $\sum\limits_{i=1}^k \lambda_{i} = 1$. A set of points is said to be \emph{affinely independent} if no point is an affine combination of the others.
\end{defn}

And the output I get is:

enter image description here

Could someone please help me with reducing the gap between the lines? Thanks!

  • 2
    Stop saying \limits! Just use \sum_{i=0}^k. This will be compact when inline and tall in display mode. – Mark Jul 3 '15 at 22:01
  • 1
    Generally, we appreciate it if you provide a complete MWE that reproduces the example you would like us to consider. That way we don't have to guess what packages and definitions you've created. – A.Ellett Jul 3 '15 at 22:22
  • Welcome! I know that sometimes \limits or \nolimits is required by disciplinary convention but, if not, @Mark's suggestion is good here. – cfr Jul 3 '15 at 22:31
  • @A.Ellett I'm new here which is why I didn't know that. Also, what does MWE stand for? – Ad22 Jul 4 '15 at 22:49
2

Warning: this is not a general solution. This is a solution to be applied after you've completed most of your document.

As already mentioned in the comments, you could get around this issue by removing the use of \limits:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}

\begin{defn} 
  An \emph{affine combination} of points $x_1, x_2, \dots, x_k$ 
  is given by $\sum_{i=1}^k \lambda_{i}x_{i}$, where 
  $\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum_{i=1}^k \lambda_{i} = 1$. 
  A set of points is said to be \emph{affinely independent} if no point is 
  an affine combination of the others.
\end{defn}

\end{document}

enter image description here

If you are wed to the idea of having the limits placed as you have placed them, then you can use \smash on the first instance:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}

\begin{defn} 
  An \emph{affine combination} of points $x_1, x_2, \dots, x_k$ 
  is given by $\smash{\sum\limits_{i=1}^k} \lambda_{i}x_{i}$, where 
  $\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum\limits_{i=1}^k \lambda_{i} = 1$. 
  A set of points is said to be \emph{affinely independent} if no point is 
  an affine combination of the others.
\end{defn}

\end{document}

which results in

enter image description here

As noted by @egreg, \smash, as redefined by amsmath, takes an optional argument. Either \smash[b] or \smash[t] where the first smashes the vertical depth to zero but does not effect the height, and the second smashes the vertical height to zero, but does not effect the depth:

\documentclass{article}
\usepackage{amsmath}
\setlength{\fboxsep}{0pt}
\begin{document}

I've set the \verb-\fboxsep- to \verb-0pt-, notice how in the first example, the \verb-\fbox- looks only like a line.
\[
  \text{Smash removing vertical height and depth:} \quad
  \fbox{$\smash{\sum\limits_{i=1}^k}$}
\]

\[
  \text{Smash removing only the vertical depth:} \quad
  \fbox{$\smash[b]{\sum\limits_{i=1}^k}$}
\]


\[
  \text{Smash removing only the vertical height:} \quad
  \fbox{$\smash[t]{\sum\limits_{i=1}^k}$}
\]


\end{document}

enter image description here

In the first example, the last two lines look a bit too close, so you can add a strut (I did this using \rule):

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{defn}{Definition}
\begin{document}

\begin{defn} 
  An \emph{affine combination} of points $x_1, x_2, \dots, x_k$ 
  is given by $\sum_{i=1}^k \lambda_{i}x_{i}$, where 
  $\lambda_1,\dots, \lambda_k \in \mathbb{R}$ and $\sum_{i=1}^k\rule[-1.25ex]{0pt}{1pt} \lambda_{i} = 1$. 
  A set of points is said to be \emph{affinely independent} if no point is 
  an affine combination of the others.
\end{defn}

\end{document}

enter image description here

  • \smash[b] in the top line although not in this case, where the space above the definition text compensates. It would be necessary if the first summation is in the second line. The “control space” before \in is wrong and \ldots should be \dots. You could first of all suggest the solution without \limits. – egreg Jul 3 '15 at 22:22
  • @egreg Ah yes indeed. – A.Ellett Jul 3 '15 at 22:29
0

Combinig \smash where necessary, and a local slight modification of \baselineskip with the setspace package:

\documentclass[a4paper]{article}
\usepackage{amsmath, amsfonts}
\usepackage{nccmath}

\setlength\parindent{1em}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\theoremstyle{plain}
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\itshape}
\theoremseparator{.}
\newtheorem{defn}{Definition}
\usepackage{setspace}
\setstretch{1.2}

\begin{document}

\setcounter{defn}{3}
\begin{defn} An \emph{affine combination} of points $x_1, x_2, \ldots, x_k$ is given by $\smash[b]{\sum\limits_{i=1}^k} \lambda_{i}x_{i}$, where $\lambda_1,\ldots, \lambda_k \ \in \mathbb{R}$ and $ \sum\limits_{i=1}^k \lambda_{i} = 1$. A set of points is said to be \emph{affinely independent} if no point is an affine combination of the others.
\end{defn}

\end{document} 

enter image description here

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.