如何在 IEEEtran 中的长表中添加表格样式的标题?

如何在 IEEEtran 中的长表中添加表格样式的标题?

我有一个长表,但其标题不像常规表那样显示为大写。另外,我需要表号下的标题,而不是在同一行。这是我的代码:

\documentclass[journal]{IEEEtran}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\lipsum[4-9]
\begin{table}[]
\centering
\caption{State Table for My Machine}\label{design1}
\begin{tabular}{cccc}
\hline
a&b&c&d\\
\hline
1&2&3&4\\
\hline
\end{tabular} 
\end{table}
\onecolumn
\begin{longtable}{lccccccccccccccr}
\caption{State Table for My Machine}\label{design2}\\ 
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endfirsthead
\multicolumn{16}{l}{Table \ref{design} continued from previous page...}\\
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endhead
\hline
\endfoot
x               & xxxx            & x & x & x   & xx  & 0  & 0  & 0 & 0 & 0 & 0 & 0   & 0   & 0    & OOO         \\ \hline
OOO             & 0000            & 0 & 0 & x   & x0  & 1  & 1  & 1 & 1 &   &   & 0   & 0   & 0    & PO          \\
                & 0000            & 0 & 0 & x   & x1  &    &    &   &   & 1 & 1 & 0   & 0   & 0    & OOP         \\
                & 0000            & 0 & 1 & x   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 0 & 1 & x   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 0 & 1 & x   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
                & 0000            & 1 & 0 & x   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 0 & x   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 0 & x   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 0   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 1 & 0   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 1 & 0   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 1   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 1 & 1 & 1   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 1 & 1 & 1   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\ 
\end{longtable}
\twocolumn
\lipsum[5]
\end{document}`

当我运行它时,我得到两个表。这些是快照: 在此处输入图片描述

在此处输入图片描述

我希望表 2 具有与表 1 相同的标题格式。请帮忙!

答案1

另一个解决方案是\LT@makecaption使用 IEEEtran.cls 中的一种表格式进行修改(有很多不同的版本)。

\documentclass[journal]{IEEEtran}
\usepackage{longtable}
\usepackage{lipsum}
%\usepackage{capt-of}

\makeatletter
\def\LT@makecaption#1#2#3{%
\LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
\footnotesize\bgroup\par\centering\@IEEEtabletopskipstrut{\normalfont\footnotesize #2}\\{\normalfont\footnotesize\scshape #3}\par\addvspace{0.5\baselineskip}\egroup\endgraf%
\@IEEEtablecaptionsepspace}%
\hss}}}
\makeatother

\begin{document}
\lipsum[4-9]
\begin{table}[]
\centering
\caption{State Table for My Machine\label{design1}}
\begin{tabular}{cccc}
\hline
a&b&c&d\\
\hline
1&2&3&4\\
\hline
\end{tabular} 
\end{table}
\onecolumn
\begin{longtable}{lccccccccccccccr}
\caption{State Table for My Machine}\label{design2}\\
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endfirsthead
\multicolumn{16}{l}{Table \ref{design} continued from previous page...}\\
\hline
\multicolumn{2}{c}{Initial State} & R & C & sel & loc & \multicolumn{6}{c}{mol} & cre & con & r\_c & Final State \\
                &                 &   &   &     &     & 5  & 4  & 3 & 2 & 1 & 0 &     &     &      &             \\
\hline
\endhead
\hline
\endfoot
x               & xxxx            & x & x & x   & xx  & 0  & 0  & 0 & 0 & 0 & 0 & 0   & 0   & 0    & OOO         \\ \hline
OOO             & 0000            & 0 & 0 & x   & x0  & 1  & 1  & 1 & 1 &   &   & 0   & 0   & 0    & PO          \\
                & 0000            & 0 & 0 & x   & x1  &    &    &   &   & 1 & 1 & 0   & 0   & 0    & OOP         \\
                & 0000            & 0 & 1 & x   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 0 & 1 & x   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 0 & 1 & x   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\
                & 0000            & 1 & 0 & x   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 0 & x   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 0 & x   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 0   & 00  & 0  & 1  &   &   &   &   & 0   & 1   & 1    & XOO         \\
                & 0000            & 1 & 1 & 0   & 01  &    &    & 0 & 1 &   &   & 0   & 1   & 1    & OXO         \\
                & 0000            & 1 & 1 & 0   & 10  &    &    &   &   & 0 & 1 & 0   & 1   & 1    & OOX         \\
                & 0000            & 1 & 1 & 1   & 00  & 1  & 0  &   &   &   &   & 0   & 1   & 0    & XOO         \\
                & 0000            & 1 & 1 & 1   & 01  &    &    & 1 & 0 &   &   & 0   & 1   & 0    & OXO         \\
                & 0000            & 1 & 1 & 1   & 10  &    &    &   &   & 1 & 0 & 0   & 1   & 0    & OOX         \\ 
\end{longtable}
\twocolumn
\lipsum[5]
\end{document}

相关内容