6

I have a table with 2 small images in each cell. I reduced the horisontal padding with

\setlength{\tabcolsep}{0pt}

But I still have a white vertical space between a table separation line and images (beneath the image). All tipps that I found are about making the space bigger.

But how can I remove that vertical padding?

How can I remove the horizontal space between the images? vertical padding of images in table

\begin{table*}[t]
\begin{center}
\caption{Comparison of the form and position}
\setlength{\tabcolsep}{0pt}
\begin{tabular}{|c|}
\hline
\multicolumn{7}{|c|}{-2.5 cm} 
\\ \hline
\includegraphics[height=27mm]{image1.png}
\includegraphics[height=27mm]{image2.png} \\ \hline
$\varphi$=0.5, 126 m/s \\ \hline
\end{tabular}
\end{center}
\end{table*}
  • Try changing \tabcolsep to -\arrayrulewidth? Or no vertical rules. – Bernard Aug 8 '14 at 10:14
6

The interrow padding is because the bottom of an image is on the baseline and the tabular rows take into account the possible depth of descenders.

We can remove the white space by lowering the images on the top row. A similar trick can be used to have a symmetric padding above the images.

\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{center}
\begin{tabular}{@{}c@{}}
\hline
\\[-\ht\strutbox]
\includegraphics[height=27mm,raise=-\dp\strutbox]{example-image-a}
\includegraphics[height=27mm,raise=-\dp\strutbox]{example-image-b} \\
\includegraphics[height=27mm]{example-image-a}
\includegraphics[height=27mm]{example-image-b} \\ \hline
$\varphi=0.5, \SI{126}{\meter\per\second}$ \\ \hline
\end{tabular}
\end{center}
\end{document}

enter image description here

  • This worked like a charm ! Thank you so much ! – matthieu Nov 14 '17 at 9:46
3

You can change the \arraystretch like

\def\arraystretch{0.15}

Choose an appropriate value.

\documentclass{article}
\usepackage{graphicx}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{center}
\setlength{\tabcolsep}{0pt}
\def\arraystretch{0.15}
\begin{tabular}{c}
\hline
\includegraphics[height=27mm]{example-image-a}
\includegraphics[height=27mm]{example-image-b} \\\hline
\includegraphics[height=27mm]{example-image-a}
\includegraphics[height=27mm]{example-image-b} \\\noalign{\smallskip} \hline \noalign{\smallskip}
$\varphi =0.5, 126\si{\meter\per\second}$ \\ \noalign{\smallskip} \hline 
\end{tabular}
\end{center}
\end{document}

enter image description here

You can also remove that space on a row basis by adding \\[-\dp\strutbox] at the end of row. All credits to egreg for \dp\strutbox.

\documentclass{article}
\usepackage{graphicx}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{center}
\setlength{\tabcolsep}{0pt}
\begin{tabular}{|c|}
\hline
\includegraphics[height=27mm]{example-image-a}
\includegraphics[height=27mm]{example-image-b} \\[-\dp\strutbox]\hline
\includegraphics[height=27mm]{example-image-a}
\includegraphics[height=27mm]{example-image-b} \\ \hline 
$\varphi =0.5, 126\si{\meter\per\second}$ \\ \hline
\end{tabular}
\end{center}
\end{document}

enter image description here

  • Thanks! It works! But how can I apply this only for a sertain row. Because the row with explanation (phi=0.5, V=120m/s ...) must stay normal. – AntonZi Aug 8 '14 at 10:39
  • @user112 See the updated answer. But it is little bit hacky. – user11232 Aug 8 '14 at 11:02
  • Thanks, that works, but when I do this, the table/cell border (vertical frame) is teared in cells where \noalign{\smallskip} is applied. =) – AntonZi Aug 8 '14 at 13:33
  • @user112 I have added some method. But you may be better of with egreg's technique :-) – user11232 Aug 9 '14 at 0:17

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.