如何使表格适合页面

如何使表格适合页面

我的表格远离了我的页面。我怎样才能使它们全部出现在单个页面上。 在此处输入图片描述

请参阅 latex 代码

\begin{table}[h!]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c| c|}
\hline
Measure & {NormCnts} & {LFC}  & Up/down Expressed & CPM & TPM & RPKM  & rlog & VST\\ \hline
Scale & [0-$\infty$] & [0-$\infty$]  & [0 or 1] & [0-$\infty$] & [0- $\infty$]  & & [0- $\infty$] & [0- $\infty$] \\ \hline
Type & Discrete & Discrete & Binary  & Continuous  & Continuous & & rlog & VST\\ \hline
Mean & Bimodal (highest peak) & insertValue & insertValue & insertValue & insertValue&insertValue & rlog & VST\\ \hline
Var & Heavy tailed (centered on 2500)  & insertValue & insertValue & insertValue & insertValue& insertValue& rlog & VST\\ \hline
Special & insertValue  & insertValue & insertValue &  insertValue& insertValue& corrected for gene length & Var Stabilizing & Var Stabilizing\\ \hline
\end{tabular}
\end{center}
\caption{Comparison of various transformation techniques of gene expression.}
\label{table:Y_compare}
\end{table}

答案1

鉴于表格有 9 列,而其中只有 5 列可以自动换行,我的主要建议是 (a) 以横向模式呈现表格,以及 (b) 使用 envionmenttabularx而不是tabularenvironment,在 9 列中的 5 列中使用换行。(在下面显示的代码中,请注意这些列的相对列宽 5 等于它们的数字, 5. 还请注意可用的第 2 列的宽度是第 8 列和第 9 列的宽度的两倍。)

在此处输入图片描述

\documentclass{article} 
\usepackage[english]{babel} 
\usepackage[letterpaper,vmargin=2cm,hmargin=3cm,
            marginparwidth=1.75cm]{geometry}
\usepackage{pdflscape} % for 'landscape' environment
\usepackage{tabularx}  % for 'tabularx' environment and 'X' column type
\newcolumntype{C}[1]{%
  >{\centering\arraybackslash\hsize=#1\hsize}X} % centered version of 'X' col. type
\renewcommand\tabularxcolumn[1]{m{#1}} % center cell contents vertically

\begin{document}
\begin{landscape}

\begin{table}
\setlength\extrarowheight{2pt} % for a less-cramped look
\centering
\begin{tabularx}{0.9\linewidth}{|l|C{1.6}|c|C{0.9}|c|c|C{0.9}|C{0.8}|C{0.8}|}
\hline
Measure & {NormCnts} & {LFC} & Up/down Expressed & CPM & TPM & RPKM & rlog & VST \\ 
\hline
Scale & 0--$\infty$ & 0--$\infty$ & 0 or 1 & 0--$\infty$ & 0--$\infty$ & & 0--$\infty$ & 0--$\infty$ \\ 
\hline
Type & Discrete & Discrete & Binary & Continuous & Continuous & & rlog & VST \\ 
\hline
Mean & Bimodal (highest peak) & insertValue & insertValue & insertValue & insertValue & insertValue & rlog & VST \\ 
\hline
Var & Heavy tailed (centered on 2500) & insertValue & insertValue & insertValue & insertValue & insertValue & rlog & VST \\ 
\hline
Special & insertValue & insertValue & insertValue & insertValue & insertValue & corrected for gene length & Var Stabilizing & Var Stabilizing \\ 
\hline
\end{tabularx}

\caption{Comparison of various transformation techniques of gene expression.}
\label{table:Y_compare}

\end{table}

\end{landscape}
\end{document}

相关内容