如何使表格適合頁面

如何使表格適合頁面

我的桌子離我的頁面太遠了。我怎麼能讓它們全部出現在單一頁面上。 在此輸入影像描述

請參閱乳膠代碼

\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) 使用環境tabularx而不是tabular環境,並進行換行受僱於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}

相關內容