我想添加额外的一行,以便第一列之后的图像可以分成另外两列,如我上传的第二张图片所示。用红色绘制的“1”和“2”代表我想要添加的列。
我尝试了一下代码,但没有成功。有人能帮我吗?
这是创建表的代码:
\begin{table*}[t]
\settowidth\rotheadsize{MCTS (Greedy)}
\adjustboxset{width=36mm, height=36mm,
valign=M}
\begin{tblr}{colsep = 3pt,
colspec = {@{} Q[c,h] X[c] X[c] @{}},
rowsep = 3pt,
row{1,2} = {font=\bfseries, c, m},
}
\toprule
\SetCell[r=2]{c} Ground Truth
& \SetCell[c=3]{c}Communication
& & \\
\midrule
& Full
& Poor \\
\midrule
\adjincludegraphics[width=1.35in]{images/circ_gt.png}
& \adjincludegraphics[width=1.35in]{images/circ_full_ourmethod_74} \adjincludegraphics[width=1.35in]{images/circ_full_othermethod_54}
% & \adjincludegraphics{images/circ_partial_55}
& \adjincludegraphics[width=1.35in]{images/circ_poor_ourmethod_60}
\adjincludegraphics[width=1.35in]{images/circ_poor_othermethod_47} \\
\midrule
\adjincludegraphics[width=1.35in]{images/depoe_gt.png}
& \adjincludegraphics[width=1.35in]{images/depoe_full_ourmethod_269}
\adjincludegraphics[width=1.35in]{images/depoe_full_othermethod_190}
% & \adjincludegraphics{images/depoe_partial_246}
& \adjincludegraphics[width=1.35in]{images/depoe_poor_ourmethod_261}
\adjincludegraphics[width=1.35in]{images/depoe_poor_othermethod_136} \\
\end{tblr}
\caption{my.Lboro Analysis}
\label{tbl:myLboro}
\end{table*}
这些是我在根文件中使用的包/设置:
\documentclass[lettersize,journal]{IEEEtran}
\usepackage{amsmath,amsfonts}
% \usepackage{algorithmic}
\usepackage{array}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\usepackage{textcomp}
\usepackage{stfloats}
\usepackage{url}
\usepackage{verbatim}
\usepackage{graphicx}
\hyphenation{op-tical net-works semi-conduc-tor IEEE-Xplore}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\usepackage{balance}
\usepackage[backend=biber]{biblatex}
\addbibresource{references.bib}
% package to color comments for multiple users
\usepackage[usenames,dvipsnames,table]{xcolor}
\newcommand{\gb}[1]{{\color{RawSienna}\textit{(GB) #1}}}
\newcommand{\ks}[1]{{\color{blue}\textit{(KS) #1}}}
\usepackage{tabularx}
\usepackage[export]{adjustbox}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
% \usepackage{caption}
% \captionsetup[table]{skip=10pt}
\usepackage{algorithm, algorithmicx}% http://ctan.org/pkg/algorithms
% \usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage[noend]{algpseudocode}
\usepackage{etoolbox}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{calc}
\DeclareMathOperator*{\argmax}{arg\,max}
%%%%%%% Vertical Lines in Algos %%%%%%%
\errorcontextlines\maxdimen
% begin vertical rule patch for algorithmicx (http://tex.stackexchange.com/questions/144840/vertical-loop-block-lines-in-algorithmicx-with-noend-option)
% note that some of the packages above are also needed
\newcommand{\ALGtikzmarkcolor}{black}% customise this, if you want
\newcommand{\ALGtikzmarkextraindent}{4pt}% customise this, if you want
\newcommand{\ALGtikzmarkverticaloffsetstart}{-.5ex}% customise this, if you want
\newcommand{\ALGtikzmarkverticaloffsetend}{-.5ex}% customise this, if you want
\makeatletter
\newcounter{ALG@tikzmark@tempcnta}
\newcommand\ALG@tikzmark@start{%
\global\let\ALG@tikzmark@last\ALG@tikzmark@starttext%
\expandafter\edef\csname ALG@tikzmark@\theALG@nested\endcsname{\theALG@tikzmark@tempcnta}%
\tikzmark{ALG@tikzmark@start@\csname ALG@tikzmark@\theALG@nested\endcsname}%
\addtocounter{ALG@tikzmark@tempcnta}{1}%
}
\def\ALG@tikzmark@starttext{start}
\newcommand\ALG@tikzmark@end{%
\ifx\ALG@tikzmark@last\ALG@tikzmark@starttext
% ignore this, the block was opened then closed directly without any other blocks in between (so just a \State basically)
% don't draw a vertical line here
\else
\tikzmark{ALG@tikzmark@end@\csname ALG@tikzmark@\theALG@nested\endcsname}%
\tikz[overlay,remember picture] \draw[\ALGtikzmarkcolor] let \p{S}=($(pic cs:ALG@tikzmark@start@\csname ALG@tikzmark@\theALG@nested\endcsname)+(\ALGtikzmarkextraindent,\ALGtikzmarkverticaloffsetstart)$), \p{E}=($(pic cs:ALG@tikzmark@end@\csname ALG@tikzmark@\theALG@nested\endcsname)+(\ALGtikzmarkextraindent,\ALGtikzmarkverticaloffsetend)$) in (\x{S},\y{S})--(\x{S},\y{E});%
\fi
\gdef\ALG@tikzmark@last{end}%
}
% the following line injects our new tikzmarking code
\apptocmd{\ALG@beginblock}{\ALG@tikzmark@start}{}{\errmessage{failed to patch}}
\pretocmd{\ALG@endblock}{\ALG@tikzmark@end}{}{\errmessage{failed to patch}}
\makeatother
% end vertical rule patch for algorithmicx
答案1
- 请始终提供一个 MWE(最小工作示例),这是一个虽小但完整的文档,可以重现您的问题。
- 就您而言,这意味着您应该合并两个代码片段,并从中删除所有与您的问题无关的定义和加载包。
- 不太清楚你的问题是什么。如果你需要多一行,只需将其插入到需要的位置,但据我所知,你的表格代码还有其他问题。
- 显示的图像不是通过提供代码片段生成的。
- 您一排有多少张图片?
- 顺便说一句,如果您需要包含图像的表格的代码片段,请使用我的解决方案中的代码(上一个问题),先接受一下就好了……
MWE 的一个示例(希望)可以解决问题:
\documentclass[journal]{IEEEtran}
\usepackage[export,
demo % in real document remove this option
]{adjustbox}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table*}
%\begin{figure*}
\adjustboxset{width=\linewidth, height=36mm, % <---
valign=M}
\begin{tblr}{colsep = 3pt,
colspec = {@{} *{5}{X[c]} @{}}, % <---
rowsep = 3pt,
row{1,2} = {font=\bfseries, c, m},
}
\toprule
\SetCell[r=2]{c} Ground Truth
& \SetCell[c=4]{c} Communication % <---
& & & \\
\midrule
& \SetCell[c=2]{c} Full % <---
& & \SetCell[c=2]{c} Poor % <---
& \\
\cmidrule[r]{2-3}
\cmidrule[r]{4-5}
& 1 & 2 & 1 & 2 \\ % <--- new row
\midrule % <---
\adjincludegraphics{images/circ_gt.png}
& \adjincludegraphics{images/circ_full_ourmethod_74}
& \adjincludegraphics{images/circ_full_othermethod_54}
% & \adjincludegraphics{images/circ_partial_55} 5 <--- ??? are you have 6 images in row?
& \adjincludegraphics{images/circ_poor_ourmethod_60}
& \adjincludegraphics{images/circ_poor_othermethod_47} \\
\midrule
\adjincludegraphics{images/depoe_gt.png}
& \adjincludegraphics{images/depoe_full_ourmethod_269}
& \adjincludegraphics{images/depoe_full_othermethod_190}
% & \adjincludegraphics{images/depoe_partial_246}
& \adjincludegraphics{images/depoe_poor_ourmethod_261}
& \adjincludegraphics{images/depoe_poor_othermethod_136} \\
\end{tblr}
\caption{my.Lboro Analysis}
\label{tbl:myLboro}
% \end{figure*}
\end{table*}
\end{document}
在代码中,用% <---
代码行标记出表格代码中发生更改的位置。对此,有一些注释:
- 在表中总是定义尽可能多的列,然后使用它们
- 在包中,列必须始终用
&
(&) 符号分隔,tabularray
无论某行中的某些单元格是否合并为多列单元格(与“经典表格”相反,这不是必需的)
(红线表示文本区域边框)
table*
使用Instead of 时的结果为figure*
: