我尝试创建一个表格环境,其中包含等式右侧左侧的两行描述。它看起来像这样:
\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}
由于是在对齐环境中,我以为我会在右侧获得方程编号。但是,没有。我认为这是因为对齐是非数学环境,所以我没有获得内联数学的方程编号;但如果我将其与对齐交换,我实际上无法使其工作。
更新 我根据 Bernard 的回答编辑了代码,但目的是对正确的方程进行编号:
\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}
现在看起来像这样:
但是,正确的方程太低了 - 我希望它们位于单元格的中间(参见原始示例)。
答案1
您可以使用m
-type columns 和flalign
来左对齐编号的方程式。需要进行一些垂直空间校正,但它们隐藏在宏中,因此您无需每次都指定它们。
\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}
答案2
Kormylo 的一些变种回答:
- 左列单元格使用内部的
tabular
。第二行缩进以强调第一行中的术语。 - 没有固定的列宽。
- 可以引用方程编号,使用
amsmath
宏来格式化方程编号。
完整示例:
\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}
答案3
p{6cm} 相当于 \parbox[t]{6cm},但 \parbox[c]{6cm} 更适合这种情况。当 $\displaystyle ...$ 可以满足需求时,您实际上也不需要显示数学环境。特别是,如果您将方程编号放入其自己的列中。
\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}
答案4
这是一种方法。我曾经使用这种方法threeparttable
来使标题相对于表格左对齐。题外话:您不应该加载here
因为float
定义了一个H
选项。
\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}