1

So, I am trying to create a table using;

\begin{tabularx}{\textwidth}{|c|c|c|}
\hline
col1 & col2 & col3 \\
\hline
item 11 & item 12 & item 13 \\ \hline
item 21  & item 22  & item 23 \\\hline
\end{tabularx}

My only requirement is that if the table is too wide for the page, it should automatically adjust all the contents INSIDE of itself so that it can fit the page . ( e.g if there's too much text, introduce line breaks in text and so on .. )

However, the tabularx environment is behaving rather strangely and giving the following result :

why is there an extra 'trailing' column in there ?!

I just want to know what is the reason for that 'trailing' column appearing & how can I get rid of it? According to the code, I only specified 3 columns, so why the fourth column ?

Also, what can I do to make sure this table fits on the page, when I insert all the text and it is too wide ?

I am using IEEE Double Column Conference Template on LaTeX

4
  • 4
    never use tabularx without an X column, you are just using c so it has no way to achieve the specified width (this will also fix your "also..." question as the point of tabularx is to adjust line breaking in X columns, but c columns do not allow lie breaking so thetable just gets wider as you add more text. Feb 27 at 23:07
  • @DavidCarlisle, can i ask what is an x column and should i use it in my case ? I would also appreciate if you can take a look at the next part of the question ( fitting the column into the page width ). Thank you ! Edit : i think you answered it in your edit Feb 27 at 23:09
  • 2
    any documentation that told you about tabularx will have examples of X in use, that is the sole extension that tabularx has over tabular. see texdoc tabularx Feb 27 at 23:10
  • @DavidCarlisle many thanks ! and much obliged, i know you're one of the creators of LaTeX :) If you type your guidance as an answer, i will be happy to mark it as the correct solution ! Feb 27 at 23:15

1 Answer 1

3

Never use tabularx without an X column, you are just using c so it has no way to achieve the specified width (this will also fix your "also..." question as the point of tabularx is to adjust line breaking in X columns, but c columns do not allow line breaking so the table just gets wider as you add more text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.