将大表格放入横向页面

将大表格放入横向页面

我有这张表,我想把它很好地放入横向页面。我无法让它看起来正确。单元格应该是多行的才能正常工作。请告诉我哪里出了问题:

\documentclass{article}

\usepackage[landscape]{geometry}

\begin{document}
\begin{table}[]
  \centering
  \caption{My caption}
  \label{my-label}
  \begin{tabular}{lllll}
    Type of controllers distribution & Description & Proposed approaches & Summery & Disadvantage \\
    Logically distributed & A logically centralized and physically distributed control plane & HyperFlow & Publish-subscribe method with WheelFS file system for cross-controller communication and global network view sharing. & Additional maintenance and subscription management overhead. \\
                                     &  & DIFANE & Distributed controller’s rules across a subset of the authority switches. & ? Small overhead between the central controller and switches and high resource consumption(i.e., CPU, TCAM space) at switches \\
    Physically distributed & Control platforms distributed on one or & Onix & Publish0subscribe method with the NIB database system & Additional maintenance and subscription management overhead \\
                                     &  & BalanceFlow & One super controller and many normal controllers, where the super controller is responsible for load balancing among all controllers & Additional overhead at control plane. \\
    Hierarchical & Two-level hierarchy for controllers (local controllers and a logically centralized root controller) & Kandoo & Local controllers execute local applications and each local controller controls one or some switches. & No global network view for the application processes at local controllers \\
                                     &  &  & The root controller controls all local controllers and runs non-local control applications. &  \\
    Hybrid & Logically Centralized, but physically distributed clusters of controllers & SOX/DSOX & Centrally controlled cluster of controllers running in equal mode with automatic failover and load balancing while such a controller cluster is targeted to manage a ‘‘significant-size’’ of a (sub) network. & No full consistency among the distributed controller clusters \\
                                     &  &  & The controller clusters can be physically distributed to control different (sub) networks with required synchronization for necessary consistency, whilethose distributed controllers can be inter-connected through a service bus or extended BGP protocol as defined in the software-services defined networking technology & 
  \end{tabular}
\end{table}
\end{document}

答案1

一个快速而肮脏的例子tabular

\documentclass{article}

\usepackage[landscape, margin=1in]{geometry}

\begin{document}
\begin{table}[]
  \centering
  \caption{My caption}
  \label{my-label}
  % The 'p' column type lets you specify the width of the column.
  % Note that you can also write something like 'p{0.25\linewidth}'
  % (to use 25% of the line width) instead of constants like I've done.
  \begin{tabular}{p{2cm} p{5cm} l p{7cm} p{4cm}}
    Type of controllers distribution & Description & Proposed approaches & Summery & Disadvantage \\
    Logically distributed & A logically centralized and physically distributed control plane & HyperFlow & Publish-subscribe method with WheelFS file system for cross-controller communication and global network view sharing. & Additional maintenance and subscription management overhead. \\
                                     &  & DIFANE & Distributed controller’s rules across a subset of the authority switches. & ? Small overhead between the central controller and switches and high resource consumption(i.e., CPU, TCAM space) at switches \\
    Physically distributed & Control platforms distributed on one or & Onix & Publish0subscribe method with the NIB database system & Additional maintenance and subscription management overhead \\
                                     &  & BalanceFlow & One super controller and many normal controllers, where the super controller is responsible for load balancing among all controllers & Additional overhead at control plane. \\
    Hierarchical & Two-level hierarchy for controllers (local controllers and a logically centralized root controller) & Kandoo & Local controllers execute local applications and each local controller controls one or some switches. & No global network view for the application processes at local controllers \\
                                     &  &  & The root controller controls all local controllers and runs non-local control applications. &  \\
    Hybrid & Logically Centralized, but physically distributed clusters of controllers & SOX/DSOX & Centrally controlled cluster of controllers running in equal mode with automatic failover and load balancing while such a controller cluster is targeted to manage a ‘‘significant-size’’ of a (sub) network. & No full consistency among the distributed controller clusters \\
                                     &  &  & The controller clusters can be physically distributed to control different (sub) networks with required synchronization for necessary consistency, whilethose distributed controllers can be inter-connected through a service bus or extended BGP protocol as defined in the software-services defined networking technology & 
  \end{tabular}
\end{table}
\end{document}

在此处输入图片描述

LaTeX wikibook 有一个很好的部分关于这一点。

答案2

此表格无法容纳一页。我建议使用ltablex,它结合了longtabletabularx,以及一些其他有用的包:(caption用于标题和表格之间的正确垂直间距)、makecell(用于列标题和单元格内换行的通用格式)和booktabs

\documentclass{article}

\usepackage[landscape]{geometry}
\usepackage{ragged2e}
\usepackage{array, ltablex, booktabs, caption, makecell}
\renewcommand{\tabularxcolumn}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\setlength\defaultaddspace{2ex}
\renewcommand\theadfont{\normalsize\bfseries}
\captionsetup{labelfont=sc}

\begin{document}

\setlength{\tabcolsep}{4pt}
\begin{tabularx}{\linewidth}{lXc*{2}{X}}
  \caption{My caption} \label{my-label} \\%
  \toprule
  \thead[l]{Type of & & & & \\ controllers\\distribution} & \thead{Description} & \thead{Proposed\\ approaches} & \thead{Summary} & \thead{Disadvantage} \\
  \midrule
  \addlinespace
  \endfirsthead
  \rlap{\emph{Continued from previous page}}\smallskip\\
  \toprule
  \thead[lt]{Type of & & & & \\ controllers\\distribution} & \thead{Description} & \thead{Proposed\\ approaches} & \thead{Summary} & \thead{Disadvantage} \\
  \midrule
  \endhead
  \endlastfoot
  \addlinespace[2ex]\midrule\noalign{\smallskip}\multicolumn{5}{r@{}}{\em To be continued}
  \endfoot
  \makecell[lt]{Logically & & & & \\ distributed} & A logically centralized and physically distributed control plane & HyperFlow & Publish-subscribe method with WheelFS file system for cross-controller communication and global network view sharing. & Additional maintenance and subscription management overhead. \\
  \addlinespace
                          & & DIFANE & Distributed controller’s rules across a subset of the authority switches. & ? Small overhead between the central controller and switches and high resource consumption(i.e., CPU, TCAM space) at switches \\
  \addlinespace
  \makecell[l]{Physically & & & & \\ distributed} & Control platforms distributed on one or & Onix & Publish-subscribe method with the NIB database system & Additional maintenance and subscription management overhead \\
  \addlinespace
                          & & BalanceFlow & One super controller and many normal controllers, where the super controller is responsible for load balancing among all controllers & Additional overhead at control plane. \\
  \addlinespace
  Hierarchical & Two-level hierarchy for controllers (local controllers and a logically centralized root controller) & Kandoo & Local controllers execute local applications and each local controller controls one or some switches. & No global network view for the application processes at local controllers \\
  \addlinespace
                          & & & The root controller controls all local controllers and runs non-local control applications. & \\
  \addlinespace
  Hybrid & Logically Centralized, but physically distributed clusters of controllers & SOX/DSOX & Centrally controlled cluster of controllers running in equal mode with automatic failover and load balancing while such a controller cluster is targeted to manage a ‘‘significant-size’’ of a (sub) network. & No full consistency among the distributed controller clusters \\
  \addlinespace
                          & & & The controller clusters can be physically distributed to control different (sub) networks with required synchronization for necessary consistency, whilethose distributed controllers can be inter-connected through a service bus or extended BGP protocol as defined in the software-services defined networking technology & \\
  \bottomrule
\end{tabularx}

\end{document} 

在此处输入图片描述

在此处输入图片描述

相关内容