How can i auto resize the column according to content

1,127

Yes, for example you can chenge

\begin{tabular}{*{6}{|c}}

onto

\begin{tabular}{*{6}{|p{2cm}}}

Of, course 2cm is only an example of width. This gives a paragraph, so entries are never (well, rarely) too long.

Share:
1,127

Related videos on Youtube

user17
Author by

user17

Updated on May 04, 2020

Comments

  • user17
    user17 over 3 years

    I use this code:

    \begin{table}[H]
    \caption{Offsets 2}
    \centering
    \begin{tabular}{*{6}{|c}}
    \hline\hline
    \rowcolor{orange}
    student status  &  location type  & outside region & approved outside area (ha) & delivery agent\\ \hline \hline
    Current         &  Restoration    & Northwest john Province & 476.0 & 
    If the position ... \\ \hline
    \end{tabular}
    \label{table:nonlin}
    \end{table}
    

    But the table is going outside the page. Is there any way that page don't go outside the page and shrink accoring to content and fit on page.

    • Betohaku
      Betohaku over 10 years
      Could you please provide a MWE? A more readable indentation would be a huge help as well.
  • user17
    user17 over 10 years
    that was perfect , i got that. Is there any way to put the caption on the top of table and remove table 5 text from there
  • Przemysław Scherwentke
    Przemysław Scherwentke over 10 years
    @user17 But the caption is over (on the top of) the table. Do you mean the same table, as in your question?