Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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*}
share|improve this question
    
Try changing \tabcolsep to -\arrayrulewidth? Or no vertical rules. –  Bernard Aug 8 at 10:14

2 Answers 2

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

share|improve this answer

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

share|improve this answer
    
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. –  user112 Aug 8 at 10:39
    
@user112 See the updated answer. But it is little bit hacky. –  Harish Kumar Aug 8 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. =) –  user112 Aug 8 at 13:33
    
@user112 I have added some method. But you may be better of with egreg's technique :-) –  Harish Kumar Aug 9 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.