为什么 \floatsetup[table]{capposition=top} 在这里不起作用?

为什么 \floatsetup[table]{capposition=top} 在这里不起作用?

为什么\floatsetup[table]{capposition=top}在这里不起作用?

\documentclass[journal]{IEEEtran}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}

% Table float box with bottom caption, box width adjusted to content
\newfloatcommand{capbtabbox}{table}[][\FBwidth]
\usepackage{blindtext}
\usepackage{booktabs}


\begin{document}

\blindtext
\begin{figure}
\begin{floatrow}
\ffigbox{%
\rule{30pt}{40pt}
}{%
  \caption{A figure}%
}
\capbtabbox{%
  \centering
  \begin{tabular}{ c c c }
                            \toprule
    A & B & C \\ \midrule
    1000 & 100 & 900          \\ \bottomrule
  \end{tabular}
}{%
  \caption{A table}%
}
\end{floatrow}
\end{figure}

\end{document}

答案1

无需使用floatrow那些复杂的设置。

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


\begin{document}

\blindtext

\begin{figure}

\begin{minipage}[b]{0.5\columnwidth}
\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 c c }
  \toprule
  A & B & C \\
  \midrule
  1000 & 100 & 900 \\
  \bottomrule
  \end{tabular}

  \vspace{0pt}
\end{minipage}

\end{figure}

\end{document}

诀窍是\vspace{0pt}在底部添加,这样这将成为底部对齐的小页面的参考点。

在此处输入图片描述

答案2

如果你使用正确的命令它就会起作用,即\ttabbox

    \documentclass[journal]{IEEEtran}
    \usepackage{floatrow}
    \floatsetup[table]{capposition=top}

    % Table float box with bottom caption, box width adjusted to content
    \newfloatcommand{capbtabbox}{table}[][\FBwidth]
    \usepackage{blindtext}
    \usepackage{booktabs}
    \usepackage{graphicx}

    \begin{document}

    \blindtext
    \begin{figure}
    \begin{floatrow}
    \CenterFloatBoxes
    \ffigbox[\FBwidth]{%
    \includegraphics[scale=0.5]{PepeLePew}
    }{%
      \caption{Pepe le Pew}%
    }
    \ttabbox{%
      \centering
      \begin{tabular}{ c c c }
                                \toprule
        A & B & C \\ \midrule
        1000 & 100 & 900 \\ \bottomrule
      \end{tabular}
    }{%
      \caption{A table}%
    }
    \end{floatrow}
    \end{figure}

    \end{document}

在此处输入图片描述

相关内容