Table in Latex Overlapping with Second Column of the Page

12,436

Solution 1

Generally, the starred version of floating environments are used to tell LaTeX to span two columns. So, something like:

\begin{table*}
% Table contents
\end{table*}

The same can be done with figures.

Solution 2

In place of tabular, use tabularx, for example:

\begin{tabularx}{\textwidth}{|c|c|c|c|c|X|}

Sorry, @Rafid, I normally use memoir, which includes it, so I forgot this bit:

\usepackage{tabularx}
Share:
12,436
Rafid
Author by

Rafid

Software developer with passion. Started learning programming at around 10 years of age. Currently working @ AWS in Vancouver, British Columbia. Aside from my main job, I am trying to spend most of my free days developing my knowledge with Machine Learning. When I have time to spare, I enjoy reading mathematics and physics. When I am bored, I go for a walk or ride my bicycle (when Vancouver weather permits!)

Updated on June 14, 2022

Comments

  • Rafid
    Rafid almost 2 years

    I got a problem with tables in LaTeX. I am using a pre-defined format from a conference, which makes a page consists of two columns. My table is too wide to be contained in one column, so it goes to the second column of the page and overlaps with text!

    1. Why is LaTeX allowing this?
    2. Is it possible in the current format, to make the table a block, so that it uses two columns, and the text in the other column dragged down a bit?
    3. Any other suggestion?

    This is my code:

    \begin{table}
    \centering
    \begin{tabular}{|c|c|c|c|c|c|}
    \hline
    Rule & Factor & Best Value & Delta_t & Delta_{do} & Comments \\
    \hline
    \multirow{3}{c}{Diagonal Dominance} & Line Angle & 45 & 15 & 30 & The angle between the prominent line of the object and
    the diagonal lines \\ % TODO: What object? Make sure it is clear.
                                        & Line Distance & 0 & 0.25 & 1 & The distance, in screen coordinates, from the
    prominent line of the object to the diagonal lines. \\ % TODO: Need to define screen coordinates
                                        & Corner Distances & 0 & 0.1 & 0.7 & The distance, in screen coordinates, from the
    end of the prominent line of the object to the corners of the screen. \\
    \hline
    \end{tabular}
    \caption{The factors of each rule and their parameters.}
    \label{table:factors}
    \end{table}
    

    Thank you in advance for your help.

    Regards,
    Rafid

  • Rafid
    Rafid over 13 years
    Thanks, it helps. But still, the width of the table is wider than the page, how can I limit the width?
  • Shariful
    Shariful over 13 years
    It depends on how you are creating your table. You should add a small bit of LaTeX to your question so we can see what your doing.
  • Charles Stewart
    Charles Stewart over 13 years
    @Rafid: You can make the last column into a par column, say changing the arg to tabulate to {|c|c|c|c|c|p{1in}|} (vary the dimension to suit).
  • Rafid
    Rafid over 13 years
    Sorry for being late, got other tasks to work on. Sorry, I am new to LaTeX, what does paragraph column mean? I tried it and it doesn't seem to be working too.
  • Rafid
    Rafid over 13 years
    This doesn't seem to work. It seems that should be some package to be included to get tabularx to work. Any idea?