在表格中插入图像和列表

在表格中插入图像和列表

我正在尝试在表格中添加图像和列表,但遇到了各种问题。如图所示,图像位于第一条水平线上方,而且列表的方向不正确,它们位于表格的末尾,与图像不在同一行。有人能帮我吗?非常感谢

     \begin{table}[h!]
     \begin{center}
     \begin{tabular}{ | c | p{5cm} | p{5cm} | }
     \hline
      my.Lboro & Advantages & Disadvantages \\ \hline
     \includegraphics[width=0.3\textwidth, height=60mm]{images/myLboro.png}
      & 
      \begin{itemize}
      \item Accessibility
      \item Up to date information
      \item Fulfil students needs and wants \ldots
      \end{itemize}
      & 
      \begin{itemize}
      \item Accessibility
      \item Up to date information
      \item Fulfil students needs and wants \ldots
      \end{itemize}
      \\ \hline
      \end{tabular}
      \caption{my.Lboro Analysis}
      \label{tbl:myLboro}
      \end{center}
      \end{table}

在此处输入图片描述

答案1

您可以使用\raisebox来调整图像的垂直定位:

\documentclass{memoir}
\usepackage[demo]{graphicx}% delete the demo option in your actual code
\usepackage{enumitem}
\usepackage{booktabs}

\begin{document}

\begin{table}[h!]
     \begin{center}
     \begin{tabular}{ c  p{5cm}  p{5cm}  }
     \toprule
      my.Lboro & Advantages & Disadvantages \\ 
    \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}
     \raisebox{-\totalheight}{\includegraphics[width=0.3\textwidth, height=60mm]{images/myLboro.png}}
      & 
      \begin{itemize}[topsep=0pt]
      \item Accessibility
      \item Up to date information
      \item Fulfil students needs and wants \ldots
      \end{itemize}
      & 
      \begin{itemize}[topsep=0pt]
      \item Accessibility
      \item Up to date information
      \item Fulfil students needs and wants \ldots
      \end{itemize}
      \\ \bottomrule
      \end{tabular}
      \caption{my.Lboro Analysis}
      \label{tbl:myLboro}
      \end{center}
      \end{table}

\end{document}

在此处输入图片描述

我还对你的代码做了一些更改(当然是建议):

  1. 我用的是书签包装以改进表格设计(特别是没有垂直规则)。
  2. 我用的是枚举项包来抑制列表前的某些垂直间距。

答案2

array包裹提供m{<len>}垂直对齐行中内容的列类型:

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array
\begin{document}

\begin{table}[h!]
  \centering
  \begin{tabular}{ | c | m{5cm} | m{5cm} | }
    \hline
    my.Lboro & Advantages & Disadvantages \\ \hline
    \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{tiger}
    \end{minipage}
    &
    %\begin{minipage}[t]{5cm}
      \begin{itemize}
        \item Accessibility
        \item Up to date information
        \item Fulfil students needs and wants \ldots
      \end{itemize}
    %\end{minipage}
    & 
    %\begin{minipage}{5cm}
      \begin{itemize}
        \item Accessibility
        \item Up to date information
        \item Fulfil students needs and wants \ldots
      \end{itemize}
    %\end{minipage}
    \\ \hline
  \end{tabular}
  \caption{my.Lboro Analysis}\label{tbl:myLboro}
\end{table}

\end{document}

然后,另外,您可以将图像放在minipage大小相等的 内(将其框起来)以获得正确的对齐。adjustbox包裹为控制箱提供了类似的对齐修改。

相关内容