图形和表格在小页面中错位,表格变得更大

图形和表格在小页面中错位,表格变得更大

当我将表格和图形放在两个独立的环境中时,它们可以很好地适合这样的一列。

在此处输入图片描述

但是,当我将它们作为一个浮点数放入小型页面时,图形和表格变得未对齐,并且表格大于\linewidth

在此处输入图片描述

我该如何解决这个问题?我想把它们放到一个浮点数中,并像这样加上两个单独的标题。

\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tabularray}
\usepackage{booktabs,capt-of}
\usepackage{lipsum}

\begin{document}

\lipsum[1]
%
 \begin{table}[!t]
    \centering
    \caption{a table}
    \label{tab:a table}
    \begin{tblr}{
            colspec={Q[2.35em,c] *7{Q[2.34em,c]}},
            vline{1} = {2-Z}{0.8pt},
            vline{2,Z} = {0.8pt},
            vline{3-Y} = {0.3pt},
            hline{1} = {2-Z}{0.8pt},
            hline{2,Z} = {0.8pt},
            hline{3-Y} = {0.3pt},
            row{1-8} = {mode=math},
            column{1-8} = {mode=math},
        }
        & V_1 &  V_2 & V_3 & V_4 & V_5  & V_6 & V_7\\
        V_1 &   & 1 & 0 & 0 & 1 & 0 & 1\\
        V_2 & 1 & 0 & 1 & 0 & 1 & 0 & 1\\
        V_3 & 0 & 1 & 0 & 1 & 0 & 0 & 1\\
        V_4 & 0 & 0 & 1 & 0 & 1 & 0 & 1\\
        V_5 & 1 & 1 & 0 & 1 & 0 & 0 & 1\\
    \end{tblr}
  \end{table}
  
 \begin{figure}
     \centering
    \includegraphics[width=\linewidth]{example-image-a}
     \caption{a figure}
     \label{fig:my_label}
 \end{figure}
\lipsum[1]
\lipsum[1]


  \begin{minipage}{\linewidth}
  \begin{minipage}[b]{\linewidth}
    \centering
    \includegraphics[width=\linewidth]{example-image-a}
    \label{fig:a figure}
    \captionof{figure}{a figure}
  \end{minipage}
  \hfill
  \begin{minipage}[b]{\linewidth}
      \captionof{table}{a table}
    \label{tab:a table}
    \begin{tblr}{
            colspec={Q[2.35em,c] *7{Q[2.34em,c]}},
            vline{1} = {2-Z}{0.8pt},
            vline{2,Z} = {0.8pt},
            vline{3-Y} = {0.3pt},
            hline{1} = {2-Z}{0.8pt},
            hline{2,Z} = {0.8pt},
            hline{3-Y} = {0.3pt},
            row{1-8} = {mode=math},
            column{1-8} = {mode=math},
        }
        & V_1 &  V_2 & V_3 & V_4 & V_5  & V_6 & V_7\\
        V_1 &   & 1 & 0 & 0 & 1 & 0 & 1\\
        V_2 & 1 & 0 & 1 & 0 & 1 & 0 & 1\\
        V_3 & 0 & 1 & 0 & 1 & 0 & 0 & 1\\
        V_4 & 0 & 0 & 1 & 0 & 1 & 0 & 1\\
        V_5 & 1 & 1 & 0 & 1 & 0 & 0 & 1\\
    \end{tblr}
    \end{minipage}
  \end{minipage}
\lipsum[1]
\end{document}                        

答案1

IEEE 使用 8pt 文本作为表格,并且有必要\noindent在第一个之前添加以抑制段落缩进minipage

\noindent\begin{minipage}{\linewidth}
        \begin{minipage}[b]{\linewidth}
            \centering
            \includegraphics[width=\linewidth]{example-image-a}
            \captionof{figure}{a figure}\label{fig:a figure}
        \end{minipage}
        \hfill
        \begin{minipage}[b]{\linewidth}     
            \captionof{table}{a table}\label{tab:a table}
            \footnotesize %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
            \begin{tblr}{
                    colspec={Q[2.35em,c] *7{Q[2.34em,c]}},
                    vline{1} = {2-Z}{0.8pt},
                    vline{2,Z} = {0.8pt},
                    vline{3-Y} = {0.3pt},
                    hline{1} = {2-Z}{0.8pt},
                    hline{2,Z} = {0.8pt},
                    hline{3-Y} = {0.3pt},
                    row{1-8} = {mode=math},
                    column{1-8} = {mode=math},
                }
                & V_1 &  V_2 & V_3 & V_4 & V_5  & V_6 & V_7\\
                V_1 &   & 1 & 0 & 0 & 1 & 0 & 1\\
                V_2 & 1 & 0 & 1 & 0 & 1 & 0 & 1\\
                V_3 & 0 & 1 & 0 & 1 & 0 & 0 & 1\\
                V_4 & 0 & 0 & 1 & 0 & 1 & 0 & 1\\
                V_5 & 1 & 1 & 0 & 1 & 0 & 0 & 1\\
            \end{tblr}
        \end{minipage}
    \vspace*{\baselineskip} %<<<<<<<<<<<<<<<
    \end{minipage}
\lipsum[1]

A

相关内容