簡體   English   中英

LaTeX,如何在頁面中放置一個大表

[英]LaTeX, How to fit a large table in a page

以下LaTeX代碼生成一個表,但它包含較小的字體大小,並且它不適合頁面:

\documentclass{article}
\usepackage{tabularx} % in the preamble
\usepackage{graphicx}

\begin{document}

        \begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{lllll}
    Detection Methods & Supervised /Semi-supervised/ Unsupervised & Technique Used                                                                    & Applications                                            & Technology                                                           \\
    Statistical       &                                           & Gaussian-based detection                                                          & Online anomaly detection                                & Conventional   data centres                                          \\
    Statistical       &                                           & Gaussian-based detection                                                          & General                                                 & General                                                              \\
    Statistical       &                                           & Regression analysis                                                               & Globally-distributed commercial applications            & Distributed, Web-based, Application \& System metrics                \\
    Statistical       &                                           & Regression analysis                                                               & Web applications                                        & Enterprise web applications and conventional data centre             \\
    Statistical       &                                           & Correlation                                                                       & Complex enterprise online applications                  & Distributed System                                                   \\
    Statistical       &                                           & Correlation                                                                       & Orleans system and distributed cloud computing services & Virtualized, cloud computing and distributed system (Orleans system) \\
    Statistical       &                                           & Correlation                                                                       & Hadoop, Olio and RUBiS                                  & Virtualized cloud computing and distributed systems.                 \\
    ĘMachine learning & Supervised                                & Bayesian classification                                                           & Online application                                      & IBM system S-distributed stream processing cluster                   \\
    Machine learning  & Unsupervised                              & Neighbour-based technique (Local Outlier Factor algorithm)                        & General                                                 & Cloud Computing system                                               \\
    Machine learning  & Semi-supervised                           & Principle component analysis and  Semi-supervised Decision-tree\_                 & Institute-wide cloud computing environment              & Cloud Computing                                                      \\
    Statistical       &                                           & Regression curve fitting the service time-adapted cumulative distributed function & Online application service                              & Platform and configuration agnostic                                  \\
                      &                                           &                                                                                   &                                                         &                                                                     
    \end{tabular}%
    }
    \end{table}

\end{document}

我想將這個LaTeX表放在一個頁面中。 我感謝您的幫助

正如Martin ScharrerTeX.SX對此答案的評論中所建議的,命令\\resizebox一個更好的替代方法是使用adjustbox包。 編譯以下內容,然后與\\begin{adjustbox}{width=\\textwidth}\\end{adjustbox}的相同代碼進行比較。

如果您需要進一步解釋,請發表評論!

\documentclass{article}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}

\begin{document}

\begin{table}[]
  \centering
  \caption{My caption}
  \label{my-label}

  \begin{adjustbox}{width=\textwidth}

    \begin{tabular}{lllll}
Detection Methods & Supervised /Semi-supervised/ Unsupervised & Technique Used & Applications & Technology \\
Statistical & & Gaussian-based detection & Online anomaly detection & Conventional data centres \\
Statistical & & Gaussian-based detection & General & General \\
Statistical & & Regression analysis & Globally-distributed commercial applications & Distributed, Web-based, Application \& System metrics \\
Statistical & & Regression analysis & Web applications & Enterprise web applications and conventional data centre \\
Statistical & & Correlation & Complex enterprise online applications & Distributed System \\
Statistical & & Correlation & Orleans system and distributed cloud computing services & Virtualized, cloud computing and distributed system (Orleans system) \\
Statistical & & Correlation & Hadoop, Olio and RUBiS & Virtualized cloud computing and distributed systems. \\
ĘMachine learning & Supervised & Bayesian classification & Online application & IBM system S-distributed stream processing cluster \\
Machine learning & Unsupervised & Neighbour-based technique (Local Outlier Factor algorithm) & General & Cloud Computing system \\
Machine learning & Semi-supervised & Principle component analysis and Semi-supervised Decision-tree\_ & Institute-wide cloud computing environment & Cloud Computing \\
Statistical & & Regression curve fitting the service time-adapted cumulative distributed function & Online application service & Platform and configuration agnostic \\
& & & & 
    \end{tabular}

  \end{adjustbox}

\end{table}

\end{document}

如果表中的(太小)字體大小是主要問題,則采用不同的方法; 您可能希望在單元格中的更多行上重新排列單個單元格中的文本:

\documentclass{article}

\begin{document}

\begin{table}[htp]
  \centering
  \caption{My caption}
  \label{my-label}
{\small %
    \begin{tabular}{p{.18\textwidth}p{.22\textwidth}p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}}
Detection\par Methods & Supervised/\par Semi-supervised/\par Unsupervised & Technique Used & Applications & Technology \\
Statistical & & Gaussian-based detection & Online anomaly detection & Conventional data centres \\
Statistical & & Gaussian-based detection & General & General \\
Statistical & & Regression\par analysis & Globally-distributed commercial applications & Distributed, Web-based, Application \&\par System metrics \\
Statistical & & Regression\par analysis & Web applications & Enterprise web applications and conventional data centre \\
Statistical & & Correlation & Complex\par enterprise online applications & Distributed\par System \\
Statistical & & Correlation & Orleans system and distributed cloud computing services & Virtualized, cloud computing and distributed system (Orleans system) \\
Statistical & & Correlation & Hadoop,\par Olio and RUBiS & Virtualized cloud computing and distributed systems. \\
ĘMachine\par learning & Supervised & Bayesian\par classification & Online\par application & IBM system S-distributed stream\par processing\par cluster \\
Machine\par learning & Unsupervised & Neighbour-based technique (Local Outlier Factor algorithm) & General & Cloud\par Computing\par system \\
Machine\par learning & Semi-supervised & Principle component analysis and Semi-supervised Decision-tree\_ & Institute-wide cloud computing environment & Cloud\par Computing \\
Statistical & & Regression curve fitting the service time-adapted cumulative distributed function & Online\par application service & Platform and configuration agnostic \\
& & & & 
    \end{tabular}%
}%
\end{table}

\end{document}

在這里,我使用{\\small ... }\\par ,在某處,在本地避免單詞破壞。 您應首先根據需要設置字體大小,然后設置五列的寬度,最后在必要時進行本地調整。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM