我有此代码,但我想在表格中再添加 1 个子列(第二列和第三列),如屏幕截图所示
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
%\usepackage{cite}
\usepackage{amsmath,amssymb}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
%\usepackage{subfig}
\usepackage[english]{babel}
\usepackage{makecell}%
%table
\usepackage[margin=1in]{geometry}
\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{times}
\makeatletter
\newcommand{\removelatexerror}{\let\@latex@error\@gobble}
\makeatother
%\documentclass{IEEEtran}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\usepackage{subcaption, floatrow}
\begin{document}
\begin{table*}
\begin{subfloatrow}[2]
\CenterFloatBoxes
\ttabbox{\caption{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}\label{tbl}}
{\tiny \setlength\tabcolsep{3pt}\centering
\begin{tabular}{@{} ll *{4}{c} @{}}
\toprule
ooooooooo& bbbbbb
&\multicolumn{2}{c}{ccccvvvvvv}
&\multicolumn{2}{c}{ccccccccc}\\
\cmidrule(lr){3-4} \cmidrule(l){5-6}
& & \makecell{vvvvvvvvv\\ (cccc)} &\makecell{vvvvvvvvv\\ (vvvvvvv)} &\makecell {vvvvvvvvv\\ (cccc)} &\makecell {vvvvvvvvv \\ (vvvvvvvv)} \\
\midrule
vvvvvvvvvvvvvvvvv & bbbbbbbbb &fff &fffffffff &fffffffffffffff& ff \\
\addlinespace %\midrule
ffffffffffff & fffffff8 &fff &fffffffffffff & ff &fffffffffff\\
\addlinespace %\midrule
fffffffffff & ffffffffff &fff &ffffffffff & ffff &ffffffffff\\
\addlinespace %\midrule
fffffffff & fffff &fff &fffffffffffff &fff &fffffffffffff\\
\addlinespace %\midrule
ffffffffffffffff & ffffffff &fff &ffffffffffff4 &ffffffffff& ff \\
\addlinespace %\midrule
fffffffff & fffffff &fffffff &fffffffff &ffffffffffffff& ff \\
\addlinespace %\midrule
fffffffff & ffffffff &fff &ffff &fffffffffffff& ff\\
\addlinespace %\midrule
ffffffffffffffff & ffffffffff &8fffff &ffffffffffff &ffff& fffffffffffff\\
\bottomrule
\end{tabular}}
\killfloatstyle
\hskip 6em
\ffigbox [\FBwidth]{\raggedleft\includegraphics[scale=0.7]{Nightmare_Fussli}}
{ \caption{Johann-Heinrich Füssli: Nightmare}\label{fig}}
\end{subfloatrow}
\end{table*}
\end{document}
答案1
我猜你正在寻找这样的东西:
上表由以下 MWE 制作:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage[margin=1in]{geometry}
\usepackage{textcomp}
%\usepackage{times}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{capt-of}
\usepackage[export]{adjustbox} % for "valign", it also load graphicx
\begin{document}
\begin{table*}[ht]
\begin{tabularx}{\linewidth}{>{\hsize=1.2\hsize}Y
>{\hsize=0.8\hsize}Y}
\caption{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
\label{tbl}
\setlength\tabcolsep{0pt}
\small
\begin{tabular}{@{\extracolsep{\fill}} ll *{6}{c} @{}}
\toprule
ooooooo
& bbbbbb
&\multicolumn{3}{c}{ccccvvvvvv}
&\multicolumn{3}{c}{ccccccccc} \\
\cmidrule(lr){3-5} \cmidrule(l){6-8}
& & \makecell{vvvv\\ (aaaa)}
& \makecell{vvvv\\ (bbbb)}
& \makecell{vvvv\\ (cccc)}
& \makecell{vvvv\\ (aaaa)}
& \makecell{vvvv\\ (bbbb)}
& \makecell{vvvv\\ (cccc)} \\
\midrule
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
\addlinespace
fffff
& fffffff8
& fff
& fffffffffffff
& ff
& fff
& fffffffffffff
& ff \\
\addlinespace
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
\addlinespace
fffff
& fffffff8
& fff
& fffffffffffff
& ff
& fff
& fffffffffffff
& ff \\
\bottomrule
\end{tabular}
& \includegraphics[width=\linewidth,valign=t]{example-image-duck}%{Nightmare_Fussli}
\captionof{figure}{Johann-Heinrich Füssli: Nightmare}
\label{fig}
\end{tabularx}
\end{table*}
\end{document}
附录: 为了练习(并宣传新的 LaTeX-3 软件包):-)
如果您允许使用tabularray
包,那么您的表格和图像的放置设计会更好:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage[margin=1in]{geometry}
\usepackage{newtxtext, newtxmath} % instead of textcomp or times fonts
\usepackage{tabularray}
\UseTblrLibrary{booktabs, counter, varwidth}
\usepackage{capt-of}
\usepackage[export]{adjustbox} % for "valign", it also load graphicx
\begin{document}
\begin{table*}[ht]
\small
\setlength\tabcolsep{3pt}
\begin{tblr}{colspec={@{} X[1.3,c] X[0.7,c] @{}},
measure = vbox}
%
\begin{talltblr}[
\caption={aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
\label{tbl} ]{colspec={@{} ll *{6}{c} @{}},
colsep={3pt},
}
\toprule
ooooooo
& bbbbbb
& \SetCell[c=3]{c} ccccvvvvvv & &
& \SetCell[c=3]{c} ccccccccc & & \\
\cmidrule[lr]{3-5} \cmidrule[l]{6-8}
& & {vvvv\\ (aaaa)}
& {vvvv\\ (bbbb)}
& {vvvv\\ (cccc)}
& {vvvv\\ (aaaa)}
& {vvvv\\ (bbbb)}
& {vvvv\\ (cccc)} \\
\midrule
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
fffff
& fffffff8
& fff
& fffffffffffff
& ff
& fff
& fffffffffffff
& ff \\
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
fffff
& fffffff8
& fff
& fffffffffffff
& ff
& fff
& fffffffffffff
& ff \\
vvvvv
& bbbbbbb
& fff
& ffff
& fffff
& fff
& ffff
& fffff \\
fffff
& fffffff8
& fff
& fffffffffffff
& ff
& fff
& fffffffffffff
& ff \\
\bottomrule
\end{talltblr}
& \includegraphics[width=\linewidth, valign=m]{example-image-duck}%{Nightmare_Fussli}
\captionof{figure}{Johann-Heinrich Füssli: Nightmare}
\label{fig}
\end{tblr}
\end{table*}
\end{document}