包含多个方程式的表格

包含多个方程式的表格

有没有一种优雅的方法可以在表格中总结来自不同来源的多个方程式?我需要在论文中使用它;我指定的边距与我大学草稿的几何形状相匹配。

我整理了以下 MWE:

% arara: pdflatex
% arara: pdflatex: {synctex: yes}

\documentclass[paper=a4, 12pt]{scrreprt}

\usepackage[a4paper, left=3cm, right=2cm, bottom=5cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
%% Selection of the fonts
\usepackage{XCharter}
\usepackage[libertine,bigdelims,vvarbb,scaled=1.07]{newtxmath}
\usepackage[cal=boondoxo]{mathalfa}
\renewcommand*\sfdefault{phv}

%% No overfull hboxes anymore (hopefully)
\usepackage{microtype}

%% to get 1.5 line spacing (actually 1.25)
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0mm}

%%% Load math packages
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}

%% For the tables!
\usepackage{booktabs, tabu}
\usepackage{blindtext}

\usepackage[hypcap]{caption}


\begin{document}

\chapter{Table For Stackexchange}

\blindtext[4]

\textbf{How to get rid of the vertical offset between author's name and equation? Any idea how to avoid the \texttt{Overfull hbox}?}

\begin{table}[h]
\caption{Porosity Correlations from the Literature}
\label{tab:porcorr}
\tabulinesep=3pt
\begin{tabu}{X[l] X[l, 6]}
\toprule
\textbf{Reference} & \textbf{Correlation} \\
\midrule
Author a (1985) & 
{\begin{align}
\varepsilon(x) ~&=~ 1 \,-\, 4.5 \left( x \,-\, \frac{7}{9}x^2 \right) (1 \,-\, \varepsilon) \quad \text{for}~ x ~\leq~~0.25 \\
\varepsilon(x) ~&=~ a_1 \exp(-a_2 x) \cos{[a_3 x \,-\, a_4) \pi]}(1 \,-\, \varepsilon) \cdot \varepsilon  ~\text{for}~ x \in (0.25,~8) \\
\text{With:}~ x ~&=~ \frac{R \,-\, r}{d_\mathrm{p}} \nonumber \\
\text{Constants:}~ &a_1 = 0.3463 \quad a_2 = 0.4274 \quad a_3 = 2.4509 \quad a_4 = 2.2011 \nonumber
\end{align}
} \\
Author b (1989) & 
{\begin{align}
\varepsilon(r) ~&=~ \varepsilon \,+\, (1 \,-\, \varepsilon)J_0(a \, r^*) \exp(-b \, r^*) \\
\text{With:} \nonumber \\
a ~&=~ 
\begin{cases}
8.243 \,-\, \frac{12.98}{D/d_\mathrm{p} \,-\, 3.156} & \text{for}~ 2.61 \leq D/d_\mathrm{p} \leq 13 \\
7.383 \,-\, \frac{2.932}{D/d_\mathrm{p} \,-\, 9.864} & \text{for}~ D/d_\mathrm{p} > 13
\end{cases}
\nonumber \\
b ~&=~ 0.304 \,-\, \frac{0.724}{D/d_\mathrm{p}}, \quad r^* ~=~ \frac{r}{d_\mathrm{p}}, \quad \varepsilon ~=~ 0.379 \,+\, \frac{0.078}{D/d_\mathrm{p} \,-\, 1.80} \nonumber
\end{align}
} \\
\bottomrule
\end{tabu}
\end{table}

\blindtext[1]

\end{document}

包含多个方程及其来源的表格

两个主要问题是:

  1. 作者姓名和方程式之间的垂直间距明显。如何让它们的高度相同?

  2. 第 56 行有一个溢出的水平盒子,这尤其难看,因为不仅文本,而且禁忌的顶部、中间和底部规则也延伸到边缘。(比较表格下方“will”的位置和底线。)如何避免这种情况?我知道我可以插入手动换行符,但没有更好的方法吗?

因为这是我在 TeX.SX 上的第一篇文章,所以请随意改进它。

答案1

你问:

作者姓名和方程式之间的垂直间距明显。如何让它们的高度相同?

除了使用align环境之外,您还可以将aligned环境与定位说明符一起使用[t]

我还建议你

  • 省略所有\,~指令,这些指令目前用于覆盖 TeX 自己的间距规则(但您不能以完全一致的方式执行此操作)

  • 去掉周围的花括号\cos[a_3 x - a_4) \pi]

  • 使用dcases环境而不是cases环境。

在此处输入图片描述

% arara: pdflatex
% arara: pdflatex: {synctex: yes}

\documentclass[paper=a4, 12pt]{scrreprt}

\usepackage[a4paper, left=3cm, right=2cm, bottom=5cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
%% Selection of the fonts
\usepackage{XCharter}
\usepackage[libertine,bigdelims,vvarbb,scaled=1.07]{newtxmath}
\usepackage[cal=boondoxo]{mathalfa}
\renewcommand*\sfdefault{phv}

%% No overfull hboxes anymore (hopefully)
\usepackage{microtype}

%% to get 1.5 line spacing (actually 1.25)
%\usepackage{setspace}
%\onehalfspacing
%\setlength{\parindent}{0mm}

%%% Load math packages
%\usepackage{amsmath}
\usepackage{mathtools}
%\usepackage{amsfonts}
%\usepackage{amssymb}
%\usepackage{units}

%% For the tables!
\usepackage{booktabs, tabu}
%\usepackage{blindtext}

\usepackage[hypcap]{caption}

\DeclareMathOperator{\Jzero}{\mathit{J_0}}

\begin{document}

%\chapter{Table For Stackexchange}
\setcounter{chapter}{1}
%\blindtext[4]

%\textbf{How to get rid of the vertical offset between author's name and equation? Any idea how to avoid the \texttt{Overfull hbox}?}

\begin{table}[h]
%\setlength\abovedisplayskip{0pt}
%\setlength\abovedisplayshortskip{0pt}
%\setlength\belowdisplayskip{0pt}
\caption{Porosity Correlations from the Literature}
\label{tab:porcorr}
\tabulinesep=3pt
\begin{tabu}{@{} X[l] X[l, 6] @{}}
\toprule
\textbf{Reference} & \multicolumn{1}{c}{\textbf{Correlation}} \\
\midrule
Author a (1985) 
& $\begin{aligned}[t]
&\varepsilon(x) = 
\begin{dcases}
1 - 4.5 \left( x - \tfrac{7}{9}x^2 \right) (1 - \varepsilon) 
    & \text{for $x \leq0.25$} \\
a_1 \exp(-a_2 x) \cos[a_3 x - a_4) \pi](1 - \varepsilon) \varepsilon  
    & \text{for $x \in (0.25,8)$} \end{dcases}\\[1ex]
&\text{With: $x = (R - r)/d_\mathrm{p}$}  \\
&\text{Constants:  $a_1 = 0.3463$, $a_2 = 0.4274$, $a_3 = 2.4509$, $a_4 = 2.2011$}
\end{aligned}$ \\[2ex]
Author b (1989) 
& $\begin{aligned}[t]
\varepsilon(r) &= \varepsilon + (1 - \varepsilon) \Jzero(a  r^*) \exp(-b  r^*) \\[1.5ex]
\text{With:}\\
a &=
\begin{dcases}
8.243 - \frac{12.98}{D/d_\mathrm{p} - 3.156} & \text{for $2.61 \leq D/d_\mathrm{p} \leq 13$} \\[1ex]
7.383 - \frac{2.932}{D/d_\mathrm{p} - 9.864} & \text{for $D/d_\mathrm{p} > 13$}
\end{dcases}
 \\[1ex]
b &= 0.304 - \frac{0.724}{D/d_\mathrm{p}}, \quad r^* = \frac{r}{d_\mathrm{p}}, \quad \varepsilon = 0.379 + \frac{0.078}{D/d_\mathrm{p} - 1.80} 
\end{aligned}$ \\
\bottomrule
\end{tabu}
\end{table}

%\blindtext[1]

\end{document} 

附录解决 OP 的后续评论:为了将aligned上例中使用的环境的简单性与为主要方程式分配方程式编号的能力(以及创建交叉引用)结合起来,您可能希望提供一个额外的列(或类型r) in thetabu` 环境。

在此处输入图片描述

\documentclass[paper=a4, 12pt]{scrreprt}

\usepackage[a4paper, left=3cm, right=2cm, bottom=5cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
%% Selection of the fonts
\usepackage{XCharter}
\usepackage[libertine,bigdelims,vvarbb,scaled=1.07]{newtxmath}
\usepackage[cal=boondoxo]{mathalfa}
\renewcommand*\sfdefault{phv}

%% No overfull hboxes anymore (hopefully)
\usepackage{microtype}

%% to get 1.5 line spacing (actually 1.25)
%\usepackage{setspace}
%\onehalfspacing
%\setlength{\parindent}{0mm}

%%% Load math packages
%\usepackage{amsmath}
\usepackage{mathtools}
%\usepackage{amsfonts}
%\usepackage{amssymb}
%\usepackage{units}

%% For the tables!
\usepackage{booktabs, tabu}
%\usepackage{blindtext}

\usepackage[hypcap]{caption}

\DeclareMathOperator{\Jzero}{\mathit{J_0}}

\begin{document}

%\chapter{Table For Stackexchange}
\setcounter{chapter}{1}
%\blindtext[4]

%\textbf{How to get rid of the vertical offset between author's name and equation? Any idea how to avoid the \texttt{Overfull hbox}?}

\begin{table}[h]
%\setlength\abovedisplayskip{0pt}
%\setlength\abovedisplayshortskip{0pt}
%\setlength\belowdisplayskip{0pt}
\caption{Porosity Correlations from the Literature}
\label{tab:porcorr}
\tabulinesep=3pt
\begin{tabu}{@{} X[l] X[l, 6] r @{}}
\toprule
\textbf{Reference} & \multicolumn{1}{c}{\textbf{Correlation}} \\
\midrule
Author a (1985)
& $\begin{aligned}[t]
&\varepsilon(x) =
\begin{dcases}
1 - 4.5 \left( x - \tfrac{7}{9}x^2 \right) (1 - \varepsilon)
    & \text{for $x \leq0.25$} \\
a_1 \exp(-a_2 x) \cos[a_3 x - a_4) \pi](1 - \varepsilon) \varepsilon
    & \text{for $x \in (0.25,8)$} \end{dcases} \\[1ex]
&\text{With: $x = (R - r)/d_\mathrm{p}$}  \\
&\text{Constants:  $a_1 = 0.3463$, $a_2 = 0.4274$, $a_3 = 2.4509$, $a_4 = 2.2011$}
\end{aligned}$ &
\refstepcounter{equation}\label{eq:author_a}(\theequation)\\[2ex]
Author b (1989)
& $\begin{aligned}[t]
&\varepsilon(r) = \varepsilon + (1 - \varepsilon) \Jzero(a  r^*) \exp(-b  r^*) \\[1.5ex]
&\text{With:}\\
&a =
\begin{dcases}
8.243 - \frac{12.98}{D/d_\mathrm{p} - 3.156} & \text{for $2.61 \leq D/d_\mathrm{p} \leq 13$} \\[1ex]
7.383 - \frac{2.932}{D/d_\mathrm{p} - 9.864} & \text{for $D/d_\mathrm{p} > 13$}
\end{dcases}
 \\[1ex]
&b = 0.304 - \frac{0.724}{D/d_\mathrm{p}}\,, \quad 
 r^* = \frac{r}{d_\mathrm{p}}\,, \quad 
 \varepsilon = 0.379 + \frac{0.078}{D/d_\mathrm{p} - 1.80}
\end{aligned}$ & 
\refstepcounter{equation}\label{eq:author_b}(\theequation)\\
\bottomrule
\end{tabu}
\end{table}

Here are cross-references to equations \eqref{eq:author_a} and \eqref{eq:author_b}.

\end{document} 

答案2

我做了两个小改动 * 放置负垂直空间以对齐数学和作者。不幸的是,这需要手动调整。(可能是一种更优雅的方式) * 我调整了列比例(参见 tabu 手册第 10 页,http://texdoc.net/texmf-dist/doc/latex/tabu/tabu.pdf) 来消除大部分 Overfull \hbox。但是,我怀疑要消除它,您必须重写有问题的方程式以使用较少的水平空间。

% arara: pdflatex
% arara: pdflatex: {synctex: yes}

\documentclass[paper=a4, 12pt]{scrreprt}

\usepackage[a4paper, left=3cm, right=2cm, bottom=5cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
%% Selection of the fonts
\usepackage{XCharter}
\usepackage[libertine,bigdelims,vvarbb,scaled=1.07]{newtxmath}
\usepackage[cal=boondoxo]{mathalfa}
\renewcommand*\sfdefault{phv}

%% No overfull hboxes anymore (hopefully)
\usepackage{microtype}

%% to get 1.5 line spacing (actually 1.25)
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0mm}

%%% Load math packages
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{units}

%% For the tables!
\usepackage{booktabs, tabu}
\usepackage{blindtext}

\usepackage[hypcap]{caption}


\begin{document}

\chapter{Table For Stackexchange}

\blindtext[4]

\textbf{How to get rid of the vertical offset between author's name and equation? Any idea how to avoid the \texttt{Overfull hbox}?}

\begin{table}[h]
\caption{Porosity Correlations from the Literature}
\label{tab:porcorr}
\tabulinesep=3pt
\begin{tabu}{X X[1, 7.5]}
\toprule
\textbf{Reference} & \textbf{Correlation} \\
\midrule
Author a (1985)& 
\vspace{-2.1em}{\begin{align}
\varepsilon(x) ~&=~ 1 \,-\, 4.5 \left( x \,-\, \frac{7}{9}x^2 \right) (1 \,-\, \varepsilon) \quad \text{for}~ x ~\leq~~0.25 \\
\varepsilon(x) ~&=~ a_1 \exp(-a_2 x) \cos{[a_3 x \,-\, a_4) \pi]}(1 \,-\, \varepsilon) \cdot \varepsilon  ~\text{for}~ x \in (0.25,~8) \\
\text{With:}~ x ~&=~ \frac{R \,-\, r}{d_\mathrm{p}} \nonumber \\
\text{Constants:}~ &a_1 = 0.3463 \quad a_2 = 0.4274 \quad a_3 = 2.4509 \quad a_4 = 2.2011 \nonumber
\end{align}
}\\
Author b (1989) & 
\vspace{-2.1em}{\begin{align}
\varepsilon(r) ~&=~ \varepsilon \,+\, (1 \,-\, \varepsilon)J_0(a \, r^*) \exp(-b \, r^*) \\
\text{With:} \nonumber \\
a ~&=~ 
\begin{cases}
8.243 \,-\, \frac{12.98}{D/d_\mathrm{p} \,-\, 3.156} & \text{for}~ 2.61 \leq D/d_\mathrm{p} \leq 13 \\
7.383 \,-\, \frac{2.932}{D/d_\mathrm{p} \,-\, 9.864} & \text{for}~ D/d_\mathrm{p} > 13
\end{cases}
\nonumber \\
b ~&=~ 0.304 \,-\, \frac{0.724}{D/d_\mathrm{p}}, \quad r^* ~=~ \frac{r}{d_\mathrm{p}}, \quad \varepsilon ~=~ 0.379 \,+\, \frac{0.078}{D/d_\mathrm{p} \,-\, 1.80} \nonumber
\end{align}
} \\
\bottomrule
\end{tabu}
\end{table}

\blindtext[1]

\end{document}

以下仅是表格: 在此处输入图片描述

相关内容