Text FormattingParagraph Spacing around Equations

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Paragraph Spacing around Equations

Post by Cham »

localghost,

here's a complete example. I'm yet unable to make the spacing right. Look at equations (1) and (4) :

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{textcomp}
\usepackage{setspace}
\setstretch{1.1}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{upgreek}
\usepackage{tensor}
\usepackage[ ]{siunitx}
\pagestyle{plain}
\usepackage[left=1.0in,top=1.0in,right=1.0in,bottom=1.0in]{geometry}
\pagestyle{headings}
\raggedbottom
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}

\usepackage[pagestyles,medium]{titlesec}  % Options : [ raggedright ], [ center ], [ raggedleft ], [ big ], [ medium ], [ small ], [ sf ], [ sc ]
\newpagestyle{principal}{
   \sethead[\thepage][][\itshape\small\MakeUppercase{\chaptername\ \thechapter. \chaptertitle}]{\itshape\small\MakeUppercase{\thesection\ \sectiontitle}}{}{\thepage}
   \headrule
}

\let\oldhat\hat
\renewcommand{\vec}[1]{\mathbf{#1}}
\renewcommand{\hat}[1]{\oldhat{\mathbf{#1}}}


\begin{document}

\pagestyle{principal}

\setlength{\abovedisplayskip}{12pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayskip}{12pt}
\setlength{\belowdisplayshortskip}{12pt}

Il est maintenant nécessaire de déterminer la loi de la force électromagnétique s'exerçant entre deux charges ponctuelles.  En principe, il s'agit là de l'objectif ultime de l'électromagnétisme.  Tout le reste n'est que application à des situations particulières.

\medskip
\medskip

\noindent
{\bf La loi de Coulomb :}  D'ingénieuses expériences, conçues notamment par Cavendish et Coulomb au cours du 18\ieme{} siècle, ont permis d'établir que la force électrique agissant entre deux particules chargées \emph{au repos} est inversement proportionnelle au carré de la distance qui les sépare (l'emploi de particules au repos permet d'éviter la complication des forces magnétiques).  Plus précisément, considérons une particule de charge $\tensor{q}{_1}$ maintenue fixe dans l'espace vide et située à la position représentée par le vecteur $\tensor{\vec r}{_1}$.  Cette particule exerce une force électrique sur une deuxième particule de charge $\tensor{q}{_2}$, libre de se déplacer et repérée par le vecteur-position $\tensor{\vec r}{_2}$.  La force électrique agissant sur la deuxième particule est
   \begin{equation}
      \label{loi de Coulomb}
      \tensor{\vec F}{_{\tensor{q}{_1} \,\text{sur}\, \tensor{q}{_2}}} = \frac{k \hspace{1pt} \tensor{q}{_1} \hspace{1pt} \tensor{q}{_2}}{r_{12}^3} \, \tensor{\vec r}{_{12}},
   \end{equation}
où $\tensor{\vec r}{_{12}} = \tensor{\vec r}{_2} - \tensor{\vec r}{_1}$.  C'est la loi de Coulomb.  Ici, $k$ est une constante de proportionnalité caractéristique du milieu ambiant (le vide !) et déterminée par l'expérience.  Par convention, on écrit
   \begin{equation}
      k = \frac{1}{4 \hspace{1pt} \pi \varepsilon_0},
   \end{equation}
où $\varepsilon_0$ est la «~permittivité électrique~» du vide.  La valeur de cette constante dépend du choix de l'unité de la charge électrique : $\varepsilon_0 \approx \SI{8,854e-12}{C^2/\,Nm^2}$.

L'expression \eqref{loi de Coulomb} possède une ressemblance frappante avec la loi de la gravitation universelle de Newton !  Une différence majeure subsiste cependant.  La force gravitationnelle est toujours attractive, tandis que la force électrique peut être répulsive.  De plus, cette dernière n'est pas universelle puisqu'elle n'agit qu'entre les particules chargées.  Il est intéressant de comparer l'intensité relative de ces deux forces fondamentales.  Considérons deux électrons en interaction gravitationnelle et électrique.  Le rapport des modules des forces est
   \begin{equation}
      \frac{\tensor{F}{_{\text{\it grav}}}}{\tensor{F}{_{\text{\it élec}}}} = \frac{G m_{\mathrm e}^2}{k \hspace{1pt} e^2} \approx \SI{2,4e-43}{}.
   \end{equation}
La force gravitationnelle est donc insignifiante devant la force électrique.  Cependant, il ne faut pas oublier que la force gravitationnelle est cumulative avec la quantité de matière (il n'existe pas de masses négatives) et il est possible de neutraliser une charge électrique (globalement, la matière est neutre).  Ainsi, la gravité domine aux très grandes échelles malgré qu'elle soit intrinsèquement la plus faible des forces bla bla bla bla bla bla bla bla de la nature.
   \begin{equation}
      \label{darn}
      A = B.
   \end{equation}
Another test, just to see :
   \begin{equation}
      C = D.
   \end{equation}
Hmmm, again some spacement problems below the equation \eqref{darn}.
\medskip
\medskip

\noindent
Ici, $\tensor{\vec r}{_{i \hspace{1pt} 0}} = \tensor{\vec r}{_0} - \tensor{\vec r}{_i}$ représente un vecteur ayant pour origine la charge-source $\tensor{q}{_i}$ et localisant la charge-test $\tensor{q}{_0}$.  Lorsque la distribution des charges-sources est continue (infinité de charges infinitésimales et indénombrables $\tensor{q}{_i} \rightarrow dq$), la somme est remplacée par une intégration :
   \begin{equation}
      \label{force pour les distributions continues}
      \tensor{\vec F}{_{\tensor{q}{_0}}} = \int d \tensor{\vec F}{_{\tensor{q}{_0}}} = \int \frac{k \hspace{1pt} \tensor{q}{_0}}{| \, \tensor{\vec r}{_0} - \vec r \hspace{1pt} |^3} \hspace{1pt} (\tensor{\vec r}{_0} - \vec r) \, dq.
   \end{equation}
Bien entendu, la variable d'intégration doit être définie clairement, selon le type de distribution.  Pour les distributions volumiques par exemple, une charge-source infinitésimale s'écrit $dq = \rho(\vec r) \: d^3x$.  Pour une distribution de particules ponctuelles dénombrables, on peut définir la densité volumique des charges à l'aide de la distribution de Dirac :

\end{document}
So I don't understand what is going on here...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

paul
Posts: 49
Joined: Thu Apr 08, 2010 5:56 am

Paragraph Spacing around Equations

Post by paul »

localghost wrote:Following the link in my last reply you would have found out that the \setlength command is the way to go. This by the way is also suggested in every basic LaTeX documentation.
You can see from the picture that the two equations are on the same page, so it's obvious that the stretchiness of the spacing isn't the problem (they both get the same amount of stretch).

The spacing around equations (1) and (4) in the complete example, above, looks fine to me. I don't have either tensor.sty or siunitx.sty installed, so I just ignored them...maybe one of them is doing something to the spacing (try commenting the \usepackage lines, type "q" at the error message, and see what the spacing looks like then)
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Paragraph Spacing around Equations

Post by Cham »

paul wrote: The spacing around equations (1) and (4) in the complete example, above, looks fine to me. I don't have either tensor.sty or siunitx.sty installed, so I just ignored them...maybe one of them is doing something to the spacing (try commenting the \usepackage lines, type "q" at the error message, and see what the spacing looks like then)
Removing the siunitx and tensor packages doesn't change anything in my example above (except a small math expression inside a line).

The trouble with equations (1) is the spacing above (too much space after the text line), and the trouble with equation (4) is the space below it (too much space again).

Will I have to manually edit the space for each equation in the whole document ? That would be insane !
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Paragraph Spacing around Equations

Post by localghost »

It looks quite good for me if I set all lengths to an identical value.

Code: Select all

\setlength{\abovedisplayskip}{12pt}
\setlength{\abovedisplayshortskip}{12pt}
\setlength{\belowdisplayskip}{12pt}
\setlength{\belowdisplayshortskip}{12pt}
Perhaps I would halve the values.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Paragraph Spacing around Equations

Post by Cham »

Hmmm, no, the spacings aren't right to my eyes. There's always some equations with too much space above or below.

I'm very surprised that LaTeX doesn't let the user to define a strong constraint on the equations spacing.

So must I conclude that I'll have to add some spacing commands here and there by hand ?
sps782
Posts: 1
Joined: Sun Aug 18, 2013 12:17 am

Paragraph Spacing around Equations

Post by sps782 »

Realize this is an old thread, but the question raises a valid point collateral to the provided answers. In hopes that this helps someone else, it is worth noting that some packages redefine the relevant parameters in a way that makes \setlength ineffective. For example, when using the memoir package, I use the following:

Code: Select all

\renewcommand*{\memdskips}{%
  \setlength{\abovedisplayskip}{0em}%
  \setlength{\abovedisplayshortskip}{0em}%
  \setlength{\belowdisplayskip}{0em}%
  \setlength{\belowdisplayshortskip}{0em}%
}
Simply running the contained \setlength commands has no effect.
Last edited by cgnieder on Sun Aug 18, 2013 1:14 pm, edited 1 time in total.
Post Reply