简体   繁体   中英

Latex table formatting: rotate, fit in page, caption

I am trying to format a table in latex. I am facing following problems:

  • There are space on the left side of the table, but my table is not using that space rather it floated to right side and moving out of the page.
  • To rotate I used \\rotatebox , after using this I can not use caption for the table. I get error if I use caption.
  • If my text in a cell is bigger then it goes out of the cell. I can not keep it in a fixed width.
  • There are no borders in last two cells.

How can I fix all these things? I have been looking around but if I make something work then others don't work. Could not manage a perfect solution for this. Please give me a workable solution for this.

Below is my sample code

    \begin{table*}
                \centering
                \rotatebox{90}{
                %\caption{This is a test caption}    
                \label{tab:the_table}    
                \begin{tabular*}{\textwidth}{|c|c|c|c|c|c|c|c|c|c|}
                    \hline
                    Column1 &Column2 &Column13 Design &Column4 &Column5 &Column6 &Column7 &another test Column &Last test column  \\\hline
            First Content &more test content &more test content &more test content &more test content &more test content &more test content &more test content &more test content  \\\hline  
         \end{tabular*}
                }
            \end{table*}

I assume this question is related to your other one where you have used the IEEEtran document class.

Q1: There are space on the left side of the table, but my table is not using that space rather it floated to right side and moving out of the page.

The \\centering only works, if there is enough space within the line. This is only an issue, if the table is not rotated. With rotation, the examples works fine (see below). However, the publisher does not allow to place text within the page margins.

Q2: To rotate I used \\rotatebox, after using this I can not use caption for the table. I get error if I use caption.

I have answered this here , for you other question.

Q3: If my text in a cell is bigger then it goes out of the cell. I can not keep it in a fixed width.

Q4: There are no borders in last two cells.

This can be fixed, if you use the environment tabular instead of tabular* . Please note, that tabular does not a take width parameter. The tabular width is calculated from the content only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM