I am trying to get a text to center vertically within a tabularx. For centered and bottom text it works, but it fails for top text. What am I missing here?

        \begin{tabularx}{\textwidth}{ | X | c | }
            \noindent\parbox[t]{\hsize}{\includegraphics[width=5cm]{img/image001}} & top\\
            \noindent\parbox[c]{\hsize}{\includegraphics[width=5cm]{img/image001}} & center\\
            \noindent\parbox[b]{\hsize}{\includegraphics[width=5cm]{img/image001}} & bottom\\

Use valign from adjustbox.

I used also margin=4pt to put some space around the image, and I inverted the column types of your table, I don't think you want an X type for a column where there are only fixed-width images.


        \begin{tabularx}{\linewidth}{ | c | X | }
            \includegraphics[width=5cm, valign=t, margin=4pt]{example-image} & top\\
            \includegraphics[width=5cm, valign=c, margin=4pt]{example-image} & center\\
            \includegraphics[width=5cm,valign=b, margin=4pt]{example-image} & bottom\\

enter image description here

Your question may be a duplicate of this one: How to align picture top left in a table?.

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.