I am writing equations in array environments, but when there are fractions in some lines, the vertical space between these lines is too small. See this example:
for the following code:
\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{setspace}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\begin{document}
\[
\begin{array}{l}
\dfrac{2-x}{x^2-16}=\dfrac{3}{x^2+4x}\\
\dfrac{2-x}{(x+4)(x-4)}=\dfrac{3}{x(x+4)}\\
\dfrac{x(2-x)}{x(x+4)(x-4)}=\dfrac{3(x-4)}{x(x+4)(x-4)}\\
x(2-x)=3(x-4)\\
2x-x^2=3x-12\\
0=x^2+x-12\\
0=(x+4)(x-3)\\
\end{array}
\]
\end{document}
I could adapt each line space by using \\[15pt]
(for instance) or any vertical space at the end of the line, but this means that I have to do it for every line containing a fraction, which is a bit boring.
Another option is to use \def\arraystretch{2.7}
(for instance) but then although the vertical spaces between lines with fractions is good, the vertical space between lines without fractions is too big. See this example:
With the following code:
\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{setspace}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\begin{document}
\[\def\arraystretch{2.7}
\begin{array}{l}
\dfrac{2-x}{x^2-16}=\dfrac{3}{x^2+4x}\\
\dfrac{2-x}{(x+4)(x-4)}=\dfrac{3}{x(x+4)}\\
\dfrac{x(2-x)}{x(x+4)(x-4)}=\dfrac{3(x-4)}{x(x+4)(x-4)}\\
x(2-x)=3(x-4)\\
2x-x^2=3x-12\\
0=x^2+x-12\\
0=(x+4)(x-3)\\
\end{array}
\]
\end{document}
So my question is: in an array environment, is there a way to set space between text, and not between rows? Something that would set the space between the top of the row and the top of the text, and between the bottom of the text and the bottom of the row. Maybe for the whole document? I hope I am clear enough... Thank you anyway for your help and attention!
What I am willing should also work for more complicated equations, like this one:
with this code:
\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{setspace}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\begin{document}
\[
\begin{array}{lll|l}
\multicolumn{2}{l}{\dfrac{2-x}{x^2-16}=\dfrac{3}{x^2+4x}} & &\\%[.4cm]
\multicolumn{2}{l}{\dfrac{2-x}{(x+4)(x-4)}=\dfrac{3}{x(x+4)}} & &\\%[.4cm]
\multicolumn{2}{l}{\dfrac{x(2-x)}{x(x+4)(x-4)}=\dfrac{3(x-4)}{x(x+4)(x-4)}} & &\cdot x(x-4)(x+4)\quad (\neq 0\mbox{ car }x\in\mathcal{D}_x)\\[.4cm]
\multicolumn{2}{l}{x(2-x)=3(x-4)} & &\\%[.4cm]
\multicolumn{2}{l}{2x-x^2=3x-12} & &\\%[.4cm]
\multicolumn{2}{l}{0=x^2+x-12} & &\\%[.4cm]
\multicolumn{2}{l}{0=(x+4)(x-3)} & &\\%[.4cm]
\mbox{Soit } &x+4=0 & &-4\\%[.4cm]
&x=-4 & &\notin\mathcal{D}_x\\%[.4cm]
\mbox{Soit } &x-3=0 & &+3\\%[.4cm]
&x=3 & &\in\mathcal{D}_x\\%[.4cm]
\end{array}
\]
\end{document}
array
is not designed for displayed equations. It is much better to usealign*
fromamsmath
it has better spacing and is displaymath so you would not need\dfrac
left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm
may be expressed more simply asmargin=2.5cm
.align*
environment would work, because I also have some more complicated equations - see my last example here above, in my edited question. See also my previous question here: tex.stackexchange.com/questions/651780/… I really think I should work on vertical spaces in array environment. But if it really is not possible, I could live with adapting the space for each line with the command\\[15pt]
or the vertical space I like...