web-dev-qa-db-ja.com

LaTeX、大きなテーブルをページに収める方法

次の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テーブルを1ページに収めたいと思います。私はあなたの助けに感謝します

10
A Alnafessah

Martin Scharrer が示唆するように TeX.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}

ここでは、Wordの破損をローカルで回避するために、{\small ... }\parをどこかで使用しました。最初にフォントサイズを設定し、次に5列の幅を設定し、最後に必要に応じてローカルに調整する必要があります。

13
MattAllegro