1

None of my efforts to vertically center the second column are working.

First trying the tabular environment:

\documentclass[]{book}
\usepackage[paperheight=3.0in,paperwidth=4.0in,margin=0.65in,
             heightrounded,showframe]{geometry}

\usepackage{tabularx, array}
\usepackage{multirow}
\usepackage{graphicx}

\def\myBioLoss{Biodiversity_Loss_CutTree.png} 
\def\myPollution{Pollute_Smokestack.png}

\begin{document}
\begin{center}
    \begin{tabular}{l m{2cm}}
        \multicolumn{2}{l}{Ecological Ceiling}  \\
        \includegraphics[width=.10\textwidth]{\myBioLoss} & Biodiversity    \\
        \includegraphics[width=.10\textwidth]{\myPollution} & Pollution     \\
    \end{tabular} 
\end{center}

\end{document}


But I get [![Not vertically centered][1]][1]
[1]: https://i.stack.imgur.com/s6tUE.png

I've tried adjustbox from: Centering a column vertically with longtable and pictures in rows which compiled but did not center.

I've tried tabularx and \def\tabularxcolumn#1{m{#1}} from Vertically center text in tabularx table, which compiled with the environment: \begin{tabularx}{\textwidth}{l m{2cm}} but did not center.

I've tried tabular* from Right-centered columns in tabular*, but this also compiled but did not center.

Lastly, this is for beamer: Problem with centering Images in a column (beamer) which does not help me.

Yes, I need the book class.

3
  • you have l in the first column and m in the second so as shown in your image you have aligned the vertical centre of the second column with the baseline of the first. Jan 16, 2021 at 23:15
  • Try \raisebox{-0.5\height}{\includegraphics{…}}.
    – Bernard
    Jan 17, 2021 at 0:26
  • @DavidCarlisle, thanks! The alignment was fixed once I used >{\centering\arraybackslash} m{2cm} for both columns. Jan 17, 2021 at 1:05

1 Answer 1

2

One way is to use of the adjusbox packages which enable moving images baselines position, adding margins etc. For inserting image it offer \adjustimage which can replace includegraphics:

\documentclass{book}
\usepackage[paperheight=3.0in,paperwidth=4.0in,margin=0.65in,
            heightrounded,showframe]{geometry}

\usepackage{array, multirow, tabularx} 
\usepackage[export]{adjustbox}          % it also load graphicx package
\def\myBioLoss{Biodiversity_Loss_CutTree.png}
\def\myPollution{Pollute_Smokestack.png}

\begin{document}
\begin{center}
    \adjustboxset{width=.1\textwidth,valign=c, margin=0pt 3pt 0pt 3pt}
    \begin{tabular}{l m{2cm}}
        \multicolumn{2}{l}{Ecological Ceiling}  \\
        \adjustimage{}{example-image-duck}%{\myBioLoss} 
            & Biodiversity    \\
        \adjustimage{}{example-image-duck}%{\myPollution} 
            & Pollution     \\
    \end{tabular}
\end{center}

\end{document}

enter image description here

1
  • 1
    @leandriis, you right. I comment this code line :-(. Corrected now!
    – Zarko
    Jan 17, 2021 at 9:17

You must log in to answer this question.

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