4

I try to create a tabular environment containing a two-lined description on the left side of an equation on the right side. It looks like this:

\documentclass{report}

\usepackage[intlimits]{amsmath} 
\usepackage{here}           
\usepackage{floatflt}
\usepackage{caption}
\usepackage{listliketab}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{table}[htb]
\caption{testststt} \label{tab_BG1_zustand}
  \begin{tabular}{p{6cm}p{6cm}}
        \toprule
        Zustandsgröße &  Beziehung \\ \midrule 
       {$\!\begin{aligned} 
           &\text{spezifisches Volumen} \\ 
           & $v = (\partial g / \partial p)_T} \end{aligned}$}
           & $v(\pi,\tau)\frac{p}{R T} = \pie \gamma_{\pi}$ \\ \vspace{5mm} \\
        {$\!\begin{aligned}
            &\text{spezifische innere Energie} \\
            & $u=g-T(\partial g / \partial T)_p - p(\partial g / \partial p)_T \end{aligned}$}
            & $\frac{u(\pi,\tau )}{R T} = \tau \gamma_{\tau}$ \\ \bottomrule
  \end{tabular}
\end{table}
\end{document}

result

Since it's in an aligned environment, I thought that I would get equation numbers on the right. However, there are none. I think it's because aligned is a non-math environment, so I don't get equation numbers for the inline math; but if I exchange it with align I can't really get it to work.

Update I edited the code according to Bernard's answer, but with the intent to number the right equation:

\begin{table}[htb]
\caption{testststt} \label{tab_BG1_zustand}
\begin{tabular}{p{6cm}p{6cm}}
        \toprule
        Zustandsgröße &  Beziehung \\ \midrule 
        {$\!\begin{aligned} 
           &\text{spezifisches Volumen} \\ 
           &$v = (\partial g / \partial p)_T} \end{aligned}$}
   & \begin{equation}v(\pi,\tau)\frac{p}{R T} = \pie \gamma_{\pi}  \end{equation} \\ \vspace{5mm} \\
        {$\!\begin{aligned}
            &\text{spezifische innere Energie} \\
            &$u=g-T(\partial g / \partial T)_p - p(\partial g / \partial p)_T \end{aligned}$}
            & \begin{equation}\frac{u(\pi,\tau )}{R T} = \tau \gamma_{\tau} \end{equation} \\ \bottomrule
\end{tabular}
\end{table}

It now looks like this: Example

However, the right equations are too low - I want them to be in the middle of the cell (see original example).

  • aligned is a math environment, but it's a "subsidiary" environment. subsidiary environments never get numbers. where do you want the number? at the far right, as if just the rightmost equation is an ordinary numbered equation? – barbara beeton May 12 '15 at 17:31
  • (a) There are lots of syntax errors. (b) I do not see any alignments, which equations should be aligned where? (c) It is pretty unclear, where you want to have equation numbers. (d) aligned does not set equation numbers unlike align or alignat. – Heiko Oberdiek May 12 '15 at 17:37
  • I would want the equation numbers at the far right, just as you described barbara. It's very possible that there are many syntax errors, I started working with Latex two days ago and I'm still a bit overwhelmed. – Phil Nope May 12 '15 at 17:43
1

You can use m-type columns and flalign for left aligning the numbered equation. Some vertical space corrections are needed, but they're hidden in a macro, so you don't need to specify them each time.

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[intlimits]{amsmath} 
\usepackage{booktabs,array}
\usepackage{caption}

