Math & Sciencevertical spacing gather

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

vertical spacing gather

Post by Michael7496 »

Hello,

here is a minumum example:

Code: Select all

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\begin{document}
	\begin{gather*}
		\begin{array}{c}
			\dfrac{a}{b}\\
			\dfrac{c}{d}
		\end{array}
	\end{gather*}
\end{document}
There is no space between b and c. I have a very large document and I'm using this very often. I want to change the minimum distance between that kind of configuration globally.

I searched in some documentations and forums but I didn't find a solution.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

vertical spacing gather

Post by tom »

Add the following line to your preamble:

Code: Select all

\renewcommand*{\arraystretch}{2.2}
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

vertical spacing gather

Post by Michael7496 »

This does not work. Here is a minimum example:

Code: Select all

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}

\renewcommand*{\arraystretch}{2.2}

\begin{document}
	\begin{gather*}
		\begin{array}{rl}
			\begin{array}{c}%equations
				\dfrac{a}{b} = 0\\
				\dfrac{c}{d} = 0
			\end{array}
			&
			\begin{array}{rl}%variable explanations
				a & $this is an a$\\
				b & $this in a b$\\
				c & $this is a c$\\
				d & $this is a d$
			\end{array}
		\end{array}
	\end{gather*}
\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

vertical spacing gather

Post by Johannes_B »

What do you mean by "It does not work"? Can you be more specific?
Click on Open in writelatex just above your own minimal example.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

Re: vertical spacing gather

Post by Michael7496 »

Try it once with and once without the advice and you will see what I mean: the array with explanation of variables changes too. That does not look good.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

vertical spacing gather

Post by Johannes_B »

You wanted to have a global solution. Tom gave you one.

You could define a copy of array where the scope of arraystretch is limited. And just replace some of the arrays with the modification.


Doing this locally is possible, too. But i guess that's not what you want.

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Welcome to writeLaTeX --- just edit your LaTeX on the left,
% and we'll compile it for you on the right. If you give 
% someone the link to this page, they can edit at the same
% time. See the help menu above for more info. Enjoy!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}

\begin{document}
        \begin{gather*}
                \begin{array}{rl}\begingroup
                \renewcommand*{\arraystretch}{2.2}
                        \begin{array}{c}%equations
                                \dfrac{a}{b} = 0\\
                                \dfrac{c}{d} = 0
                        \end{array}
                        \endgroup
                        &
                        \begin{array}{rl}%variable explanations
                                a & $this is an a$\\
                                b & $this in a b$\\
                                c & $this is a c$\\
                                d & $this is a d$
                        \end{array}
                \end{array}
        \end{gather*}
\end{document}
My best
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

Re: vertical spacing gather

Post by Michael7496 »

It was not a solution. I want to change the minimum vertical distance between 2 characters. I do not want to stretch something. I will make a minimum example where your local solution does not work. Just wait some minutes/hours.
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

vertical spacing gather

Post by Michael7496 »

Here is the promised minimum example:

Code: Select all

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}

\begin{document}
	\begin{gather*}
		\begin{array}{rl}
			\begingroup
				\renewcommand*{\arraystretch}{6.0}
				\begin{array}{c}
					\dfrac{a}{b \cdot \dfrac{a}{b \cdot \dfrac{a}{b \cdot \dfrac{a}{b}}}}\\
					\dfrac{a \cdot \dfrac{a \cdot \dfrac{a \cdot \dfrac{a}{b}}{b}}{b}}{b}\\
					\dfrac{c}{d}\\
					a = b
				\end{array}
			\endgroup
			&
			\begin{array}{rl}
				a & $this is an a$\\
				b & $this in a b$\\
				c & $this is a c$\\
				d & $this is a d$
			\end{array}
		\end{array}
	\end{gather*}
\end{document}
Michael7496
Posts: 14
Joined: Thu Aug 15, 2013 9:42 am

Re: vertical spacing gather

Post by Michael7496 »

The people in this forum have no idea about LaTeX! I hate this forum!
:D
Last edited by Michael7496 on Mon Aug 19, 2013 11:27 pm, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

vertical spacing gather

Post by cgnieder »

Michael7496 wrote:The people in this forum have no idea about LaTeX! I hate this forum!
Yes, we do. Most of the time at least! :)

The point is that obviously the question was not precise enough. If you only want to change the spacing between two lines the easiest would be to use the optional argument of \\:

Code: Select all

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\begin{document}
        \begin{gather*}
                \begin{array}{c}
                        \dfrac{a}{b}\\[1.5ex]
                        \dfrac{c}{d}
                \end{array}
        \end{gather*}
\end{document}
Regards
site moderator & package author
Post Reply