# Avoid vertical space between text and subequations

I am using subequations environment with align and with eqnarray. In both cases, a large vertical space appears between text and equations. I don't know how to fixed that space to be the same as in equation environment...

Example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

Teniendo en cuenta que podemos relacionar el ángulo $\theta$ (figura tal) con las componentes del vector normal: This is tooo much space:

\begin{subequations}
\begin{eqnarray}
a &=& \sin \theta \\
c &=& \cos \theta = \sqrt{1 - a^2}
\end{eqnarray}
\label{eqangulos}
\end{subequations}

Podemos escribir el parámetro del rayo como... I want something like in equation environment:

$$p = \frac{\sin \theta}{C} \left(1 + \frac{u \, \sin \theta}{C} \right)^{-1} \label{eqparametro3}$$

This is good...

\end{document}


• Welcome, the code from Sebastiano (and egreg) fixes your issue, I have copied your code and their solution within the %%%%%'s and it worked perfectly, find Sebastiano's code here: tex.stackexchange.com/a/538439/245306
– user245306
Aug 21, 2021 at 10:59
• The code could probably be better adapted to your situation but I do not know enough about it to make modifications, play with it and remove or add what you need to it or ask another question specifically about their code if you need help to change it, hope this helps.
– user245306
Aug 21, 2021 at 11:06
• never leave a blank line in the source before a displayed equation. Also unrelated to vertical space, acvoid wqnarray and use align from amsmath Aug 21, 2021 at 11:20
• Thanks @LaccaseTVersicolor, it works for my code, with some changes. Thanks a lot. Aug 21, 2021 at 11:20
• unfortunately the code in the referenced answer shows the same basic error causing the problem, the blank line before the display. Aug 21, 2021 at 11:23

I have two suggestions:

• Don't allow paragraph breaks between text and a displayed equation. Remember that an all-blank line creates a paragraph break. (Depending on the material at hand, creating a paragraph break after a displayed equation can be ok, though.)

• Don't use eqnarray environments. Instead, use align environments.

\documentclass{article}
\usepackage{amsmath}  % for 'align' and 'subequation' environments
\begin{document}

Teniendo en cuenta que podemos relacionar el ángulo $\theta$ (figura tal) con las componentes del vector normal: This is good now:
\begin{subequations} % no empty line before this line
\begin{align}    % and no empty line before this line either
a &= \sin \theta \\
c &= \cos \theta = \sqrt{1 - a^2}
\end{align}
\end{subequations}

Podemos escribir el parámetro del rayo como~\dots\ I want something like in an equation environment:
$$% again: no empty line before this line p = \frac{\sin\theta}{C} \left(1 + \frac{u\sin\theta}{C} \right)^{\!-1}$$
This is also good.
\end{document}