1

I'm trying to place a rotated long table in IEEEtran. In order to add long table, I added the \onecolumn before the table and \twocolumn after that. The table appeared on the right place but the text is cut off. The result is like this: enter image description here

How could I make the text appears like no tables were added, which means the text keeps showing on the right column.

here is the code:

\documentclass[conference]{IEEEtran}
\usepackage{geometry}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\section{text before table}
text here should be able to display on one page instead of cut off by      the table.
\onecolumn
\begin{landscape}
  \begin{longtable}{p{3cm} p{2cm} p{4cm} p{4cm} p{3cm} p{3cm}}
  \hline
  col1 & col2 & col3 & col4 & col5 & col6 \\
  \hline
  \endhead
  \hline \multicolumn{6}{r}{{Continued on next page}} \\
  \endfoot
  \hline\hline
  \endlastfoot
  col1& col2& col3& col4 & col5& col6 \\
   \caption{a long table}
  \label{table:a long table}
\end{longtable}
\end{landscape}
\twocolumn
\section{text after table}
these text after the table
\end{document}
  • Welcome! Please provide a complete but minimal document which can be copy-paste-compiled to reproduce the problem (Minimal Working Example). A longtable can't float, though. If the table does not exceed one page (i.e. no page breaks), you can use a float. But then you don't need longtable. – cfr Jun 27 '16 at 3:09
  • 1
    \onecolumn and \twocolumn always start a new page. There are ways of avoiding this, but you almost certainly ought not use them with this class. And it wouldn't solve your problem anyway. Probably you need to use \begin{table*}\begin{tabular}...\end{tabular}\end{table*} but without code, hard to say. – cfr Jun 27 '16 at 3:11
  • I'm sorry for forgetting the code, I've edited the question, the text part is omitted. I'm wondering if the long table was not designed for the multi-column documents? The table I'm trying to present is very long and can't be contained in one page. What should I do to make the table to span pages and rotated at the same time without cutting off the text? – frank-weapon Jun 27 '16 at 7:58
1

First, your table is too wide to fit in the space desired. However I was able to split it across two columns. The idea was to create the longtable in a separate file then copy the pages one at a time.

The first step is to determine the available space, and the minimum space needed for the tabular. In this case it was relatively easy to calculate. Alternatively one could put the entire tabular (not longtable) into a savebox and measure the width.

Next we use geometry to create a page the exact size needed. I made a few changes regarding the header and caption. It just looked odd the way it was. Also, this caption will NOT show up in the table of contents, and you might need to use \setcounter{table}{4} (for example) to get the number right.

\documentclass{article}
\usepackage[paperwidth=624.60233pt,paperheight=252pt,margin=0pt]{geometry}
\usepackage{longtable}
\renewcommand{\thetable}{\Roman{table}}% IEEE standard (except comsoc)
\begin{document}
\begin{longtable}{p{3cm} p{2cm} p{4cm} p{4cm} p{3cm} p{3cm}}
  \caption{a long table}\label{table:a long table}\\
  \hline
  col1 & col2 & col3 & col4 & col5 & col6 \\
  \hline
  \endhead
  \hline \multicolumn{6}{r}{{Continued on next page}} \\
  \endfoot
  \hline\hline
  \endlastfoot
  1\\2\\3\\4\\5\\6\\7\\8\\9\\10\\11\\12\\13\\14\\15\\16\\17\\18\\19\\20\\
  \hline
\end{longtable}
\end{document}

The output was stored as test7.pdf.

Then we use \includegraphics to actually display the pages. It probably would have been easier to add the caption at this point, but trying to get it sideways would be nearly impossible.

Note: the aforementioned size calculations have been commented out.

\documentclass[conference]{IEEEtran}
\usepackage{graphicx}
\begin{document}
\section{text before table}
text here should be able to display on one page instead of cut off by the table.
%(\the\columnwidth) (\the\textheight) (\the\dimexpr 14\tabcolsep+3cm+2cm+4cm+4cm+3cm+3cm\relax)

\begin{table}[ht]
\includegraphics[angle=90,page=1]{test7}
\refstepcounter{table}\label{table:a long table}
\addcontentsline{lot}{table}{\protect\numberline{\thetable}{a long table}}%
\end{table}
\begin{table}[ht]
\includegraphics[angle=90,page=2]{test7}
\end{table}

\section{text after table}
these text after the table
\end{document}

full page

  • wonderful! thanks for your solution. There are more element involved in your solution, I think i might need more knowledge about tex to fully understand your answer. Thanks for your help. – frank-weapon Jul 1 '16 at 13:38

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.