40

I am trying to add both an image and list inside a table but I face various problems. As shown in the picture, the image is above the first horizontal line and also the lists are not properly oriented, they are located at the end of the table, not in the same line with the image. Can anybody help me with that? Thanks a lot

     \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}

enter image description here

52

You can use \raisebox to adjust the vertical positioning of the image:

\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}

enter image description here

I also made some changes to your code (as suggestions, of course):

  1. I used the booktabs package to improve the table design (in particular, no vertical rules).
  2. I used the enumitem package to suppress some vertical spacing before the lists.
  • You are amazing man, great solution. Thanks a lot, 10000 likes!!!! ;) – user1015777 Apr 23 '12 at 23:29
27

The array package provides the m{<len>} column type which vertically aligns content in rows:

enter image description here

\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}
​

Then, additionally, you can place the image inside a minipage of equivalent size (box it) to obtain the correct alignment. The adjustbox package provides a similar alignment modification fox boxes.

  • I like the flexibility of this approach - thanks – Alec Mar 30 '18 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.