[Tex/LaTex] Writing a limit so that the subscript goes directly underneath

spacingsubscripts

When I write $\lim_{x \rightarrow p} f(x) = q$, the subscript x \rightarrow p appears to the right of the limit, instead of directly underneath it.

When I try $\displaystyle \lim_{x \rightarrow p} f(x) = q$, the subscript of the limit takes up extra space, making the line taller than usual and creating an awkward extra space underneath everything else…

Is there a way to write limits in-line with the subscript underneath, and everything squished to the normal height of the line its in?

Best Answer

One way would be to use \scalebox from the graphicx package to rescale the version obtained by \displaystyle. Here is a comparison of the usual inline version of \lim and the scaled version:

enter image description here

\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}

\newcommand{\Text}{\noindent Lorem ipsum dolor sit amet.  
Lorem ipsum dolor sit amet. 
Lorem ipsum dolor sit amet }

\newcommand{\Lim}[1]{\raisebox{0.5ex}{\scalebox{0.8}{$\displaystyle \lim_{#1}\;$}}}

\usepackage{graphicx}
\begin{document}
\Text 
$\textcolor{blue}{\lim_{x \rightarrow p} f(x) = q}$
\Text
$\textcolor{red}{\Lim{x \rightarrow p} f(x) = q}$
\Text 
\end{document}
Related Question