7

Why does the words in the top table are bigger than ones in the bottom table?
How can I make it the same size with the bottom ones (make it smaller)? enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}

\begin{document}

\blindtext

\begin{figure}

\begin{minipage}[b]{0.5\linewidth}
\centering
\rule{30pt}{40pt}

  \caption{A figure}

  \vspace{0pt}
\end{minipage}%
\begin{minipage}[b]{0.5\columnwidth}
\centering
  \captionof{table}{A table}

          \begin{tabular}{c*{4}{p{0.125\linewidth}}}
           \toprule
          &\multicolumn{3}{c}{NUMBER} \\
             \cmidrule(lrr){2-4}
            NO  & \textbf{1} & \textbf{2} & \textbf{3}                 \\\midrule
            H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG   \\\midrule
            K &  K\textsubscript{NOT} & K\textsubscript{NI} & NDG   \\\midrule
            C & NDG & K\textsubscript{NI} &  K\textsubscript{NOT}      \\\midrule
            D & NDG &  K\textsubscript{NOT} & K\textsubscript{NI}       \\\midrule
            L &  K\textsubscript{NOT} & NDG & K\textsubscript{NI}       \\\midrule
            M & K\textsubscript{NI}  &  NDG &  K\textsubscript{NOT}        \\\bottomrule
          \end{tabular}

  \vspace{0pt}
\end{minipage}

\end{figure}
  \begin{table}[!t]
  \centering
  \caption{ANOTHER TABLE}
  \label{tab:table7}
  \begin{tabular}{ c c c }
                            \toprule
    A & B& C\\ \midrule
    1000 &  K\textsubscript{NOT} & NDG         \\ \bottomrule
  \end{tabular}
\end{table}

\end{document}

2 Answers 2

7

For reasons best known to the designers of the IEEEtran document class, the contents of table environments are automatically rendered at \footnotesize -- for a 20% linear reduction in font size -- whereas the contents of figure environments are not subjected to this treatment.

To wit, the first table in the following screenshot is embedded in a figure environment, while the second is embedded in a table environment. Do note that the contents of the two tabular environments are identical.

enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{booktabs,capt-of}

\begin{document}

\hrule % just to illustrate width of column
\begin{figure}[ht]
\centering
\captionof{table}{A table in a figure environment}
\begin{tabular}{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(l){2-4}
NO  & \textbf{1} & \textbf{2} & \textbf{3}            \\ \midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG  \\ \midrule
K &  K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\ \midrule
M & K\textsubscript{NI}  &  NDG &  K\textsubscript{NOT} \\ \bottomrule
\end{tabular}
\end{figure}

% same 'tabular' environment, but not embedded in a 'table' env.
\begin{table}[ht]
\centering
\caption{A table in a table environment}
\begin{tabular}{cccc}
\toprule
&\multicolumn{3}{c}{NUMBER} \\
\cmidrule(l){2-4}
NO  & \textbf{1} & \textbf{2} & \textbf{3}            \\ \midrule
H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG  \\ \midrule
K &  K\textsubscript{NOT} & K\textsubscript{NI} & NDG \\ \midrule
M & K\textsubscript{NI}  &  NDG &  K\textsubscript{NOT} \\ \bottomrule
\end{tabular}
\end{table}
\hrule % just to illustrate width of column
\end{document}
11
  • 1
    I just started with LaTeX probably one week ago so I don't know much. I just wanted to add the figure and table side by side so I got many helps to get that done above. Is there any way to fix this without "violating the journal's input requirements"?
    – hana
    Jun 8, 2022 at 19:36
  • 1
    @hana - The "fix", then, would consist of embedding the minipage environments that contain the graphic and the associated tabular environment in a table environment, not a figure environment...
    – Mico
    Jun 8, 2022 at 19:41
  • 1
    thanks, that works.
    – hana
    Jun 8, 2022 at 19:48
  • 1
    @Mico - So it does. Never mind. OTOH, I don't think IEEE will like the idea of putting a table and figure side-by-side in one column. Jun 8, 2022 at 22:37
  • 1
    You are already using \footnotesize. The next smaller size is \scriptsize (as in subscripts). You can use [c] instead of [b] with minipages to align middles. Jun 9, 2022 at 14:54
1

This is my idea of what might be acceptable to IEEE. First, I made the image as large as possible (minus a \tabcolsep gap). I placed the table caption alone above the tabular. I placed the figure and tabular side-by-side.Then I placed the figure caption alone below the image.

I show how to handle the case when the image is width limited or height limited.

demo

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}

