2

I am trying to make a table which includes graphics as well.

I am doing

\documentclass[a4paper,12pt]{book}
\usepackage{array}
\begin{document}

    \begin{table}[h!]
         \begin{center}
        \begin{tabular}{ | c | p{4cm} | p{3cm}|  }

         \hline
          Process & Diagrams  &     \sum  $\left| \mathcal{M} \right|^2 / \left ( 4 \pi \alpha_s\right)^2$      \\ \hline\hline
          $qq^\prime \rightarrow qq^\prime$

          &
          \centering
          \vspace{1mm}

       \includegraphics[\width=0.5\textwidth, height=20mm]{./chapter3/figures_susy/qq'_qq'.png}

            & 
        \vspace{1mm}
      $\frac{4}{9} \frac{s^2+u^2}{t^2}$    
          \\ \hline
         \end{tabular}
    \label{tab:scattering_diagrams}
          \end{center}
          \end{table}
\end{document}

but all I get looks like this

screenshot

What I want is something like this

screenshot2

1
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – jub0bs
    Mar 20, 2013 at 19:40

2 Answers 2

1

You had various problems with your code, including a figure that was specified wider than the cell to receive it, a $ placed after \sum rather than before it. The use of the centering environemnt in the midst of the tabular was not helpful. I replaced your image with a black-box placeholder, but this might get you started towards a resolution.

\documentclass{article}
\usepackage{scalerel}
\begin{document}

\begin{table}[h!]
 \begin{center}
\begin{tabular}{ | c | p{6cm} | p{3cm}|  }

 \hline
  Process & Diagrams & $\sum \left| \mathcal{M} \right|^2 / \left (
4 \pi \alpha_s\right)^2$      \\ \hline\hline
  $qq^\prime \rightarrow qq^\prime$

  &
\scalerel*{
\rule{0.5\textwidth}{20mm}%  I REPLACED YOUR INCLUDEGRAPHIC
}{\vphantom{\rule[-10mm]{1ex}{20mm}}}

&
$\frac{4}{9} \frac{s^2+u^2}{t^2}$    
  \\ \hline
 \end{tabular}
\label{tab:scattering_diagrams}
  \end{center}
  \end{table}
\end{document}
1

The adjustbox package is your friend:

\documentclass[a4paper,12pt]{book}
\usepackage[export]{adjustbox}
\usepackage{graphicx}
\usepackage{array}
\begin{document}

\begin{tabular}{ | c | c | m{3cm}|  }
\hline
Process & Diagrams  & $  \sum  |\mathcal{M}|^2 /( 4 \pi \alpha_s)^2$ \\
\hline
$qq' \rightarrow qq'$
  & \includegraphics[
      width=2cm,   % width
      height=2cm,  % height
      valign=c,    % vertical alignment
      ]{./chapter3/figures_susy/qq'_qq'.png}
  & $\frac{4}{9} \frac{s^2+u^2}{t^2}$ \\
\hline
\end{tabular}
\end{document}

enter image description here

I don't have your picture, so the big black blob.

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.