3

I need a table with 2 rows and 4 columns. The 1st column should contain an image, which uses both rows (centered). How?

The closest I can make is this:

\begin{tabular}{ | c | l | r | r |}
 \hline
   \raisebox{-1.4cm}[0.1cm][1.5cm]{\includegraphics[height=1.6cm]{xxxxx.png}} &
    \vtop{
    \hbox{\strut top line}
    \hbox{\strut botline}
    } & 
    \vtop{
    \hbox{\strut top line}
    \hbox{\strut botline}
    } & 
    \vtop{
    \hbox{\strut top line}
    \hbox{\strut botline}
    } \\
 \hline
 \end{tabular}

This way the text does not respect the alignment, i.e text on the right column should be aligned to the right.

Also, I have to reach this numbers ({-1.4cm}[0.1cm][1.5cm]) by trial and error.

1
  • 1
    just take the image out of the table \raisebox{-.5\height}{\includegraphics{.}}\begin{tabular}{lrr}.... Jun 29, 2015 at 17:47

1 Answer 1

3

Use tabular in a better way:

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{tabular}{|c|l|r|r|}
\hline
\raisebox{-.7\height}[0pt][0pt]{\includegraphics[height=1.8\normalbaselineskip]{duck}}
& 1111   & 1111   & 111111 \\
\cline{2-4}
& 222222 & 222222 & 2222   \\
\hline
\end{tabular}

\end{document}

enter image description here

Two versions with booktabs and no vertical rule.

\documentclass{article}

\usepackage{graphicx,booktabs}

\begin{document}

\begin{tabular}{c l r r}
\toprule
\raisebox{-.7\height}[0pt][0pt]{\includegraphics[height=1.8\normalbaselineskip]{duck}}
& 1111   & 1111   & 111111 \\
\cmidrule[\lightrulewidth]{2-4}
& 222222 & 222222 & 2222   \\
\bottomrule
\end{tabular}

\bigskip

\begin{tabular}{c l r r}
\toprule
\raisebox{-.6\height}[0pt][0pt]{\includegraphics[height=1.8\normalbaselineskip]{duck}}
& 1111   & 1111   & 111111 \\
& 222222 & 222222 & 2222   \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

2
  • What the duck? Is "duck" a ready to use image included in modern LaTeX systems? ;-) Jun 29, 2015 at 23:52
  • I'd fought with this in a minipage for what felt like forever, and your \raisebox just made my problems disappear!
    – Ben Stern
    May 27, 2020 at 4:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .