1

I have a table having an image in the first column and text in other three columns. the Image vertically aligns at the top and the text aligns at the bottom although I want the image to be center aligned and text to be top aligned

\usepackage{array}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{3cm}}
\newcolumntype{Q}{>{\raggedright\arraybackslash}p{4cm}}


\begin{table}[h]
 \centering
    \resizebox{\textwidth}{!}{
      \begin{tabular}{ |c|L|Q|L| }
       & \textbf{Column1} & \textbf{Column2} & \textbf{Column3} \\
        \hline
        \includegraphics[width=50mm]{images/1.jpg} &
        column 2 text. &
        column 3 text. &
        column 4 text. \\
        \hline
      \end{tabular}
}
\end{table}
0

1 Answer 1

2
\documentclass{article}
\usepackage{array}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{3cm}}
\newcolumntype{Q}{>{\raggedright\arraybackslash}p{4cm}}
\usepackage[export]{adjustbox}

\begin{document}
    \begin{table}[h]
    \centering
\begin{tabular}{ |Q|L|Q|L| }
    \hline
    & \textbf{Column1} & \textbf{Column2}   & \textbf{Column3} \\
    \hline
\includegraphics[width=\linewidth,
                 margin=0pt \tabcolsep pt 0pt \tabcolsep pt, % from "adjustbox"                            
                 valign=c]                                   % from "adjustbox"
                 {example-image}%{images/1.jpg}     
    &   column 2 text. &    column 3 text.  & column 4 text. \\
    \hline
\end{tabular}
    \end{table}

gives:

enter image description here

note: similar question was asked many, many time, it is for sure duplicate ...

edit: after reading your question again i recognize, that you looking for:

enter image description here

for this only change valign=c to valign=t

1
  • I don't think its a repeat question. I searched a lot. and either they solve image alignment or text alignment. and that too not in simple ways Commented Apr 27, 2018 at 19:27

You must log in to answer this question.

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