1

I would like to know if there is any command which adjusts the vertical spacing of a line automatically to fully display the mathematical equation or formula in that line? For example,

\documentclass[11pt,a4paper]{article}
\begin{document}
-Hello everyone, $\lim_{n\to\infty}d(x_n^{C_1},x_n^{C_2})$ exists,
\end{document}

Running the above code shows that the infinity sign is located next to lim not under it due to tightly set vertical spacing. I do not wish to use $$ or any align for this because

  1. Such commands would start the formula in a new line and

  2. For a long equation, using such commands often result in the equation overflowing into the margin.

I like the current font size and tight line spacing and would just like to relax the vertical line spacing a little to display the 'limit' equation as it should only for the line that contains it.

Moriambar
  • 11,466
James
  • 249
  • 1
    note the setting is due to it being inline not really due to the line spacing, even if you set \renewcommand\baselinestretch{5} and had massive inter-line space, then by default limits are set to the right unless you use \limits or, for the whole expression, use \displaystyle – David Carlisle Apr 14 '17 at 19:40
  • see https://tex.stackexchange.com/questions/323367/i-have-a-question-about-the-displaystyle-command/323375#323375 for examples of paragraphs made unreadable by changing the line spacing in this way. – David Carlisle Apr 14 '17 at 19:49

2 Answers2

1

Please mind that typesetting big formulas or formulas with great height/depth yields a really ugly result in text mode (i.e. what you are trying to do).

The solution to your command is \limits, ie:

\documentclass[11pt,a4paper]{article}
\begin{document}
-Hello everyone, $\lim\limits_{n\to\infty}d(x_n^{C_1},x_n^{C_2})$ exists,
\end{document}

which produces

enter image description here

Another solution, as @DavidCarlisle commented, would be using the \displaystyle command, as in:

 -Hello everyone, $\displaystyle\lim_{n\to\infty}d(x_n^{C_1},x_n^{C_2})$ exists,

this will apply to the whole formula.

Nevertheless I recommend you to read amsmath document package: typesetting display math with that package is really easy (well it's easy with LaTeX too, but it's better that way) and it also provides many environments which will permit you to split long equations over many lines.

I bet you use LaTeX to obtain beautiful typeset documents, and they are done using display math (alongside some text math).

To obtain the documentation you should type in your command prompt/terminal window the following:

texdoc amsmath

A search on the web could bring you to the CTAN website, but there's no need to go there.

I strongly recommend you browse the most voted questions of TeX.SE to find some insight and newbies guides, such as:

http://www.dickimaw-books.com/latex/novices/index.html

Moriambar
  • 11,466
  • Thank you so much for your kind answer. May I ask where I could find the document package? – James Apr 14 '17 at 19:37
  • @James edited with the commands, so that you can accept it. I also took the liberty of adding some resources to start :) – Moriambar Apr 14 '17 at 19:41
0

To make inline math appear the same as when using equation and other displayed math environments, you simply add \displaystyle without changing your code. That said, I strongly recommend against doing so inside paragraphs, it only serves to make the text uglier with uneven line spacing appearance.

\documentclass[11pt,a4paper]{article}
\usepackage{tabularx}
\begin{document}

\begin{tabularx}{\linewidth}{|X|X|}\hline
this is one line above ... 
-Hello everyone, $\displaystyle\lim_{n\to\infty}d(x_n^{C_1},x_n^{C_2})$ exists, ... 
and this is one line below ... 
&
this is one line above ... 
-Hello everyone, $\lim_{n\to\infty}d(x_n^{C_1},x_n^{C_2})$ exists, ... 
and this is one line below ... \\ \hline
\end{tabularx}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127