\newcommand{\tableequation}[1]{%
  \vspace*{-\baselineskip}
  {\begin{flalign}#1&&&\end{flalign}}%
  \vspace*{-\baselineskip}
}

\begin{document}

With a reference to one of the equations, \eqref{eq-sV}

\begin{table}[htb]
\centering

\caption{testststt} \label{tab_BG1_zustand}

\begin{tabular}{
  @{}
  >{\linespread{1.2}\selectfont}m{6cm}
  @{}
  m{6cm}
  @{}
}
\toprule
Zustandsgröße &  Beziehung \\
\midrule 

spezifisches Volumen\newline
$v = (\partial g / \partial p)_T$ &
  \tableequation{
    v(\pi,\tau)\frac{p}{R T} = \pi \gamma_{\pi} \label{eq-sV}
  } \\

spezifische innere Energie\newline
$u=g-T(\partial g / \partial T)_p - p(\partial g / \partial p)_T$ &
  \tableequation{
    \frac{u(\pi,\tau )}{R T} = \tau \gamma_{\tau}
  } \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

enter image description here

  • This is exactly what I was looking for. Thanks! – Phil Nope May 12 '15 at 21:50
3

Some variations of Kormylo's answer:

  • The cells in the left column uses an inner tabular. The second line is indented to emphasize the term in the first line.
  • No fixed column widths.
  • The equation numbers can be referenced, using amsmath macros for the formatting of the equation number.

Full example:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[intlimits]{amsmath}
\usepackage{caption}
\usepackage{booktabs}

\begin{document}
\begin{table}
  \centering
  \caption{testststt}
  \label{tab_BG1_zustand}
  \newcommand*{\SetEqNum}{%
    \refstepcounter{equation}%
    \thetag\theequation
  }
  \newcommand*{\DisplayEq}[1]{%
    \ensuremath{\displaystyle #1}%
  }
  \newcommand*{\DefEq}[2]{%
    \begin{tabular}{@{}l@{}}%
      #1\\
      \quad\DisplayEq{#2}%
    \end{tabular}%
  }
  \begin{tabular}{llr}
    \toprule
    Zustandsgröße &  Beziehung
    \\ \midrule
    \DefEq{spezifisches Volumen}{v = (\partial g / \partial p)_T}
    & \DisplayEq{v(\pi,\tau)\frac{p}{R T} = \pi \gamma_{\pi}}
    & \SetEqNum\label{eq:Volumen}
    \\
    \addlinespace
    \DefEq{spezifische innere Energie}
          {u=g-T(\partial g / \partial T)_p - p(\partial g / \partial p)_T}
    & \DisplayEq{\frac{u(\pi,\tau )}{R T} = \tau \gamma_{\tau}}
    & \SetEqNum\label{eq:InnereEnergie}
    \\ \bottomrule
  \end{tabular}
\end{table}

In der Tabelle~\ref{tab_BG1_zustand} gibt es die Beziehungen
\eqref{eq:Volumen} und~\eqref{eq:InnereEnergie}.
\end{document}

Result

1

The p{6cm} is equivalent to \parbox[t]{6cm}, but \parbox[c]{6cm} would do better for this. Nor do you really need a display math environment when $\displaystyle ...$ will do. Especially, if you put the equation number into its own column.

\documentclass{report}

\usepackage[intlimits]{amsmath} 
\usepackage{here}           
\usepackage{floatflt}
\usepackage{caption}
\usepackage{listliketab}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{table}[htb]
\caption{testststt} \label{tab_BG1_zustand}
  \begin{tabular}{llr}
        \toprule
        Zustandsgröße &  Beziehung \\ \midrule 
       \parbox[c]{6cm}{\text{spezifisches Volumen} \newline
         $\displaystyle v = (\partial g / \partial p)_T$}
        & \parbox[c]{6cm}{$\displaystyle v(\pi,\tau)\frac{p}{R T} = \pi \gamma_{\pi}$}
        & \stepcounter{equation}(\theequation) 
        \\[5mm]
       \parbox[c]{6cm}{\text{spezifische innere Energie} \newline
         $\displaystyle u=g-T(\partial g / \partial T)_p - p(\partial g / \partial p)_T$}
        & \parbox[c]{6cm}{$\displaystyle \frac{u(\pi,\tau )}{R T} = \tau \gamma_{\tau}$}
        & \stepcounter{equation}(\theequation)
        \\ \bottomrule
  \end{tabular}
\end{table}
\end{document}

taqbular

0

Here is a way. I used threeparttable in order to have the caption left-aligned w.r.t. the table. Off topic: you shouldn't load here since float defines an H option.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[german]{babel}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage[intlimits]{mathtools}
\usepackage{nccmath}
\usepackage{floatflt}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{array, caption, threeparttable}
\newcolumntype{M}[1]{>{\fleqn}m{#1} <{\endfleqn}}

\begin{document}

\vspace*{1\baselineskip}
\begin{table}[!htb]
  \centering
  \captionsetup{singlelinecheck=off}
  \begin{threeparttable}
    \caption{testststt} \label{tab_BG1_zustand}
    \setlength\abovedisplayskip{-2ex}
    \setlength\belowdisplayskip{-1.5ex}
    \begin{tabular}{M{6cm} M{6cm}}
      \toprule
      Zustandsgröße & Beziehung \\ \midrule
      \begin{fleqn}\begin{gather*}
      \shortintertext{spezifisches Volumen}
      v =(∂ g / ∂ T)_T\end{gather*}\vskip-\abovedisplayskip\end{fleqn}
                      & \begin{equation}\displaystyle v(π,τ)\frac{p}{R T} = π e γ_{π}\end{equation} \\
      \begin{fleqn}\begin{gather*}
      \shortintertext{spezifische innere Energie}
      u = g- T (∂ g / ∂ T)_p- p(∂ g / ∂ T)_T \end{gather*}\end{fleqn}
                      & \begin{equation}
      \frac{u(π, τ)}{RT} = τ γ_{τ}
      \end{equation}\\
      \bottomrule
    \end{tabular}
  \end{threeparttable}
\end{table}

\end{document} 

enter image description here

  • I would like to number the right most equation and see the equation number on the far right. I tried moving the \begin{equation} to the right formula, but it messed with the formatting. Also, and this is different in your solution, the right equation should be in the vertical center of the right cell. Right now it's on the same height as the left equation. – Phil Nope May 12 '15 at 18:07
  • I photoshopped a picture for clarification: like this – Phil Nope May 12 '15 at 18:33
  • @Phil Nope: I adjusted my code. Should be like you want now. – Bernard May 13 '15 at 0:35

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.