我需要在我的两列 IEEE 文档中对齐一个图形和一个表格。我刚刚开始处理这种情况MWE
,如下所示:
\documentclass[conference]{IEEEtran}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage{algorithm}
\usepackage{algorithmicx,algpseudocode}
\begin{document}
\title{xxx}
\maketitle
\begin{figure*}
\CenterFloatBoxes
\begin{floatrow}
\ffigbox
{\includegraphics{rec.pdf}}
{\caption{A caption for a figure in a figure and a table side by side}\label{fig:test}}
\killfloatstyle
\ttabbox
{\begin{tabular}{|c||l|}
\hline
Event & Description\\
\hline
11 & \textbf{M1} generates a workpiece.\\
20 & \textbf{M2} takes a workpiece.\\
12~/~22 & Breakdown is occurred in \textbf{M1}~/~\textbf{M2}.\\
13~/~23 & \textbf{M1}~/~\textbf{M2} is repaired.\\
30~/~32 & \textbf{M1} increases \textbf{BUF1}~/~\textbf{BUF2}.\\
31~/~33 & \textbf{M2} decreases \textbf{BUF1}~/~\textbf{BUF2}.\\
\hline
91 & The reconfiguration $C^{1}_{\bm{G}} \rightarrow C^{2}_{\bm{G}}$ is requested.\\
93 & The reconfiguration $C^{2}_{\bm{G}} \rightarrow C^{1}_{\bm{G}}$ is requested.\\
\hline
\end{tabular}
}
{\caption{A caption for a table in a figure and a table side by side}\label{tab:test}}
\end{floatrow}
\end{figure*}
\end{document}
然后,我在我的主文档中尝试了该代码,该文档在序言中包含了许多其他包,例如:
\usepackage{dblfloatfix} % To enable figures at the bottom of page
\usepackage{cite}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{scrextend} % For referencing a footnote more than once
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{floatrow} % For two minipage alignment
\usepackage{algorithm}
\usepackage{algorithmicx,algpseudocode}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage{cite}
\usepackage[normalem]{ulem}
\usetikzlibrary{automata,positioning}
我将figure*
环境放在致谢部分之后,因此图表和表格的组合应该放在最后一页的顶部(我甚至在文档的不同位置测试了代码片段)。但是当我编译文档时,出现了以下错误:
扫描 \@@@floatbox 的使用情况时文件结束。
如果我重新编译它,错误将变成两个:
缺失数字,视为零。...包括 {91}\footnotemark[\ref{note1}],
扫描 \@@@floatbox 的使用时文件结束,
除了抛出警告说我的引用未定义之外。请注意,在添加最近的代码片段之前,所有内容都可以正确编译。
帮助?
答案1
编辑:
另一种解决方案是,不使用包floatrow
,dblfloatfix
而是使用capt-of
包在环境中设置表标题figure
:
\documentclass[conference]{IEEEtran}
\usepackage{bm}
\usepackage[demo]{graphicx}
\usepackage{capt-of} % <--- for captions outside floats and for table caption in figure float
\usepackage{algorithm}
\usepackage{algorithmicx,algpseudocode}
\usepackage{stfloats} % for positioning of figure* on the same page, instead of floatrow
\usepackage{lipsum}
\title{xxx}
\begin{document}
\maketitle
\lipsum[1]
\begin{figure*}[b]
\begin{minipage}{0.5\linewidth}
\centering
\includegraphics{rec.pdf}
\caption{A caption for a figure in a figure and a table side by side}
\label{fig:test}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\captionof{table}{A caption for a table in a figure and a table side by side}
\label{tab:test}
\begin{tabular}{|c||l|}
\hline
Event & Description\\
\hline
11 & \textbf{M1} generates a workpiece.\\
20 & \textbf{M2} takes a workpiece.\\
12~/~22 & Breakdown is occurred in \textbf{M1}~/~\textbf{M2}.\\
13~/~23 & \textbf{M1}~/~\textbf{M2} is repaired.\\
30~/~32 & \textbf{M1} increases \textbf{BUF1}~/~\textbf{BUF2}.\\
31~/~33 & \textbf{M2} decreases \textbf{BUF1}~/~\textbf{BUF2}.\\
\hline
91 & The reconfiguration $C^{1}_{\bm{G}} \rightarrow C^{2}_{\bm{G}}$ is requested.\\
93 & The reconfiguration $C^{2}_{\bm{G}} \rightarrow C^{1}_{\bm{G}}$ is requested.\\
\hline
\end{tabular}
\end{minipage}
\end{figure*}
\lipsum[2-11]
\end{document}