1

I'm trying to draw 5 subtables (3 for each text width) for my IEEE format paper (double-columned). However, I googled how to draw it, tried some code for last one hour, but unable to draw it successfully.

My subtable code:

\documentclass{ieeeaccess}
\usepackage{supertabular}
\usepackage{caption, subcaption}

\begin{table*}[h]
    \begin{subtable}[h]{0.33\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & Max Temp & Min Temp \\
        \hline \hline
        Mon & 20 & 13\\
        Tue & 22 & 14\\
        Wed & 23 & 12\\
        Thurs & 25 & 13\\
        Fri & 18 & 7\\
        Sat & 15 & 13\\
        Sun & 20 & 13
       \end{tabular}
       \caption{First Week}
       \label{tab:week1}
    \end{subtable}
    \hfill
    \begin{subtable}[h]{0.33\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & Max Temp & Min Temp \\
        \hline \hline
        Mon & 17 & 11\\
        Tue & 16 & 10\\
        Wed & 14 & 8\\
        Thurs & 12 & 5\\
        Fri & 15 & 7\\
        Sat & 16 & 12\\
        Sun & 15 & 9
        \end{tabular}
        \caption{Second Week}
        \label{tab:week2}
    \end{subtable}
    \begin{subtable}[h]{0.33\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & Max Temp & Min Temp \\
        \hline \hline
        Mon & 20 & 13\\
        Tue & 22 & 14\\
        Wed & 23 & 12\\
        Thurs & 25 & 13\\
        Fri & 18 & 7\\
        Sat & 15 & 13\\
        Sun & 20 & 13
       \end{tabular}
       \caption{First Week}
       \label{tab:week1}
    \end{subtable}
     \caption{Max and min temps recorded in the first two weeks of July}
     \label{tab:temps}
\end{table*}
EOD

\end{document}

However, my output for these three tables look like the below picture. output image

6
  • Welcome to TeX.SX!. Please make your code compilable by adding the documentclass you use as well as the relevant packages (See also: minimal working example (MWE)) Do you get any error messages when you compile your code? If so, please tell us which. – leandriis Sep 17 '20 at 17:27
  • Welcome to TeX.SE! Please extent your code fragment to complete small document, which will contain your five sub-tables. – Zarko Sep 17 '20 at 17:27
  • Are the three tables you show the real table you want to include in your document or are they just placeholders and your actual tables will contain a different content? If thouse are your real tables, you could probably even combine all information into a single table. With this approach you could avoid repeating the first column over and over. – leandriis Sep 17 '20 at 17:29
  • @leandriis: My actual table will contain different content. This is an example of what I want to do. – Imran Zakhayev Sep 17 '20 at 17:32
  • In your code \begin{document} is missing. If I compile your code as is, I get, as expected, a bunch of error messages and the same "output" as you. If I add the missing line, the code compiles fine and yields the expected output. To conclude: Please never ever ignore error messages! Even if you get something that on first glance resembles a pdf file, there can still be issues with it. After an error, TeX only tries to recover enough to syntax check more of the file, it does not try to make sensible output. Thus, try to fix error messages before even taking a look as the pdf file. – leandriis Sep 17 '20 at 17:37
1

You have a mess in positioning options os subtables. Try the following:

\documentclass{ieeeaccess}
\usepackage{graphicx} % <--- had to be in preamble
\usepackage{subcaption}
\usepackage{makecell}

\begin{table*}
\centering
    \begin{subtable}[t]{0.3\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & \makecell{Max\\ Temp} & \makecell{Min\\ Temp} \\
        \hline \hline
        Mon & 20 & 13\\
        Tue & 22 & 14\\
        Wed & 23 & 12\\
        Thurs & 25 & 13\\
        Fri & 18 & 7\\
        Sat & 15 & 13\\
        Sun & 20 & 13
       \end{tabular}
       \caption{First Week}
       \label{tab:week1}
    \end{subtable}
    \hfil
    \begin{subtable}[t]{0.3\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & \makecell{Max\\ Temp} & \makecell{Min\\ Temp} \\
        \hline \hline
        Mon & 17 & 11\\
        Tue & 16 & 10\\
        Wed & 14 & 8\\
        Thurs & 12 & 5\\
        Fri & 15 & 7\\
        Sat & 16 & 12\\
        Sun & 15 & 9
        \end{tabular}
        \caption{Second Week}
        \label{tab:week2}
    \end{subtable}
    \hfil
    \begin{subtable}[t]{0.3\textwidth}
        \centering
        \begin{tabular}{l | l | l}
        Day & \makecell{Max\\ Temp} & \makecell{Min\\ Temp} \\
        \hline \hline
        Mon & 20 & 13\\
        Tue & 22 & 14\\
        Wed & 23 & 12\\
        Thurs & 25 & 13\\
        Fri & 18 & 7\\
        Sat & 15 & 13\\
        Sun & 20 & 13
       \end{tabular}
       \caption{First Week}
       \label{tab:week1}
    \end{subtable}
    \caption{Max and min temps recorded in the first two weeks of July}
     \label{tab:temps}
\end{table*}
\lipsum\lipsum
\EOD   % <---
\end{document} 

enter image description here

2
  • did you run the code with ieeeaccess document class? because it is working with normal document class, but for ieeeaccess, it doesn't work. – Imran Zakhayev Sep 17 '20 at 17:47
  • @ImranZakhayev, yes, I did using Overleaf service (since I haven't installed ieeeaccess document class. Now I extend table code fragment to complete document. In it are added stuff which enable compiling it (marked by % <--- – Zarko Sep 17 '20 at 21:29

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.