3

Is there any proper way to avoid overlap in the fractions of a table (see the picture) enter image description here

The source code is :

\[
\textbf{S} = 
\begin{Bmatrix}
0 \\
- g \rho \eta \partial_x Z + \dfrac{1}{2} g Z^2 \partial_x \rho \\
- g \rho \eta \partial_y Z + \dfrac{1}{2} g Z^2 \partial_y \rho \\
0
\end{Bmatrix}.
\]
4

The traditional way is to add space to the \\ with an optional argument:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\textbf{S} = 
\begin{Bmatrix}
0 \\[2pt]
- g \rho \eta \partial_x Z + \dfrac{1}{2} g Z^2 \partial_x \rho \\[10pt]
- g \rho \eta \partial_y Z + \dfrac{1}{2} g Z^2 \partial_y \rho \\[6pt]
0
\end{Bmatrix}.
\]
\end{document}

enter image description here

Alternatively, you can use stacks.

You can specify the baselineskip if you use a stack:

\documentclass{article}
\usepackage{amsmath,stackengine}
\setstackEOL{\\}
\begin{document}
\[
\setstackgap{L}{24pt}
\textbf{S} = 
\braceVectorstack{
0 \\
- g \rho \eta \partial_x Z + \dfrac{1}{2} g Z^2 \partial_x \rho \\
- g \rho \eta \partial_y Z + \dfrac{1}{2} g Z^2 \partial_y \rho \\
0
}.
\]
\end{document}

enter image description here

  • Between the two methods, the first one is more affordable. Thanks to you ! – Amine HANINI May 8 at 1:27
  • @AmineHANINI But, but, there is a sale on stackengine this week: stack ONE, get ONE free! – Steven B. Segletes May 8 at 1:29
1
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
  \mathbf{S} = \begin{Bmatrix}
  0 \\
-g\rho\eta\partial_x Z + \dfrac{1}{2} g Z^2 \partial_x \rho \\[10pt]
-g\rho\eta\partial_y Z + \dfrac{1}{2} g Z^2 \partial_y \rho \\
0
\end{Bmatrix} 
\]
\end{document}

enter image description here

0

Another way uses the cellspace package, which enables you to define minimal vertical spacing at the top and bottom of cells in table columns with specifier prefixed with the letter C (or another letter if you load siunitx). For the matrix environments of amsmath, you just have to load the package with option [math]. This will save yu the tedium of deciding which length you'll have to add as an optional argument of \\.

In addition, I propose to use the medium-sized fractions from nccmath for the coefficients, as they look better than the display-sized in this context, from my point of view:

\documentclass{article}
\usepackage{amsmath, nccmath}
\usepackage[math]{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}

\begin{document}

\[
\textbf{S} =
\begin{Bmatrix}
0 \\
- g \rho \eta \partial_x Z + \dfrac{1}{2} g Z^2 \partial_x \rho \\
- g \rho \eta \partial_y Z + \dfrac{1}{2} g Z^2 \partial_y \rho \\
0
\end{Bmatrix}.
\]
\medskip

\[
\textbf{S} =
\begin{Bmatrix}
0 \\
- g \rho \eta \partial_x Z + \mfrac{1}{2} g Z^2 \partial_x \rho \\
- g \rho \eta \partial_y Z + \mfrac{1}{2} g Z^2 \partial_y \rho \\
0
\end{Bmatrix}.
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.