# How to make a table fit page size?

I would like to make a table fit the paperwidth=16cmx24cm I have set. How to do that please? Thanks. Below is the code:

\documentclass[12pt]{book}
\usepackage[paperwidth=16cm, paperheight=24cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{lipsum}

\usepackage{tikz}

\usetikzlibrary{arrows,automata,matrix,positioning}

\begin{document}
\begin{center}
\begin{tabular}{|r|r|r|r|r|}
\hline
$Q$ $\ast$& $\Sigma$ $\rightarrow \Gamma$ &  & $\ast (R/L)$ & $Q$ \\
\hline
\lipsum \\
\hline
\end{tabular}
\end{center}
\end{document}


Edited after Mico comment

\documentclass[12pt]{book}
\usepackage[paperwidth=16cm, paperheight=24cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{tabularx}

\usepackage{tikz}

\usetikzlibrary{arrows,automata,matrix,positioning}

\begin{document}
\begin{center}

\begin{tabular*}{0.75\textwidth}{|r|r|r|r|r|}
\hline
$Q$ $\ast$& $\Sigma$ $\rightarrow \Gamma$ &  & $\ast (R/L)$ & $Q$ \\
\hline
When we stand on a particular state $Q$ & and we have to read a symbole as input & we write someting ont the tape $\Gamma$ & and we move left/on the tape & and we get to the next state. \\
\hline
\end{tabular*}

\begin{tabularx}{0.75\textwidth}{@{\extracolsep{\fill}}|r|r|r|r|r|}
\hline
$Q$ $\ast$& $\Sigma$ $\rightarrow \Gamma$ &  & $\ast (R/L)$ & $Q$ \\
\hline
When we stand on a particular state $Q$ & and we have to read a symbole as input & we write someting ont the tape $\Gamma$ & and we move left/on the tape & and we get to the next state. \\
\hline
\end{tabularx}
\end{center}
\end{document}

• If a table has to have a certain width, don't use tabular. Instead, use either tabular* or tabularx. Which one of these two to employ depends importantly on the contents of the table. You're not really looking to typeset several paragraphs of lipsum gibberish, are you? Incidentally, is there a reason for writing $Q$ $\ast$ and $\Sigma$ $\rightarrow \Gamma$ instead of $Q \ast$ and $\Sigma \rightarrow \Gamma$? – Mico Jun 16 at 4:22
• Mico, getting the same result with both environment tabular* and tabularx. Question above has been updated. – cProg Jun 16 at 10:09

I wrote in an earlier comment:

If a table has to have a certain width, don't use tabular. Instead, use either tabular* or tabularx. Which one of these two to employ depends importantly on the contents of the table.

Since the table in your addendum requires line-breaking, you shouldn't be using tabular* environment. Focus on getting the tabularx syntax straight. In particular, one or more columns of a tabularx environment must be of type X. (Do please study the user guide of the tabularx environment for more information.)

\documentclass[12pt]{book}
\usepackage[paperwidth=16cm, paperheight=24cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{tabularx,ragged2e}
\newcolumntype{R}{>{\RaggedLeft}X}

\begin{document}
\begin{center}

\begin{tabularx}{0.75\textwidth}{|*{5}{R|}}
\hline
$Q \ast$& $\Sigma \rightarrow \Gamma$ &  & $\ast (R/L)$ & $Q$ \\
\hline
When we stand on a particular state~$Q$ & and we have to read a symbole as input & we write someting ont the tape $\Gamma$ & and we move left/on the tape & and we get to the next state. \\
\hline
\end{tabularx}

\end{center}
\end{document}