Search code examples
latexspacingrow-height

LaTeX: Avoid the increase of text row height due to inline math


In the following example code the height of the second row of text increases due to the presence of the inline math formula:

\documentclass{article}
\linespread{0.9}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, 
felis. $A_n^{\{x\}}$ Curabitur dictum gravida mauris. Nam arcu 
libero, nonummy eget, consectetuer id, vulputate a, magna. 
\end{document}

Image

How can this be avoided without changing the general linespread, so that the height of the second row is identical to that of the other rows?


Solution

  • You can \smash the inline math formula:

    enter image description here

    \documentclass{article}
    
    \begin{document}
    
    % Default layout/spacing
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
    Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, 
    felis. $A_n^{\{x\}}$ Curabitur dictum gravida mauris. Nam arcu 
    libero, nonummy eget, consectetuer id, vulputate a, magna. 
    
    % Smashed inline math
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
    Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, 
    felis. \smash{$A_n^{\{x\}}$} Curabitur dictum gravida mauris. Nam arcu 
    libero, nonummy eget, consectetuer id, vulputate a, magna. 
    
    \end{document}
    

    However, it's obvious that tall [deep] inline expressions may butt into descenders [ascenders] of the line above [below].