使用表格将数字对齐到单元格的中心

使用表格将数字对齐到单元格的中心

我创建了下表:

在此处输入图片描述

我不知道如何将数字对齐到单元格的中心,而不扩大表格的长度。数字需要适合单元格的这个大小。我不想与下面的页码重叠。我已经处理这个问题有一段时间了,但还没有想出一个符合我标准的解决方案。我愿意听取任何建议和您的专业知识。我对 Latex 还比较陌生,所以如果答案很明显,请原谅我。提前谢谢!

这是我目前的代码:

\documentclass[12pt,a4paper]{book}
\usepackage{a4wide}
\usepackage[english]{babel}
\usepackage{graphicx, subfigure}         %all the packages of the whole document
\usepackage{stanli}
\usepackage{fancyhdr}
\usepackage{pdfpages} 
\usepackage{setspace} 
\usepackage{parskip}
\usepackage{pdflscape} 
\usepackage{color,soul}
\usepackage{multirow}
\usepackage{enumitem} 
\usepackage{amsfonts} 
\usepackage{array} 
    
\begin{document}
\begin{table}[]
    \centering
    \caption{Operations}
    \label{table_Operations}
    \begin{tabular}{|c|c|p{0.2\linewidth}|p{0.70\linewidth}|}
        \hline
        \textbf{} & \textbf{Icon} & \multicolumn{1}{c|}{\textbf{Name}} & \multicolumn{1}{c|}{\textbf{Description}} \\ \hline
        1         & \includegraphics[scale=.75]{New_Compound_Operation.png}        & Compound Operation                 & This operation creates a compound operation which is a sequence of operations. These operations may be of different types such as object flow, device, compound, etc.\\ \hline
        2         & \includegraphics[scale=.75]{New_NonSim_Operation.png}       & Non-Sim Operation                  & This operation creates a non-simulated operation which is an operation used for marking time intervals or for marking the place of an operation that will be created later.\\ \hline
        3         & \includegraphics[scale=.75]{New_Object_Flow_Operation.png}       & Object Flow Operation              & This operation creates an object flow operation to move an object along a path.\\ \hline
        4         & \includegraphics[scale=.75]{New_Device_Operation.png}      & Device Operation                   & This operation moves a device from one pose to another. \\ \hline
        5         & \includegraphics[scale=.75]{New_Grip_Operation.png}      & Gripper Operation                  & This operation is meant for a gripping device, which can grip and release.\\ \hline
        6         & \includegraphics[scale=.75]{New_Device_Control_Group_Operation.png}       &  Device Control Group Operation   & This operation creates a device-control-group that moves a group of devices from one pose to another. The group of devices is defined and then the pose is defined using 'Edit Pose Groups'.\\ \hline
        7         & \includegraphics[scale=.75]{New_Weld_Operation.png} & Weld Operation                     & This operation is meant for a weld robot with a mounted gun or workpiece. The weld operation is comprised of weld location operations.\\ \hline
        8         & \includegraphics[scale=.75]{New_Continuous_Feature_Operation.png}       &  Continuous Feature Operation   & This operation creates a continuous feature operation which is meant for a robot performing laser welding or glue applications. A Continuous Feature operation is comprised of continuous manufacturing operations.\\ \hline
        9         & \includegraphics[scale=.75]{New_PickPlace_Operation.png}       & Pick and Place   Operation         & This creates a pick-and-place for moving an object form one place to another.\\ \hline
        10        & \includegraphics[scale=.75]{New_Generic_Robot_Operation.png}        & Generic Robotic   Operation        & This creates a robotic operation for general use.\\ \hline
        11        & \includegraphics[scale=.75]{New_Robot_Path_Generator.png}       &  Robot Path Reference Operation  & This operations creates a Robot Path Reference (RPR) that runs in Line Simulation Mode. An RPR operation activates robotic operations within a robotic program.\\ \hline
        12        & \includegraphics[scale=.75]{NewEdit_Concurrent_Robotic_Operation.png}       &  Concurrent Robotic Operation  & This operation creates a concurrent robotic operation for moving a dual-arm robot or multiple robots. Multiple operations are grouped and preform synchronized, cooperative or load sharing mode.\\ \hline
        13        & \includegraphics[scale=.75]{New_Robotic_Program.png}       & Robotic Program                    & This operation creates a robotic program for a robot. A program is defined as a collection of operations.\\ \hline
        14        & \includegraphics[scale=.75]{Human_Compound_Operation.png}       &  Human Compound  Operation & Creates a human compound operation. This operation is similar to the regular compound operation.\\ \hline
        15        & \includegraphics[scale=.75]{Create_Posture_Operation.png}       & Create Posture   Operation         & This creates a posture operation for a moving human to a specific posture.\\ \hline
    \end{tabular}
\end{table}
\end{document}

答案1

尝试以下 MWE(不幸的是,您没有提供有关您的文档的任何信息,也没有提供有关您的表格的代码,因此其中使用了虚拟文本)。

在 MWE 中,通过使用adjustbox包图像将基线移动到图像的顶部,图像大小由\adjustboxset和为包含在表中而设置的\adjincludegraphics指令:

\documentclass{article}
\usepackage{microtype} % for better spacing of text
\usepackage[export]{adjustbox} %it load graphicx too
\usepackage{tabularray}

\usepackage{lipsum}

\begin{document}
    \begin{table}[htb]
    \centering
\adjustboxset{width=12mm,valign=t,   % <--- asumed that all images have equal size
              margin=0pt 3pt 0pt 3pt}% <---
\begin{tblr}{hlines, vlines,
             colspec = { Q[c] Q[c] X[j] X[3,j] },
             row{1} = {font=\bfseries, c}
            }
    &   Icon
        &   Name
            &   Description     \\
1   & \adjincludegraphics{example-image-duck} 
        & Compound operation  
            &   \lipsum[1][1]   \\
2   & \adjincludegraphics{example-image-duck}
        & Non-Sim Operation
            &   \lipsum[1][1-2] \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

答案2

尝试一下这个(放入你的图片中):

\documentclass[12pt]{book}
\usepackage{amsmath,graphicx} % For example picture
\usepackage[export]{adjustbox}
\usepackage[column=0]{cellspace}
\setlength{\cellspacetoplimit}{\tabcolsep}
\setlength{\cellspacebottomlimit}{\tabcolsep}

\begin{document}
    \begin{table}[]
        \centering
        \begin{tabular}{|0c|0c|0c|}
            \hline
            \textbf{1} & \textbf{2} & \textbf{3} \\ \hline
            a & \includegraphics[width=0.35\linewidth, valign=c]{logoRS.png} & momento relativistico \\ \hline
            c & \includegraphics[width=0.25\linewidth, valign=c]{Cecilia.png} & d \\ \hline
        \end{tabular}
    \end{table}
\end{document}

输出: 在此处输入图片描述

相关内容