LaTeX,如何在页面中容纳大 table
LaTeX, How to fit a large table in a page
下面的 LaTeX 代码生成 table 但它包含较小的字体,不适合页面:
\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 table 放在一页中。
感谢您的帮助
根据 Martin Scharrer in a comment to this answer on TeX.SX, one better alternative to the command \resizebox
is to use the adjustbox
包的建议。编译以下内容,然后与注释 \begin{adjustbox}{width=\textwidth}
和 \end{adjustbox}
的相同代码进行比较。
如果您需要进一步的解释,请post发表评论!
\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}
如果 table 中的(太小)字体大小是主要问题,则采用不同的方法;您可能希望在单元格内的更多行上重新排列单个单元格中的文本:
\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
来避免局部断词。您应该先设置字体大小,然后设置五列的宽度,最后根据需要进行局部调整。
下面的 LaTeX 代码生成 table 但它包含较小的字体,不适合页面:
\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 table 放在一页中。 感谢您的帮助
根据 Martin Scharrer in a comment to this answer on TeX.SX, one better alternative to the command \resizebox
is to use the adjustbox
包的建议。编译以下内容,然后与注释 \begin{adjustbox}{width=\textwidth}
和 \end{adjustbox}
的相同代码进行比较。
如果您需要进一步的解释,请post发表评论!
\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}
如果 table 中的(太小)字体大小是主要问题,则采用不同的方法;您可能希望在单元格内的更多行上重新排列单个单元格中的文本:
\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
来避免局部断词。您应该先设置字体大小,然后设置五列的宽度,最后根据需要进行局部调整。