\begin{document}

\blindtext

\begin{table}[ht]
% first measure the width of the tabular
\sbox0{\begin{tabular}[b]{cccc}
           \toprule
          &\multicolumn{3}{c}{NUMBER} \\
             \cmidrule(lrr){2-4}
            NO  & \textbf{1} & \textbf{2} & \textbf{3}                 \\\midrule
            H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG   \\\midrule
            K &  K\textsubscript{NOT} & K\textsubscript{NI} & NDG   \\\midrule
            C & NDG & K\textsubscript{NI} &  K\textsubscript{NOT}      \\\midrule
            D & NDG &  K\textsubscript{NOT} & K\textsubscript{NI}       \\\midrule
            L &  K\textsubscript{NOT} & NDG & K\textsubscript{NI}       \\\midrule
            M & K\textsubscript{NI}  &  NDG &  K\textsubscript{NOT}        \\\bottomrule
          \end{tabular}}%
% place image and table with caption side-by-side
\includegraphics[width={\dimexpr \columnwidth-\wd0-\tabcolsep}]{example-image}\hfill
\begin{minipage}[b]{\wd0}
  \caption{A table}
  \usebox0
\end{minipage}\par
% place figure caption alone on the bottom
\begin{minipage}{\dimexpr \columnwidth-\wd0-\tabcolsep}
  \captionof{figure}{A figure}
\end{minipage}
\end{table}

\begin{table}[ht]
% first measure the height of the tabular
\sbox0{\begin{tabular}[t]{cccc}
           \toprule
          &\multicolumn{3}{c}{NUMBER} \\
             \cmidrule(lrr){2-4}
            NO  & \textbf{1} & \textbf{2} & \textbf{3}                 \\\midrule
            H & K\textsubscript{NI} & K\textsubscript{NOT} & NDG   \\\midrule
            K &  K\textsubscript{NOT} & K\textsubscript{NI} & NDG   \\\midrule
            C & NDG & K\textsubscript{NI} &  K\textsubscript{NOT}      \\\midrule
            D & NDG &  K\textsubscript{NOT} & K\textsubscript{NI}       \\\midrule
            L &  K\textsubscript{NOT} & NDG & K\textsubscript{NI}       \\\midrule
            M & K\textsubscript{NI}  &  NDG &  K\textsubscript{NOT}        \\\bottomrule
          \end{tabular}}%
% place table caption alone on top
\null\hfill
\begin{minipage}{0.5\columnwidth}
  \caption{A table}
  \hrule height0pt% to keep \belowcaptionskip from being eaten
\end{minipage}\par
% place image (with caption) and tabular side-by-side
\begin{minipage}[t]{0.5\columnwidth}
  \centering
  \raisebox{-\height}{\includegraphics[height={\dimexpr \ht0+\dp0}]{example-image-10x16}}
  \captionof{figure}{A figure}
\end{minipage}%
\begin{minipage}[t]{0.5\columnwidth}
  \centering
  \usebox0
\end{minipage}
\end{table}

\end{document}
11
  • This is nice too. I tried something similar but couldn't do aligment. I tried you code but got these errors Undefined control sequence. Missing number, treated as zero. Illegal unit of measure (pt inserted).
    – hana
    Jun 9, 2022 at 15:53
  • I've been tweaking the code all along, so have no idea which version gave the error. Jun 9, 2022 at 16:26
  • This version works but how can I insert my pdf image? I replaced example-image with myimage.pdf in \includegraphics[width={\dimexpr \columnwidth-\wd0-\tabcolsep}]{example-image}\hfill but I got error.
    – hana
    Jun 10, 2022 at 3:47
  • 1
    I used \tabcolsep for the gap (used in the [width=...] calculation. Simply replace it with a larger distance. \columnsep would be my second choice. Jun 13, 2022 at 13:19
  • 1
    Don't change \tabcolsep; it is used by tabular. Replace it, as in [width={\dimexpr \columnwidth-\wd0-20pt}]. Jun 13, 2022 at 19:03

You must log in to answer this question.

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