作为新用户,我有很多问题,现在我已经完成了我的第一篇文章,并希望对其进行改进,我将单独提出这些问题。继我之前的问题之后(这里),我想在表格中添加第三列,并解释索引,但没有成功。我认为解决方案就在这里(表格环境)
感谢您的任何想法。
documentclass{article}
\usepackage{array,ragged2e,booktabs}
%% Define a new column type, for centered automatic displaystyle math mode material
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\begin{center}
\begin{landscape}
\begin{tabular}{@{}
>{\RaggedRight}m{8em}
C % <-- note use of "C" column type
@{}}
\toprule
Index & \multicolumn{1}{c}{Formula} \\
\midrule
Burn Area Index (BAI)
& \frac{1}{(0.1-\mathrm{Red})^2 + (0.06-\mathrm{NIR})^2} \\
\addlinespace
Difference Vegetation Index (dvi)
&\mathrm{NIR} - \mathrm{Red}\\
\addlinespace
Enhanced Vegetation Index (EVI)
&2.5\ast\frac{\mathrm{NIR} - \mathrm{Red}}{%
(\mathrm{NIR} + 6\ast \mathrm{Red}
- 7.5\ast \mathrm{Blue} + 1)}\\
\addlinespace
Normalised Difference Vegetation Index (NDVI)
&\textrm{NDVI}=\frac{\mathrm{NIR} - \mathrm{Red}}{%
\mathrm{NIR} + \mathrm{Red}}\\
\addlinespace
Leaf Area Index (LAI)
&3.618\ast \mathrm{EVI} - 0.118\\
\addlinespace
Normalised Burn Ration (NBR)
&\frac{\mathrm{NIR} - \mathrm{SWIR}}{%
\mathrm{NIR} + \mathrm{SWIR}}\\
\addlinespace
Difference Normalised Burn Ration (DNBR)
& (\textrm{Pre-fire NBR}) - (\textrm{Post-fire NBR}) \\
\addlinespace
Normalised Difference Water Index (NDWI)
&\frac{\rho_{857} - \rho_{1241}}{\rho_{857} - \rho_{1241}} \\
\bottomrule
\end{tabular}
\captionof{table}{Table Title} \label{tab:title}
\end{landscape}
\end{center}
答案1
您可以添加一个额外的列用于解释,如下面的代码所示:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{ragged2e}
\usepackage{capt-of}
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\begin{document}
\begin{landscape}
\centering
\begin{tabular}{@{}
>{\RaggedRight}m{8em}
C
m{8cm}
@{}}
\toprule
Index & \multicolumn{1}{c}{Formula} & Explanation \\
\midrule
Burn Area Index (BAI)
& \frac{1}{(0.1-\mathrm{Red})^2 + (0.06-\mathrm{NIR})^2}
& Here you can add some explanation of the indices. The explanatory text can span multiple lines and is vertically centered with respect to the same row's contents of the pervious two columns\\
\addlinespace
Difference Vegetation Index (dvi)
&\mathrm{NIR} - \mathrm{Red}\\
\addlinespace
Enhanced Vegetation Index (EVI)
&2.5\ast\frac{\mathrm{NIR} - \mathrm{Red}}{%
(\mathrm{NIR} + 6\ast \mathrm{Red}
- 7.5\ast \mathrm{Blue} + 1)}\\
\addlinespace
Normalised Difference Vegetation Index (NDVI)
&\textrm{NDVI}=\frac{\mathrm{NIR} - \mathrm{Red}}{%
\mathrm{NIR} + \mathrm{Red}}\\
\addlinespace
Leaf Area Index (LAI)
&3.618\ast \mathrm{EVI} - 0.118\\
\addlinespace
Normalised Burn Ration (NBR)
&\frac{\mathrm{NIR} - \mathrm{SWIR}}{%
\mathrm{NIR} + \mathrm{SWIR}}\\
\addlinespace
Difference Normalised Burn Ration (DNBR)
& (\textrm{Pre-fire NBR}) - (\textrm{Post-fire NBR}) \\
\addlinespace
Normalised Difference Water Index (NDWI)
&\frac{\rho_{857} - \rho_{1241}}{\rho_{857} - \rho_{1241}} \\
\bottomrule
\end{tabular}
\captionof{table}{Table Title} \label{tab:title}
\end{landscape}
\end{document}
如果要自动使表格宽度与当前线宽一样宽,也可以使用tabularx
如下例所示的方式:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{ragged2e}
\usepackage{capt-of}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\begin{document}
\begin{landscape}
\centering
\begin{tabularx}{\linewidth}{@{}
>{\RaggedRight}m{8em}
C
X
@{}}
\toprule
Index & \multicolumn{1}{c}{Formula} & Explanation \\
\midrule
Burn Area Index (BAI)
& \frac{1}{(0.1-\mathrm{Red})^2 + (0.06-\mathrm{NIR})^2}
& Here you can add some explanation of the indices. The explanatory text can span multiple lines and is vertically centered with respect to the same row's contents of the pervious two columns\\
\addlinespace
Difference Vegetation Index (dvi)
&\mathrm{NIR} - \mathrm{Red}\\
\addlinespace
Enhanced Vegetation Index (EVI)
&2.5\ast\frac{\mathrm{NIR} - \mathrm{Red}}{%
(\mathrm{NIR} + 6\ast \mathrm{Red}
- 7.5\ast \mathrm{Blue} + 1)}\\
\addlinespace
Normalised Difference Vegetation Index (NDVI)
&\textrm{NDVI}=\frac{\mathrm{NIR} - \mathrm{Red}}{%
\mathrm{NIR} + \mathrm{Red}}\\
\addlinespace
Leaf Area Index (LAI)
&3.618\ast \mathrm{EVI} - 0.118\\
\addlinespace
Normalised Burn Ration (NBR)
&\frac{\mathrm{NIR} - \mathrm{SWIR}}{%
\mathrm{NIR} + \mathrm{SWIR}}\\
\addlinespace
Difference Normalised Burn Ration (DNBR)
& (\textrm{Pre-fire NBR}) - (\textrm{Post-fire NBR}) \\
\addlinespace
Normalised Difference Water Index (NDWI)
&\frac{\rho_{857} - \rho_{1241}}{\rho_{857} - \rho_{1241}} \\
\bottomrule
\end{tabularx}
\captionof{table}{Table Title} \label{tab:title}
\end{landscape}
\end{document}
center
请注意,我已经用命令替换了环境\centering
,因为前者会导致出现不必要的额外空白。