使表格适合文本长度,且各列间距紧密

使表格适合文本长度,且各列间距紧密
\documentclass[a4paper, 11pt, oneside]{Thesis}  
% Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
\usepackage[square, numbers, comma, sort&compress]{natbib}  

%% -----------------------------------------------------
\begin{document}
\pagestyle{fancy}  
\fancyhead{}  
\rhead{\thepage}  
\lhead{}  
% Now begin the Appendices, including them as separate files

\addtocontents{toc}{\vspace{2em}} % Add a gap in the Contents, for aesthetics

\appendix % Cue to tell LaTeX that the following 'chapters' are Appendices

\input{Appendices/AppendixA}    

\begin{table}[h!]
\centering
\begin{tabular}{|c c c c c|}
 \hline
 \large{\textbf{Compound Name}} & \large{\textbf{DiscoveRx Gene Symbol}}& \large{\textbf{Entrez Gene Symbol}} & \large{\textbf{Modifier}}&\large{\textbf{Kd (nM)}} \\ [0.5ex] 
 \hline\hline
 Idromonib &AKT1&   AKT1&   $>$ &10000  \\ 
 \hline
 Idromonib &AKT2&   AKT2&   $>$ &10000  \\ 
 \hline
  Idromonib &AKT3&  AKT3&   $>$ &10000  \\ 
 \hline
 Idromonib &ASK1&   MAP3K5  &$>$    &10000\\
  \hline

 \hline
  \end{tabular}
  \caption{MER screen by companyX.\label{MER screen by companyX.}}
  The MER screen demonstrated that of the 39 compounds tested, AB,bc, CD, db and DF had lower Kd values.
\end{table}

\addtocontents{toc}{\vspace{2em}}  % Add a gap in the Contents, for aesthetics
\backmatter

\end{document}

我试图让这个表格有 39 行(在示例代码中,我只添加了 4 行,所以看起来,即使我将表格横向放置,多余的行也可能无法容纳在单个页面中),但尽管看起来sidewaystable可能不错,但我希望它垂直适合页面,并且列靠得很近。但实际情况是,随着标题变长,列会分散,最后一列会移出边距,有什么最好的方法可以让它完全适合 A4 页面\documentclass{article}

答案1

您可以使用多行标题

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage{array}
\newcommand\hd[1]{\large\bfseries\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}
\begin{document}
 \begin{table}[htp]
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{@{}|c c c c c|@{}}
 \hline
 \hd{Compound\\Name} & \hd{DiscoveRx\\Gene\\Symbol}& \hd{Entrez\\Gene\\Symbol} & \hd{Modifier}&\hd{Kd\\(nM)} \\ [0.5ex] 
 \hline\hline
 Idromonib &AKT1&   AKT1&   $>$ &10000  \\ 
 \hline
 Idromonib &AKT2&   AKT2&   $>$ &10000  \\ 
 \hline
  Idromonib &AKT3&  AKT3&   $>$ &10000  \\ 
 \hline
 Idromonib &ASK1&   MAP3K5  &$>$    &10000\\
  \hline

 \hline
  \end{tabular}
  \caption{MER screen by companyX.\label{MER screen by companyX.}}
  The MER screen demonstrated that of the 39 compounds tested, AB,bc, CD, db and DF had lower Kd values.
\end{table}
\end{document}

相关内容