我正在尝试在 tabularx 环境中插入两行方程。我设法使用 vbox 为一行方程完成此操作,但我似乎无法为两行方程完成此操作。我尝试了多行,但我不想用固定值设置周围单元格的宽度。我希望它看起来与具有一行方程的其他行相似。
这就是我要的:
这是我的最后一次尝试:
\documentclass[12pt,fleqn,openany,letterpaper,pagesize]{scrbook}
\usepackage{tabularx}
\usepackage{array}
\usepackage{ltablex}
\usepackage{amsmath, amsfonts, amssymb}
\begin{document}
\setlength{\tabcolsep}{2pt}
\renewcommand{\arraystretch}{2}
\newcolumntype{C}[1]{>{\hsize=#1\hsize\centering\let\newline\\\arraybackslash}X}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcommand\fch{0.2}
\newcommand\sch{0.35}
\newcommand\tch{0.3}
\newcommand\fich{0.15}
\begin{tabularx}{\hsize}{|C{\fch}|C{\sch}|C{\tch}|C{\fich}|}
\hline
Acoustic Entropy Index (H) &
\vbox{\begin{equation}
H_t H_s
\end{equation}} &
It is the product of $H_s$ and $H_t$ (see below). It ranges between 0 and 1; 0 for pure tones and 1 for white noise. &
\cite{Sueur2008} \\ \hline
Entropy of spectral maxima ($H_m$) &
{\begin{align}
U_j &= \mathrm{max}(s_{i,w}), \forall w = j \\
H_m &= - \sum_{j=1}^{N_f} U_j\log_{2}U_j
\end{align}}&
The Shannon index is applied to the maximum values of each frequency bin in the spectrogram, but only in the band between 482 Hz and 8820 Hz (expanding the biophony band). $s_{i,w}$ stands for a cell in the spectrogram in the time step i and frequency bin w and $U_j$ is the maximum value in the frequency bin j. &
\cite{Towsey2014a} \\ \hline
\end{tabularx}
\bibliographystyle{ieeetran}
\bibliography{library}
\end{document}
代码产生错误。
答案1
这是一个错误的功能,ltablex
您可以使用tabularx
或使用\keepXColumns
,以便对齐不会产生错误。
然而,即使这样,tabularx
也无法真正看到对齐的宽度,如果使用第二列设置宽度,则可以获得稍微好一点的布局,p{..}
但是将所有这些文本放在一个表中会很难看到良好的布局可能性。
\documentclass[12pt,fleqn,openany,letterpaper,pagesize]{scrbook}
\usepackage{tabularx}
\usepackage{array}
\usepackage{ltablex}
\usepackage{amsmath, amsfonts, amssymb}
\begin{document}
\setlength{\tabcolsep}{2pt}
\renewcommand{\arraystretch}{2}
\newcolumntype{C}[1]{>{\hsize=#1\hsize\centering\let\newline\\\arraybackslash}X}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcommand\fch{0.2}
\newcommand\sch{0.35}
\newcommand\tch{0.3}
\newcommand\fich{0.15}
\keepXColumns% \dontBreakStuff
\noindent
\begin{tabularx}{\hsize}{|C{\fch}|C{\sch}|C{\tch}|C{\fich}|}
\hline
Acoustic Entropy Index (H) &
{\begin{equation}
H_t H_s
\end{equation}} &
It is the product of $H_s$ and $H_t$ (see below). It ranges between 0 and 1; 0 for pure tones and 1 for white noise. &
\cite{Sueur2008} \\ \hline
Entropy of spectral maxima ($H_m$) &
{\begin{align}
U_j &= \mathrm{max}(s_{i,w}), \forall w = j \\
H_m &= - \sum_{j=1}^{N_f} U_j\log_{2}U_j
\end{align}}&
The Shannon index is applied to the maximum values of each frequency bin in the spectrogram, but only in the band between 482 Hz and 8820 Hz (expanding the biophony band). $s_{i,w}$ stands for a cell in the spectrogram in the time step i and frequency bin w and $U_j$ is the maximum value in the frequency bin j. &
\cite{Towsey2014a} \\ \hline
\end{tabularx}
\noindent
\begin{tabularx}{\hsize}{|C{\fch}|p{.5\textwidth}|C{\tch}|C{\fich}|}
\hline
Acoustic Entropy Index (H) &
{\begin{equation}
H_t H_s
\end{equation}} &
It is the product of $H_s$ and $H_t$ (see below). It ranges between 0 and 1; 0 for pure tones and 1 for white noise. &
\cite{Sueur2008} \\ \hline
Entropy of spectral maxima ($H_m$) &
{\begin{align}
U_j &= \mathrm{max}(s_{i,w}), \forall w = j \\
H_m &= - \sum_{j=1}^{N_f} U_j\log_{2}U_j
\end{align}}&
The Shannon index is applied to the maximum values of each frequency bin in the spectrogram, but only in the band between 482 Hz and 8820 Hz (expanding the biophony band). $s_{i,w}$ stands for a cell in the spectrogram in the time step i and frequency bin w and $U_j$ is the maximum value in the frequency bin j. &
\cite{Towsey2014a} \\ \hline
\end{tabularx}
\bibliographystyle{ieeetran}
\bibliography{library}
\end{document}
答案2
您还可以加载xltabular
Hervert Voss 的最新软件包,该软件包可以加载ltablex
和处理一些问题。只需使用同名环境即可。我稍微更改了各列宽度的参数X
,因此方程编号与方程保持在同一行:
\documentclass[12pt,fleqn,openany,letterpaper,pagesize]{scrbook}
\usepackage{geometry}
\usepackage{xltabular}
\usepackage{array}
\usepackage{amsmath, amssymb}
\setcounter{chapter}{2}
\setlength{\tabcolsep}{3pt}
\setlength{\mathindent}{3pt}
\renewcommand{\arraystretch}{2}
\newcolumntype{C}[1]{>{\hsize=#1\hsize\centering\let\newline\\\arraybackslash}X}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{document}
\noindent
\begin{xltabular}{\linewidth}{|C{0.7}|C{1.65} |C{1.1}|C{0.55}|}
\hline
Acoustic Entropy Index (H) &
{\begin{equation}
H_t H_s
\end{equation}} &
It is the product of $H_s$ and $H_t$ (see below). It ranges between 0 and 1; 0 for pure tones and 1 for white noise. &
\cite{Sueur2008} \\
\hline
Entropy of spectral maxima ($H_m$) &
{ \begin{align}
U_j & = \mathrm{max}(s_{i,w}), \forall w = j \\\
H_m & = - \sum_{j=1}^{N_f} U_j\log_{2}U_j
\end{align} }%}
&
The Shannon index is applied to the maximum values of each frequency bin in the spectrogram, but only in the band between 482 Hz and 8820 Hz (expanding the biophony band). $s_{i,w}$ stands for a cell in the spectrogram in the time step i and frequency bin w and $U_j$ is the maximum value in the frequency bin j. &
\cite{Towsey2014a} \\ \hline
\end{xltabular}
\end{document}