0

I have a long table which extends over two pages in the appendix below .
The table is not placed on the top of these pages.
Is it normal to leave it like this?
How can I put it on the top of a page? Please suggest if you see something wrong about this.

enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{lipsum}                      
\usepackage{newtxtext, newtxmath}
\usepackage[export]{adjustbox}  
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{caption}

\begin{document} \lipsum \appendix \begin{table}[b] \caption{Table with images} \label{tab:image} \adjustboxset{width=\linewidth, valign=M} \begin{tblr}{hlines, vlines, colsep=3pt, colspec= {c {3}{X[c,m]} }, row{1} = {font=\bfseries}, rowsep = 3pt, } No & C1 & C3 & C4 \ 1 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 2 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 3 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 4 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ \end{tblr} \end{table} \begin{table}[t] \ContinuedFloat \caption{Table with images} \label{tab:image} \adjustboxset{width=\linewidth, valign=M} \begin{tblr}{hlines, vlines, colsep=3pt, colspec= {c {3}{X[c,m]} }, row{1} = {font=\bfseries}, rowsep = 3pt, } No & C1 & C3 & C4 \ 5 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 6 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 7 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 8 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ \end{tblr} \end{table}

\end{document}

emnha
  • 445
  • 3
  • 11
  • Shouldn't those two tables be one? You could try to use longtblr which would span one big table over two+ pages. You would get top aligned (sub)tables on the first and subsequent pages. – Celdor Sep 06 '22 at 08:59
  • 1
    Actually, the design of the IEEEtran class is to vertically center the floats on their pages. – Pieter van Oostrum Sep 06 '22 at 09:30

1 Answers1

1

This answer is actually an extension of my comment, in which I merged two tables in one

Page 1 Page 2 Page 3
enter image description here enter image description here enter image description here
\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{newtxtext, newtxmath}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
    \UseTblrLibrary{booktabs}

\DefTblrTemplate{caption-text}{default}{\scshape \InsertTblrText{caption}} \DefTblrTemplate{contfoot-text}{default}{\scshape Continued on next page} \DefTblrTemplate{caption}{default}{ \centering \UseTblrTemplate{caption-tag}{default}\par \UseTblrTemplate{caption-text}{default}\par } \DefTblrTemplate{capcont}{default}{ \centering \UseTblrTemplate{caption-tag}{default}\par \UseTblrTemplate{caption-text}{default} \UseTblrTemplate{conthead-text}{default}\par } \DefTblrTemplate{conthead-text}{default}{({\scshape Continued})}

\begin{document} \lipsum

\begin{table} \centering \caption{Example}\label{tab:example} \begin{tabular}{ccc} \hline Column 1 & Column 2 & Column 3 \ \hline X & Y & Z \ X & Y & Z \ X & Y & Z \ \hline \end{tabular} \end{table}

\appendix \adjustboxset{width=\linewidth, valign=M}

\onecolumn \begin{longtblr}[ caption = {Table with images}, label = {tab:image}, ]{ hlines, vlines, colsep=3pt, colspec= {c *{3}{X[c,m]} }, row{1} = {font=\bfseries}, rowsep = 3pt, rowhead = 1, }

No & C1 & C3 & C4 \ 1 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 2 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 3 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 4 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 5 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 6 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 7 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 8 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ \end{longtblr}

\end{document}


Update.
In case a long table is not an option, here's another solution with a regular table

\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{newtxtext, newtxmath}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{caption}

\begin{document} \lipsum \appendix \begin{table} \begin{minipage}[t][\textheight]{\linewidth} \ContinuedFloat \caption{Table with images} \label{tab:image} \adjustboxset{width=\linewidth, valign=M} \begin{tblr}{hlines, vlines, colsep=3pt, colspec= {c {3}{X[c,m]} }, row{1} = {font=\bfseries}, rowsep = 3pt, } No & C1 & C3 & C4 \ 5 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 6 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 7 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ 8 & \adjincludegraphics{example-image-a} & \adjincludegraphics{example-image-b} & \adjincludegraphics{example-image-c} \ \end{tblr} \end{minipage} \end{table*}

\end{document}

Celdor
  • 9,058
  • Nice, I added \twocolumn at the end of the table to move it back to two columns for reference. Just one question, how can I use default table style of IEEEtran like TABLE X TABLE WITH IMAGES? – emnha Sep 06 '22 at 10:11
  • @emnha The tag (or lable) is already in uppercase format (TABLE). As to the caption text, if you add the following to a preamble, all caption texts will be in uppercase font, including longtblr: \DefTblrTemplate{caption-text}{default}{\MakeUppercase{\InsertTblrText{caption}}} \DeclareCaptionFormat{upper}{#1#2\MakeUppercase{#3}\par} \captionsetup[table]{skip=3pt, position=top, format=upper} – Celdor Sep 06 '22 at 11:28
  • @emnha ... and the following changes a comment added to headings on subsequent pages in longtblr: \DefTblrTemplate{conthead-text}{default}{(CONTINUED)}. – Celdor Sep 06 '22 at 11:34
  • Should I put in in any enviroment? I got the error below. Also the IEEEtran caption has TABLE in one line and the caption is in upper font in another line without the colon. Is there a fix for this? "You can't usemacro parameter character # in horizontal mode. LaTeX Error: Missing \begin{document}. LaTeX Error: Missing \begin{document}. You can't use macro parameter character #' in horizontal mode. unclosed group {" – emnha Sep 06 '22 at 11:46
  • This is an example of the IEEEtran caption. https://tex.stackexchange.com/questions/475282/how-to-set-this-table-in-ieee-paper – emnha Sep 06 '22 at 11:50
  • I just made a picture to show the problem below. https://ibb.co/L9dyWMv – emnha Sep 06 '22 at 12:26
  • @emnha I updated the answer. I did not realise caption would completely re-format a caption style to its own default. I think now everything should fit the IEEtran style. – Celdor Sep 06 '22 at 12:55
  • Looks great, thanks. I'll check it when I got home. – emnha Sep 06 '22 at 12:58