4

The following table gives 2 errors:

\documentclass{report}

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

\begin{document}
\begin{table}[htbp]
    \centering
    \caption{Ableitungen der dimensionslosen freien Enthalpie $\gamma$, Gl. \ref{glg_IF97_R1_Basis}}
    \label{tab:IF97_R1_Abl}
    \toprule
        \begin{align}
            \gamma_\pi          &= \left( \frac{\partial \gamma}{\partial \pi} \right)_{\tau}       & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} (\tau - 1,222)^{J_i}   \\
            \gamma_{\pi\pi} &= \left( \frac{\partial^2 \gamma}{\partial \pi^2} \right)_{\tau} &  &= \displaystyle\sum_{i=1}^{34} n_i I_i (I_i -1)(7,1-\pi)^{I_i-2} (\tau - 1,222)^{J_i}   \\            
            \gamma_\tau     &= \left( \frac{\partial \gamma}{\partial \tau} \right)_{\pi}       & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (\tau - 1,222)^{J_i-1}   \\
            \gamma_{\tau\tau}   &= \left( \frac{\partial^2 \gamma}{\partial \tau^2} \right)_{\pi} & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (J_i -1) (\tau - 1,222)^{J_i-2} \\
            \gamma_{\pi \tau} &= \left( \frac{\partial^2 \gamma}{\partial \pi \partial \tau} \right) & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} J_i (\tau - 1,222)^{J_i-1} 
        \end{align} 
        \bottomrule
\end{table}
\end{document}

Result

Those errors relate to \toprule and \bottomrule, though I'm not sure why:

Misplaced \noalign

\bottomrule ->\noalign

I also can't figure out how to decrease the enormous space between left and right side of the equations, an why there is so much space after and before the lines on top and bottom. Maybe it's related to the error?

  • I wouldn't use \toprule and \bottomrule in this context. Simply use \hrule. – Mico May 14 '15 at 14:28
  • @Mico: \hrule or \hline? – user31729 May 14 '15 at 14:31
  • 1
    @ChristianHupfer - Definitely \hrule. The issue is that the horizontal lines aren't embedded in a tabular-like structure. Hence, LaTeX doesn't know how wide \hline, \toprule, or \bottomrule need to be made. The TeX macro \hrule simply draws a line across the entire width of the text block. I think that's what the OP wants. – Mico May 14 '15 at 14:36
  • @Mico: I know know -- I missed the missing tabular environment in the MWE. Thanks for explaining – user31729 May 14 '15 at 14:36
3

You have to use tabular:

\documentclass{report}

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

\begin{document}
\begin{table}[htbp]
\centering
\caption{Ableitungen der dimensionslosen freien Enthalpie $\gamma$, Gl. \ref{glg_IF97_R1_Basis}}
\label{tab:IF97_R1_Abl}
\begin{tabular}{@{}p{\textwidth}@{}}
\toprule
\addlinespace[-\normalbaselineskip]
{\begin{alignat}{2}
 \gamma_\pi        &= \left( \frac{\partial \gamma}{\partial \pi} \right)_{\tau}          &&= \sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} (\tau - 1,222)^{J_i}   \\
 \gamma_{\pi\pi}   &= \left( \frac{\partial^2 \gamma}{\partial \pi^2} \right)_{\tau}      &&= \sum_{i=1}^{34} n_i I_i (I_i -1)(7,1-\pi)^{I_i-2} (\tau - 1,222)^{J_i}   \\            
 \gamma_\tau       &= \left( \frac{\partial \gamma}{\partial \tau} \right)_{\pi}          &&= \sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (\tau - 1,222)^{J_i-1}   \\
 \gamma_{\tau\tau} &= \left( \frac{\partial^2 \gamma}{\partial \tau^2} \right)_{\pi}      &&= \sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (J_i -1) (\tau - 1,222)^{J_i-2} \\
 \gamma_{\pi \tau} &= \left( \frac{\partial^2 \gamma}{\partial \pi \partial \tau} \right) &&= \sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} J_i (\tau - 1,222)^{J_i-1} 
 \end{alignat}}
\\
\addlinespace[-\normalbaselineskip]
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

  • That also solves the spacing problem. Great, thanks! – Phil Nope May 14 '15 at 14:55
0

If you don't want to embed the align environment in a tabular-like environment, and if you simply want to draw lines across the full width of the text block, don't use \toprule and \bottomrule. Just use \hrule instead.

enter image description here

\documentclass{report}

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

\begin{document}
\begin{table}[htbp]
    %\centering
    \caption{Ableitungen der dimensionslosen freien Enthalpie $\gamma$, Gl. \ref{glg_IF97_R1_Basis}}
    \label{tab:IF97_R1_Abl}

    \hrule
        \begin{align}
            \gamma_\pi          &= \left( \frac{\partial \gamma}{\partial \pi} \right)_{\tau}       & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} (\tau - 1,222)^{J_i}   \\
            \gamma_{\pi\pi} &= \left( \frac{\partial^2 \gamma}{\partial \pi^2} \right)_{\tau} &  &= \displaystyle\sum_{i=1}^{34} n_i I_i (I_i -1)(7,1-\pi)^{I_i-2} (\tau - 1,222)^{J_i}   \\            
            \gamma_\tau     &= \left( \frac{\partial \gamma}{\partial \tau} \right)_{\pi}       & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (\tau - 1,222)^{J_i-1}   \\
            \gamma_{\tau\tau}   &= \left( \frac{\partial^2 \gamma}{\partial \tau^2} \right)_{\pi} & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (J_i -1) (\tau - 1,222)^{J_i-2} \\
            \gamma_{\pi \tau} &= \left( \frac{\partial^2 \gamma}{\partial \pi \partial \tau} \right) & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} J_i (\tau - 1,222)^{J_i-1} 
        \end{align} 

\hrule
\end{table}
\end{document}
0

You should use a tabular or tabularx environment, if you want to use \toprule and the like:

\documentclass{report}

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

\begin{document}
\begin{table}[!htbp]
\setlength\abovedisplayskip{-2ex}
\setlength\belowdisplayskip{-0.5ex}
    \caption{Ableitungen der dimensionslosen freien Enthalpie $\gamma$, Gl. \ref{glg_IF97_R1_Basis}}
    \label{tab:IF97_R1_Abl}
\begin{tabularx}{\linewidth}{X}%{@{}p{\linewidth}@{}}
  \toprule
        {\begin{align}
            \gamma_\pi &= \left( \frac{\partial \gamma}{\partial \pi} \right)_{\tau} & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} (\tau - 1,222)^{J_i} \\
               \gamma_{\pi\pi} &= \left( \frac{\partial^2 \gamma}{\partial \pi^2} \right)_{\tau} & &= \displaystyle\sum_{i=1}^{34} n_i I_i (I_i -1)(7,1-\pi)^{I_i-2} (\tau - 1,222)^{J_i} \\
             \gamma_\tau &= \left( \frac{\partial \gamma}{\partial \tau} \right)_{\pi} & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (\tau - 1,222)^{J_i-1} \\
             \gamma_{\tau\tau} &= \left( \frac{\partial^2 \gamma}{\partial \tau^2} \right)_{\pi} & &= \displaystyle\sum_{i=1}^{34} n_i(7,1-\pi)^{I_i} J_i (J_i -1) (\tau - 1,222)^{J_i-2} \\
             \gamma_{\pi \tau} &= \left( \frac{\partial^2 \gamma}{\partial \pi \partial \tau} \right) & &= \displaystyle\sum_{i=1}^{34} -n_i I_i (7,1-\pi)^{I_i-1} J_i (\tau - 1,222)^{J_i-1}
        \end{align}}\\
        \bottomrule
\end{tabularx}
\end{table}
\end{document} 

enter image description here

  • Is the \centering instruction still needed? – Mico May 14 '15 at 14:42
  • @Mico: You're right. Initially I tested a 0.9\linewidth, which required it. Loading listliketab isn't needed either for this code, nor floatflt. – Bernard May 14 '15 at 14:48
  • This is true. Sorry! – Phil Nope May 14 '15 at 14:56
  • Don't feel sorry! I was only joking… Sometimes I wonder if I'm needed myself. – Bernard May 14 '15 at 15:09

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.