2

I am writing in a tex file that uses IEEEtran class. It puts texts in two columns. I have a table that I want to place across two columns. The text inside several cells are quite large. I want the page to look like this: enter image description here

Please ignore the red lines under the text, as I prepared this example in MS word.

I know this problem seems common. I tried these solutions but no luck: Page-wide table in two-column mode, Creating a table in two column style page, How to put a full-width table at the top or bottom of the same two-column page as the reference text?

Here is the code I wrote:

\begin{table*}[t]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|l|l|l|}
\hline
Category           & Rules                                                                           & Examples                                                                     & Links                                       \\ \hline
\multirow{3}{*}{A} & A1A1A1A1A1A1 A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1A1A1      & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1  A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1 & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \hline
\multirow{4}{*}{B} & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \hline
\multirow{3}{*}{C} & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \cline{2-4} 
                   & A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  & ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 & \href\{something.com/1\}\{something.com/1\} \\ \hline
\end{tabular}
\end{table*}

I have not faced any compilation error. My table goes out of the page, like this: enter image description here

  • 1
    Welcome to TeX SX! Could you post a full compilable code of what you've tried? – Bernard Oct 5 '17 at 19:01
  • please show what you tried and what error you got. This seems to be a simple tabular in a table* environment (which will span the columns) – David Carlisle Oct 5 '17 at 19:02
  • Hi @Bernard! I have added my code to the question. – Dipto_Das Oct 5 '17 at 19:54
  • Hi @DavidCarlisle, I have done that and my problem is that my table goes out of the page. I think something like multicolumn might help but cannot figure out how to do that. – Dipto_Das Oct 5 '17 at 19:55
  • 2
    that is nothing to do with ieee or multicolumn or two column table* layouts, you have simply specified that ea.ch cell is on one line and as wide as its content. change those lll to p{3cm}p{3cm}p{3cm} or however wide you want the columns. – David Carlisle Oct 5 '17 at 20:45
3

To make the table fit inside the text block, I suggest you use a tabularx environment, with a (modified) X column type for the second and third columns and a (modified) p column type for the fourth column; that way, LaTeX will be able to insert line breaks, if need be, in these columns. (The \RaggedRight directives instruct LaTeX to typeset the material in ragged-right mode rather than in fully-justified mode, while still allowing hyphenation.)

enter image description here

\documentclass[]{IEEEtran}
\usepackage{tabularx,multirow,ragged2e}
\setlength\extrarowheight{2pt} % for a slightly more "open" look
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}

\usepackage[colorlinks,allcolors=blue]{hyperref}
\begin{document}

\begin{table*}[t]
%%\centering % redundant
\caption{My caption}
\label{my-label}
\begin{tabularx}{\textwidth}{|l|Y|Y|P{2cm}|} % <-- choose width of 'P' column suitably
\hline
Category & Rules & Examples & Links \\ 
\hline
\multirow{6}{*}{A} 
& A1A1A1A1A 1A1  A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1 
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1  A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1 
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\hline
\multirow{8}{*}{B} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\hline
\multirow{6}{*}{C} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\cline{2-4} 
& A1A1A1A1A 1A1,A1A1A1A1A1A1A1A 1A1A1A1A1 A1A1A1 A1A1 A1A1 A1A1 A1A1A1A1A1A1A1A1  
& ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 ea1 ea1 e1 
& \href{something.com/1}{something.com/1} \\ 
\hline
\end{tabularx}
\end{table*}
\end{document}

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.