4

I want to decrease the vertical space before and after an equation. But the effect should not be global! So I just want to change a the vertical space of a part of my equations.

Here is an example of my problem:

    \setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
\begin{table}[H]
   \centering

   \begin{footnotesize}  
   \begin{tabular}{p{4.5cm}p{6.5cm}}
      \toprule
      \textbf{Text} & \textbf{Gleichung} \\
      \midrule
      \midrule
      Text T &
      \begin{equation}
         T(x_t) =
         \begin{cases}
            1 & x_t \leq 1 \\
            2 & x_t \leq 2 \\
            3 & x_t \leq 3 \\
            4 & sonst
         \end{cases}
      \label{eq:equation}
      \end{equation} \\
      \bottomrule
   \end{tabular}
   \end{footnotesize}

   \caption{caption}
   \label{tab:table}
\end{table}

So I have a table with 2 columns and n rows. In the right column I want to place equations in each row with zero spacing before and after the equation.

At the moment the \setlength{\belowdisplayskip}{0pt} seems to have no effect.

Can anyone help me?

Greetings.

  • Welcome to TeX.SE. Could you provide a full code with the document class and the package used? – Romain Picot Oct 23 '15 at 8:29
  • Sorry. I use a template class that I didnt wrote by myself with tons of included packages. I just search maybe a simple hack for now. – Steve Murdock Oct 23 '15 at 8:32
  • a quick may be the use of \vspace{-1em}, you can change the 1 for another value of course – Romain Picot Oct 23 '15 at 8:40
  • Yep, perfect. I already use this at the moment. But where, in which cls file, can I find the default values for \belowdisplayskip, so that I can adjust the space correctly? – Steve Murdock Oct 23 '15 at 8:49
  • This is a grosspost to goLaTeX. – Johannes_B Oct 23 '15 at 11:32
2

Use an additional minipage surrounding the equations.

\documentclass{article}
\usepackage{amsmath,booktabs}
\begin{document}
\begin{table}[htb]
    \centering
   \footnotesize
   \begin{tabular}{p{4.5cm}p{6.5cm}}
      \toprule
      \textbf{Text} & \textbf{Gleichung} \\
      \midrule
      \midrule
      Text T &
      \begin{minipage}{\linewidth}
      \begin{equation}
         T(x_t) =
         \begin{cases}
            1 & x_t \leq 1 \\
            2 & x_t \leq 2 \\
            3 & x_t \leq 3 \\
            4 & sonst
         \end{cases}
      \label{eq:equation}
      \end{equation}
      \end{minipage} \\
      \bottomrule
   \end{tabular}
   \caption{caption}
   \label{tab:table}
\end{table}
\end{document}

enter image description here

To flush the equation to the left, one may use

$\begin{aligned}[t]
        T(x_t) =
         \begin{cases}
            1 & x_t \leq 1 \\
            2 & x_t \leq 2 \\
            3 & x_t \leq 3 \\
            4 & sonst
         \end{cases}
      \end{aligned}\hfill \refstepcounter{equation}(\theequation)$

In this case no minipages are needed.

\documentclass{article}
\usepackage{amsmath,booktabs}
\begin{document}
\begin{table}[htb]
    \centering
   \footnotesize
   \begin{tabular}{p{4.5cm}p{6.5cm}}
      \toprule
      \textbf{Text} & \textbf{Gleichung} \\
      \midrule
      \midrule
      Text T &
      $\begin{aligned}[t]
        T(x_t) =
         \begin{cases}
            1 & x_t \leq 1 \\
            2 & x_t \leq 2 \\
            3 & x_t \leq 3 \\
            4 & sonst
         \end{cases}
      \end{aligned}\hfill \refstepcounter{equation}(\theequation)$\\
      \bottomrule
   \end{tabular}
   \caption{caption}
   \label{tab:table}
\end{table}
\end{document}

enter image description here

  • Perfect! Thank you very very much. Simple, fast solution and exactly what I wanted to do :). – Steve Murdock Oct 23 '15 at 9:51
  • There is no need of setting the spacing parameters. Try without those settings and you'll see. – egreg Oct 23 '15 at 10:23
  • @egreg: With minipage, yes. I will change the answer. Thanks. :) – user11232 Oct 23 '15 at 10:24
  • Is there a posibility to align the equation in the minipages horizontally? So can I align the text in a minipage to the left? – Steve Murdock Oct 23 '15 at 10:51
  • @SteveMurdock: One option is to use fleqn option to amsmath. But this will affect all equations. – user11232 Oct 23 '15 at 11:12

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.