1

i have a longtable at the end of my paper. the code is as follows

\documentclass[journal]{IEEEtran}
\usepackage{longtable}
\usepackage{lipsum}
%\usepackage{capt-of}

\makeatletter
\def\LT@makecaption#1#2#3{%
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
\footnotesize\bgroup\par\centering\@IEEEtabletopskipstrut{\normalfont\footnotesize #2}\\{\normalfont\footnotesize\scshape #3}\par\addvspace{0.5\baselineskip}\egroup\endgraf%
\@IEEEtablecaptionsepspace}%
\hss}}}
\makeatother

\begin{document}
\lipsum[4-9]
\begin{table}[]
\centering
\caption{State Table for My Machine\label{design1}}
\begin{tabular}{cccc}
\hline
a&b&c&d\\
\hline
1&2&3&4\\
\hline
\end{tabular} 
\end{table}
\onecolumn
\begin{longtable}{lccccccccccccccr}
\caption{State Table for My Machine}\label{design2}\\
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endfirsthead
\multicolumn{16}{l}{Table \ref{design} continued from previous page...}\\
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endhead
\hline
\endfoot
x               & xxxx            & x & x & x   & xx  & 0  & 0  & 0 & 0 & 0 & 0 & 0   & 0   & 0    & OOO         \\ \hline
OOO             & 0000            & 0 & 0 & x   & x0  & 1  & 1  & 1 & 1 &   &   & 0   & 0   & 0    & PO          \\
                & 0000            & 0 & 0 & x   & x1  &    &    &   &   & 1 & 1 & 0   & 0   & 0    & OOP         \\
                & 0000            & 0 & 1 & x   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 0 & 1 & x   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 0 & 1 & x   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
                & 0000            & 1 & 0 & x   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 0 & x   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 0 & x   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 0   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 1 & 0   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 1 & 0   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 1   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 1 & 1 & 1   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 1 & 1 & 1   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\ 
\end{longtable}
\twocolumn
\lipsum[5]
\end{document}

the longtable starts on a new page. i want it to start right under the two column text on the last page. how can this be done?

4
  • 1
    new page is starts because you change page format from two column to one (with \onecolumn. this command always start new page. this have nothing with long table.
    – Zarko
    Jan 12, 2018 at 7:21
  • how do you stop onecolumn from inserting a page break Jan 12, 2018 at 11:30
  • you can't (as far as i know). try manually split your long table to two tables and put them to float table*, first at bottom of page, second on the top of the next page. for this you will need to load package stfloats.
    – Zarko
    Jan 12, 2018 at 11:43
  • thanks for giving me a good enough idea, if not a solution. :) Jan 15, 2018 at 8:33

1 Answer 1

1

see, if the following solution can help you:

\documentclass[journal]{IEEEtran}
\usepackage{stfloats}
\usepackage{caption}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{table}[h]
\centering
\caption{State Table for My Machine\label{design1}}
\begin{tabular}{cccc}
\hline
a&b&c&d\\
\hline
1&2&3&4\\
\hline
\end{tabular}
\end{table}
\lipsum[2]

    \begin{table*}[b]
\caption{State Table for My Machine}
    \label{tab:design2_part-1}
    \centering
\begin{tabular}{lccccccccccccccr}
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
x               & xxxx            & x & x & x   & xx  & 0  & 0  & 0 & 0 & 0 & 0 & 0   & 0   & 0    & OOO         \\ \hline
OOO             & 0000            & 0 & 0 & x   & x0  & 1  & 1  & 1 & 1 &   &   & 0   & 0   & 0    & PO          \\
                & 0000            & 0 & 0 & x   & x1  &    &    &   &   & 1 & 1 & 0   & 0   & 0    & OOP         \\
                & 0000            & 0 & 1 & x   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 0 & 1 & x   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 0 & 1 & x   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
                & 0000            & 1 & 0 & x   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 0 & x   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 0 & x   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 0   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 1 & 0   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 1 & 0   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 1   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 1 & 1 & 1   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 1 & 1 & 1   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
    \hline
\multicolumn{16}{r}{\footnotesize\itshape (cont. on the next page}
    \end{tabular}
\end{table*}
    \begin{table*}[t]
    \ContinuedFloat
\caption{State Table for My Machine (cont. from previous page)}
    \label{tab:design2_part-2}
    \centering
\begin{tabular}{lccccccccccccccr}
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
x               & xxxx            & x & x & x   & xx  & 0  & 0  & 0 & 0 & 0 & 0 & 0   & 0   & 0    & OOO         \\ \hline
OOO             & 0000            & 0 & 0 & x   & x0  & 1  & 1  & 1 & 1 &   &   & 0   & 0   & 0    & PO          \\
                & 0000            & 0 & 0 & x   & x1  &    &    &   &   & 1 & 1 & 0   & 0   & 0    & OOP         \\
                & 0000            & 0 & 1 & x   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 0 & 1 & x   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 0 & 1 & x   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
                & 0000            & 1 & 0 & x   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 0 & x   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 0 & x   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 0   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 1 & 0   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 1 & 0   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 1   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 1 & 1 & 1   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 1 & 1 & 1   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
    \hline
    \end{tabular}
\end{table*}

\lipsum[4-9]
\end{document}

it require manual splitting of your table into two parts.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .