控制表格环境中的文本位置

控制表格环境中的文本位置

每行文本放置不正确

以下是以下渲染的代码

\headerbox{Experimental Results}{name=results,span=2,column=1,above=future}{
\begin{minipage}{\linewidth}
\centering
\captionof{table}{Inference on IR images using WaSR} 
%\begin{table}[t]
\label{wasr_as_is_ir}
    \setlength{\tabcolsep}{0.5\dp\strutbox} % the devious trick!
    \begin{tabular}{@{} t @{\quad} ccc @{}}
         {\parbox{20mm}{\raggedright Original IR images}} &
         \includegraphics[width=40mm]{images/input/1603212920.750480_color_grayscale_resized_color.png}  & 
         \includegraphics[width=40mm]{images/input/1603391732.530753_color_grayscale_resized_color.png}  &
         \includegraphics[width=40mm]{images/input/1603391799.096494_color_grayscale_resized_color.png}  \\
        {\parbox{20mm}{\raggedright Direct inference}} &
         \includegraphics[width=40mm]{images/wasr_as_is/ir/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
         \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
         \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
        {\parbox{20mm}{\raggedright Retrained with gray scale images}} &
        \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
        \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
         \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
        {\parbox{20mm}{\raggedright Retrained with IR images}} &
        \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
         \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
          \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    \end{tabular}
%\end{table}
\end{minipage}
}

我尝试了不同大小的 parbox,但无法正确放置文本。

更新:我没能解释清楚我正在制作 A0 海报并在其中创建一个标题框。所以我无法在其中使用表格(浮动)环境。在采纳 js 的建议后,我已经接近目标,但文本仍然是一个问题。请参阅下面的最新代码和新结果。

\begin{posterbox}[name=results,span=2,column=1,below=setup,above=future]{Results}
\begin{minipage}{\linewidth}
\centering
\captionof{table}{Inference on IR images using WaSR} 
\label{wasr_as_is_ir}
    \begin{tabular}{@{} p{1.1cm} @{\quad} ccc @{}}
{\multirow{-8}{*}{\makecell[l]{ Original \\IR images}}} &
     \includegraphics[width=40mm]{images/input/1603212920.750480_color_grayscale_resized_color.png}  & 
     \includegraphics[width=40mm]{images/input/1603391732.530753_color_grayscale_resized_color.png}  &
     \includegraphics[width=40mm]{images/input/1603391799.096494_color_grayscale_resized_color.png}  \\
    {\multirow{-8}{*}{\makecell[l]{Direct \\inference}}} &
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    {\multirow{-8}{*}{\makecell[l]{Retrained \\with \\gray scale}}} &
    \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
    \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
     \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    {\multirow{-8}{*}{\makecell[l]{Retrained \\with \\IR images}}} &
    \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
     \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
      \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    \end{tabular}

%\end{table}
\end{minipage}
\end{posterbox}

文本太靠近图像单元。我不知道为什么!任何帮助将文本稍微向左移的帮助都将不胜感激。

在此处输入图片描述

更新 2:回答 @egreg。我使用的是 minipage,但文本几乎与图像接触。这是我的代码 -

\documentclass[a0paper,portrait,showframe]{baposter} \usepackage{calc} \usepackage{amsmath} \usepackage{amssymb} \usepackage{relsize} \usepackage{multirow} \usepackage{rotating} \usepackage{bm} \usepackage{url} \usepackage{enumitem}% 用于自定义列表

\usepackage{graphicx} \usepackage{multicol}

\usepackage{palatino} \usepackage[font=small,labelfont=bf]{caption} \usepackage{textcomp} \usepackage{xcolor} \usepackage{amsmath,mathtools} \usepackage{amssymb} \usepackage{colortbl,booktabs} \usepackage{array,ragged2e} \usepackage{stfloats} \usepackage{fancyhdr} \usepackage{graphicx,subcaption,ragged2e} \usepackage{comment} \usepackage[export]{adjustbox} \usepackage{rotating} \usepackage{booktabs, makecell, tabularx} \usepackage{textcomp} % 商标符号 \usepackage{caption}

%%% 全局设置 % ...在列表打开后使用此项 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\compresslist}{% \setlength{\itemsep}{1pt}% \setlength{\parskip}{0pt}% \setlength{\parsep}{0pt}% } % ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \typeout{海报渲染已开始} \definecolor{lightblue}{rgb}{0.145,0.6666,1} %%% 海报常规设置 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%% 引人注目的内容、标题、作者和大学图片 %%%%%%%%%%%%%%%%%%%%%%%% \begin{poster} % { % 海报选项 % 显示网格以帮助对齐 %grid=true, % 列间距 colspacing=1em, % 颜色样式 bgColorOne=white, bgColorTwo=white, borderColor=lightblue, headerColorOne=black, headerColorTwo=lightblue, headerFontColor=white, boxColorOne=white, boxColorTwo=lightblue, % 文本框的格式 textborder=roundedleft, % 文本标题的格式 %eyecatcher=false, headerborder=closed, headerheight=0.1\textheight, % a0 海报 % textfont=\sc, 更改文本字体的示例 headershape=roundedright, headershade=shadelr, headerfont=\Large\bf\textsc, %Sans Serif textfont={\setlength{\parindent}{1.5em}}, %a0 海报 boxshade=plain, % background=shade-tb, background=plain, linewidth=2pt } % 醒目元素 { }

\begin{posterbox}[name=results,span=2,column=1,below=setup,above=bottom]{结果} \begin{minipage}{\linewidth} \centering \captionof{table}{使用 WaSR 对红外图像进行推断} \label{wasr_as_is_ir} \begin{tabular}{@{} p{1.1cm} @{\quad} ccc @{}} {\multirow{-9}{}{\makecell[l]{ 原始 \IR 图像}}} & \includegraphics[width=40mm]{images/input/1603212920.750480_color_grayscale_resized_color.png} & \includegraphics[width=40mm]{images/input/1603391732.530753_color_grayscale_resized_color.png} & \includegraphics[width=40mm]{images/input/1603391799.096494_color_grayscale_resized_color.png} \ \ {\multirow{-9}{}{\makecell[l]{直接 \inference}}} & \includegraphics[width=40mm]{images/wasr_as_is/ir/1603212920.750480_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391732.530753_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391799.096494_color_grayscale_resized_color_output_mask.png} \ \ {\multirow{-9}{}{\makecell[l]{使用 \gray scale 重新训练}}} & \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \ \ {\多行{-9}{}{\makecell[l]{使用 \IR 图像重新训练}}} & \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} & \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \ \ \end{tabular} \vspace{1cm}
\captionof{table}{定量结果}
\begin{tabular}{|c|c|} \hline 准确率 & 0.4583 \ \hline 召回率 & 0.9167 \ \hline \end{tabular} %\end{table} \end{minipage} \end{posterbox}

答案1

在此处输入图片描述

  \begin{tabular}{@{} p{2cm} @{\quad} ccc @{}}
     {\multirow{-9}{*}{\makecell[l]{ Original \\IR images}}} &
     \includegraphics[width=40mm]{images/input/1603212920.750480_color_grayscale_resized_color.png}  & 
     \includegraphics[width=40mm]{images/input/1603391732.530753_color_grayscale_resized_color.png}  &
     \includegraphics[width=40mm]{images/input/1603391799.096494_color_grayscale_resized_color.png}  \\
    {\multirow{-9}{*}{\makecell[l]{Direct \\inference}}} &
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
     \includegraphics[width=40mm]{images/wasr_as_is/ir/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    {\multirow{-9}{*}{\makecell[l]{Retrained \\with \\gray scale}}} &
    \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
    \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
     \includegraphics[width=40mm]{images/wasr_with_mastr_rgb2gray_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
    {\multirow{-9}{*}{\makecell[l]{Retrained \\with \\IR images}}} &
    \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603212920.750480_color_grayscale_resized_color_output_mask.png} & 
     \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391732.530753_color_grayscale_resized_color_output_mask.png} &
      \includegraphics[width=40mm]{images/wasr_with_our_ir_retrain/1603391799.096494_color_grayscale_resized_color_output_mask.png} \\
\end{tabular}

答案2

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx,lipsum}
\usepackage[export]{adjustbox}
\begin{document}
\lipsum[1]
\begin{table}
\caption{Inference on IR images using WaSR}
\newcommand\rowlabel[1]{\parbox{.2\linewidth}{\raggedright #1}\hfill}
\newcommand\IRimage[1]{\includegraphics[valign=c,width=.24\linewidth]{#1}}
\hrulefill\bigskip\par
\rowlabel{Original IR images}  
\IRimage{example-image-a} \hfill  
\IRimage{example-image-b} \hfill  
\IRimage{example-image-c} \medskip\par
\rowlabel{Direct Interference}
\IRimage{example-image-a} \hfill  
\IRimage{example-image-b} \hfill  
\IRimage{example-image-c} \medskip\par
\rowlabel{Retrained with gray scale images}  
\IRimage{example-image-a} \hfill  
\IRimage{example-image-b} \hfill  
\IRimage{example-image-c} \medskip\par
\rowlabel{Retrained with IR images}  
\IRimage{example-image-a} \hfill  
\IRimage{example-image-b} \hfill  
\IRimage{example-image-c} \bigskip\par
\hrulefill
\end{table}
\lipsum[2]
\end{document}

答案3

这种狡猾的伎俩在这种情况下不起作用。这里有一个替代版本。

\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{booktabs}

\newlength{\modulewidth}

\begin{document}

\begin{table}[htp]
\centering

\caption{Inference on IR images using WaSR} 
\label{wasr_as_is_ir}

\setlength{\tabcolsep}{1mm}
\setlength{\aboverulesep}{2\tabcolsep}
\setlength{\belowrulesep}{2\tabcolsep}
\setlength{\modulewidth}{\dimexpr(\textwidth-1em-4\tabcolsep)/7}

\begin{tabular}{@{} c @{\quad} ccc @{}}
\toprule
\parbox{\modulewidth}{\raggedright Original IR images} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} \\
\addlinespace[2mm]
\parbox{\modulewidth}{\raggedright Direct inference} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} \\
\addlinespace[2mm]
\parbox{\modulewidth}{\raggedright Retrained with gray scale images} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} \\
\addlinespace[2mm]
\parbox{\modulewidth}{\raggedright Retrained with IR images} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} &
  \includegraphics[valign=c,width=2\modulewidth]{example-image} \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

在此处输入图片描述

相关内容