3

I'm placing images into a table, but they aren't lining up vertically, even though they are the same height. A complete example is:

\documentclass{llncs}
\usepackage{amsmath}
\usepackage{array}
\usepackage{graphicx}
\setlength{\tabcolsep}{6pt}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\begin{figure}[htbp]
\begin{center}
\begin{tabular}{ C{2.5cm} C{2.5cm}}
\includegraphics[height = 1.75in]{size.pdf} & \includegraphics[height = 1.75in]{back1.pdf} \\
(a) & (b) \\
\end{tabular}
\caption{This isn't laying out properly.}
\label{boards}
\end{center}
\end{figure}

\end{document}

Here are the images I want to line up:

Notice how they line up nicely in the html -- they are the same height. But, this is the output I get.

It is something about this macro which is causing the problem, in conjunction with images which are the same height, but different width.

\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

If I use c, everything works. If I layout the same image twice I don't have any problems:

\begin{tabular}{ c c}
\includegraphics[height = 1.75in]{back1.pdf} & \includegraphics[height = 1.75in]{back1.pdf} \\
(a) & (b) \\
\end{tabular}

Can anyone explain what is causing this issue? (In this context I can fix the issue, but I'm interested in understanding the underlying cause of the issue.)

1 Answer 1

1

It ends up that I found the answer unexpectedly. The 2.5cm allotted for each column and 1.75in height isn't quite enough to fit the full image. So, the larger image was being scaled slightly by latex, causing the mis-alignment. Allotting 2.6cm for each column fixes it.

(I should have looked at the error console, as it warned me:

Overfull \hbox (1.31029pt too wide) in paragraph at lines 13--13

But TeXShop hides it when showing the .pdf, so I forgot to check.)

You must log in to answer this question.

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