1

I am trying to create a long-table which contains images in two columns and number in third. This is the code I used:

\begin{lontable}[h]{c|c|c}
    \includegraphics[width=0.2\textwidth]{sample.png}
    & \includegraphics[width=0.12\textwidth]{WM.png} & $1.0$ \\ \hline 
\end{longtable}

I'm uploading the output for one row. I want to set the chess board image in the middle of the cell and the number 1.0 in the middle of the cell too. In picture, the red boxes are the locations where I want the image and text to be. Which commands should I use to adjust elements in the table?enter image description here

1
  • Try \raisebox{-0.5\height}{\includegraphics{...}}.
    – Bernard
    Feb 22 '20 at 23:55
3

With use of \adjustimage from the adjustbox package this is simple:

\documentclass{article}
\usepackage{longtable}
\usepackage[export]{adjustbox}

\begin{document}
{
\adjustboxset{width=\linewidth,valign=c, margin=0pt 3pt 0pt 3pt}
    \begin{longtable}[h]{|p{0.2\textwidth}|p{0.12\textwidth}|c|}
    \hline
\adjustimage{}{example-image-duck}
    & \adjustimage{}{example-image-duck} & $1.0$   \\ 
    \hline
    \end{longtable}
}
\end{document}

enter image description here

2
  • Thank you. This is working perfectly. Feb 23 '20 at 15:36
  • @Wave_Rider03, you cam accept answer (by clicking check mark at top left side of answer). With this you give recognition to people, who help you and move your question to group of solved questions.
    – Zarko
    Feb 23 '20 at 17:33

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.