[Tex/LaTex] tabular* right border misplaced

bordertablestabularx

I know this may sound stupid of a question but I am a very beginner in LaTeX.

\begin{table}[H]
    \centering
    \begin{tabular*}{\textwidth}{|c|}
        \hline                                
        \begin{tabular}[c]{@{}l@{}}           
        \textbf{\textbf{Description sommaire}}:        
    \end{tabular} 
    \\ \hline
    \end{tabular*}
\end{table}

I am trying to force a table into page width. I used {tabular*} for that and it worked. But now I have an issue with borders. The left border is displayed normally however the right one is misplayed.

enter image description here

My table has only one column and I want the right border to be on the right end of the table. How can I do that?

Best Answer

tabular* has a special syntax which must be followed to take advantage of its capability to expand the table to the whole textwidth. Here is the required syntax:

\begin{table}[htbp]
    \centering
    \begin{tabular*}{\textwidth}{|c|@{\extracolsep{\fill}}c|}
        \hline                                          
        \textbf{\textbf{Description sommaire}}: &  \\ \hline
    \end{tabular*}
\end{table}

enter image description here

Otherwise, just use the more-common tabularx environment (which I recommend):

\begin{table}[htbp]
    \centering
    \begin{tabularx}{\textwidth}{|c|X|}
        \hline                                          
        \textbf{\textbf{Description sommaire}}: &  \\ \hline
    \end{tabularx}
\end{table}

this gives the same result plus text-wrapping as a bonus.