[Tex/LaTex] Trying to fit a table in the width of a paper

tables

I am trying to make the width of the table equal or less than the width of the paper so it will fit in it. I wrote the code of the table below but it doesn't fit in the paper as shown in the figure below, any help??

enter image description here

My code is:

\begin{table}[h]
\begin{tabular}{lllll}
                                & \textbf{k-generated} & \textbf{generated goal} & \textbf{male} & \textbf{female} \\
\textbf{NONgenerated}          & NO               & YES                     & YES          & NO             \\
\textbf{AUTOMATIC/generated supervising} & NO               & YES                     & YES          & YES            \\
\textbf{REAL-TIME/generated}       & NO               & NO                      & NO           & YES            \\
\textbf{generated}               & NO               & NO                      & NO           & YES            \\
\textbf{generated LOW}           & 0.9              & 0.74                    & 0.85         & 0.74           \\
\textbf{generated}             & LOW              & HIGH                    & HIGH         & LOW           
\end{tabular}
\end{table}

Best Answer

Without resizing, you can use the makecell package and rotate the column heads:

\documentclass[12pt]{report}

\usepackage{array, makecell, booktabs, rotating}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadalign{lc}

    \begin{document}
Text text text text text text text text text text text text text text text text text
\begin{table}[h]
  \renewcommand\cellrotangle{35}
  \settowidth{\rotheadsize}{ HIGH }
  \centering
  \begin{tabular}{*{5}{l}@{}}
    \addlinespace[2ex]
                          & \rothead{\rlap{k-generated}} & \rothead{\rlap{generated goal}} & \rothead{\rlap{male}} & \rothead{\rlap{female}} \\
    \midrule[\heavyrulewidth]
    \thead{NONgenerated} & NO & YES & YES & NO \\
    \thead{AUTOMATIC/ & & & & \\generated supervising} & NO & YES & YES & YES \\
    \thead{REAL-TIME/ & & & & \\generated} & NO & NO & NO & YES \\
    \thead{generated} & NO & NO & NO & YES \\
    \thead{generated LOW} & 0.9 & 0.74 & 0.85 & 0.74 \\
    \thead{generated} & LOW & HIGH & HIGH & LOW \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document} 

enter image description here

Related Question